/* =========================================================
   CV SITE — styles (inspired by PRO Pozitsiya reference)
   ========================================================= */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* Design tokens — light theme */
:root {
  --bg: #F4F4F2;
  --bg-elev: #FFFFFF;
  --bg-muted: #E5E5E3;
  --text: #0A0A0A;
  --text-muted: #6B6B6B;
  --text-subtle: #9A9A9A;
  --border: #E5E5E3;
  --border-strong: #D4D4D0;
  --accent: #0A0A0A;
  --accent-soft: #1A1A1A;
  --chip-bg: #FFFFFF;
  --chip-border: #E5E5E3;
  --shadow: 0 1px 0 rgba(10, 10, 10, 0.04);

  --font-display: 'Inter Tight', Inter, system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 880px;
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap-md: 16px;
  --gap-lg: 28px;
  --gap-xl: 48px;
  --gap-2xl: 72px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-full: 9999px;
}

/* Dark theme */
html[data-theme="dark"] {
  --bg: #0E0E0E;
  --bg-elev: #171717;
  --bg-muted: #1F1F1F;
  --text: #F4F4F2;
  --text-muted: #A8A8A8;
  --text-subtle: #787878;
  --border: #262626;
  --border-strong: #303030;
  --accent: #F4F4F2;
  --accent-soft: #D4D4D0;
  --chip-bg: #1A1A1A;
  --chip-border: #2A2A2A;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
}

.lang-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.18s ease;
}

.lang-btn:hover { color: var(--text); }

.lang-btn[aria-selected="true"] {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.lang-btn .flag {
  width: 20px;
  height: 14px;
  overflow: hidden;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-btn .flag svg {
  width: 20px;
  height: 14px;
  display: block;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  transition: all 0.18s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.18s ease;
  border: 1px solid var(--text);
}

.print-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* =========================================================
   CV CONTENT
   ========================================================= */
.cv {
  max-width: var(--container);
  margin: 0 auto;
  padding: 64px 24px 48px;
}

/* HERO */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap-xl);
  align-items: start;
  padding-bottom: var(--gap-xl);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap-xl);
}

.hero-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 var(--gap-sm);
  color: var(--text);
}

.hero-role {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 4px;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin: 0 0 var(--gap-md);
}

.hero-location {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 var(--gap-lg);
}

.hero-readtime {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 var(--gap-md);
}

.hero-photo {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-md);
  object-fit: cover;
  overflow: hidden;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text);
  transition: color 0.15s ease;
}

.contact:hover { color: var(--text-muted); }

.contact .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-subtle);
}

.contact .label-visible { color: var(--text); }
.contact .label-value { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* SECTIONS */
.section {
  margin-bottom: var(--gap-xl);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--text);
}

.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ABOUT */
.about p {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 var(--gap-md);
}
.about p:last-child { margin-bottom: 0; }

/* SPOILER (Telegram-style blurred text, reveal on click) */
.spoiler {
  display: inline-block;
  cursor: pointer;
  filter: blur(7px);
  transition: filter 0.25s ease, background 0.25s ease;
  border-radius: 4px;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  outline: none;
}
.spoiler:hover { filter: blur(5px); }
.spoiler:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.spoiler.revealed {
  filter: blur(0);
  background: transparent;
  user-select: text;
  -webkit-user-select: text;
  padding: 0;
  cursor: text;
}
.spoiler-hint {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-subtle);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.spoiler.revealed + .spoiler-hint { display: none; }

/* POSITION card */
.position-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap-md);
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

.position-item .position-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.position-item .position-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
}

.position-item .position-value-alt {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* EXPERIENCE */
.exp {
  position: relative;
  padding-left: 0;
  margin-bottom: var(--gap-xl);
}

.exp:last-child { margin-bottom: 0; }

/* Standalone experience (no inner projects) — wrap in same card look as projects */
.exp.standalone-exp {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  transition: border-color 0.15s ease;
}

.exp.standalone-exp:hover { border-color: var(--border-strong); }

.exp.standalone-exp .exp-head { margin-bottom: var(--gap-sm); }
.exp.standalone-exp .exp-company { font-size: 1.0625rem; }
.exp.standalone-exp .bullets li { font-size: 0.875rem; }

.exp-head {
  margin-bottom: var(--gap-md);
}

.exp-company {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 2px;
}

.exp-meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 var(--gap-sm);
}

.exp-meta-role {
  color: var(--text);
  font-weight: 500;
}

.exp-note {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  font-style: italic;
  margin: 0 0 var(--gap-sm);
}

.exp-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 var(--gap-md);
  line-height: 1.6;
}

.bullets {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bullets li {
  position: relative;
  padding-left: 20px;
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 6px;
  color: var(--text);
}

.bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  line-height: inherit;
  font-size: 0.88em;
  color: var(--text-muted);
}

/* inline stat highlight (numbers in bullets) */
.stat {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875em;
  color: var(--text);
  letter-spacing: -0.01em;
}

.bullets li:last-child { margin-bottom: 0; }

/* PROJECT cards inside experience */
.projects {
  display: grid;
  gap: var(--gap-md);
  margin-top: var(--gap-md);
}

.project {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  transition: border-color 0.15s ease;
}

.project:hover { border-color: var(--border-strong); }

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 6px;
}

.project-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--text);
  margin: 0;
}

.project-role {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.project-period {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-left: auto;
  white-space: nowrap;
}

.project-stack {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin: 0 0 var(--gap-sm);
  letter-spacing: 0.01em;
}

.project .bullets li { font-size: 0.875rem; }

/* OWN PRODUCTS + TEACHING use same project-card layout */

/* ACHIEVEMENTS */
.ach-group {
  margin-bottom: var(--gap-lg);
}

.ach-group:last-child { margin-bottom: 0; }

.ach-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  margin: 0 0 8px;
}

.ach-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.ach-list li {
  position: relative;
  padding-left: 22px;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
}

.ach-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text);
  font-weight: 600;
}

/* SKILLS */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-md);
}

.skill-group {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
}

.skill-group-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  margin: 0 0 8px;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-chips li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--text);
  letter-spacing: 0.01em;
}

.skill-note {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  font-style: italic;
  margin: 8px 0 0;
}

/* EDUCATION */
.edu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--gap-md);
}

.edu-item {
  padding: 14px 18px;
  border-left: 2px solid var(--border-strong);
  background: transparent;
}

.edu-institution {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin: 0 0 2px;
}

.edu-degree {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 2px;
}

.edu-meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-subtle);
  margin: 0;
}

.edu-courses {
  margin-top: var(--gap-lg);
}

.edu-courses-head {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  margin: 0 0 10px;
}

.course-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.course-list li {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--gap-md);
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
}

.course-year {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
}

.course-provider { color: var(--text-muted); }

/* LANGUAGES + ADDITIONAL */
.lang-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--gap-md);
  display: grid;
  gap: 6px;
}

.lang-list li {
  font-size: 0.9375rem;
  color: var(--text);
}

.lang-level {
  color: var(--text-muted);
  margin-left: 6px;
}

.additional-block {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: var(--gap-lg);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--border);
}

/* FOOTER */
.cv-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--gap-xl);
}

.cv-footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-meta a { text-decoration: underline; text-underline-offset: 3px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 720px) {
  .cv { padding: 32px 20px 32px; }
  .hero { grid-template-columns: 1fr; gap: var(--gap-lg); }
  .hero-photo { width: 140px; height: 140px; order: -1; }
  .section { margin-bottom: var(--gap-xl); }
  .position-card { padding: 16px 18px; }
  .project-period { margin-left: 0; width: 100%; }
  .course-list li { grid-template-columns: 50px 1fr; }
}

@media (max-width: 440px) {
  .topbar-inner { padding: 10px 16px; }
  .print-btn span { display: none; }
  .hero-text h1 { font-size: 2.25rem; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* =========================================================
   COLLAPSIBLE SECTIONS — iOS-style chevron on the right
   ========================================================= */
.collapsible-head {
  cursor: pointer;
  user-select: none;
  align-items: center;
  transition: color 0.15s ease;
}

.collapsible-head:hover .section-title { color: var(--text-muted); }

.collapsible-head .section-kicker { display: none; }

.collapsible-head::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-right: 1.8px solid var(--text-subtle);
  border-bottom: 1.8px solid var(--text-subtle);
  transform: rotate(45deg);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
  margin-right: 4px;
  flex-shrink: 0;
}

.collapsible-head:hover::after {
  border-color: var(--text);
}

.section.collapsed .collapsible-head::after {
  transform: rotate(-45deg);
}

.section.collapsed > .ach-group {
  display: none;
}

/* =========================================================
   SCROLL-REVEAL ANIMATIONS
   ========================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-anim] { opacity: 0; }

[data-anim].in-view {
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--anim-delay, 0ms);
}

.hero[data-anim].in-view { animation-duration: 0.65s; }

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  [data-anim] { opacity: 1; }
}
