/* ---------- Tokens ---------- */
:root {
  --bg: #171a23;
  --surface: #1f2330;
  --surface-2: #282d3d;
  --line: #333a4e;
  --text: #e9ebf2;
  --muted: #a3aabd;
  --accent: #7fd0e6;
  --accent-ink: #10222a;
  color-scheme: dark;

  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.6rem, 3.2vw, 2.1rem);
  --step-hero: clamp(3rem, 9vw, 6.25rem);

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --max: 68rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--step-0)/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body.lock { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.section { padding-block: clamp(3.5rem, 8vw, 6rem); border-top: 1px solid var(--line); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: var(--step-2); font-weight: 700; margin-bottom: 1.75rem; }
p { margin: 0 0 1rem; }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--accent); color: var(--accent-ink); padding: 0.5rem 0.9rem; border-radius: 6px; z-index: 100; }
.skip:focus { left: 0.5rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-head); font-weight: 700; text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
@media (max-width: 40rem) { .topbar nav a[href="#experience"] { display: none; } }
.topbar nav { display: flex; gap: clamp(0.9rem, 2.4vw, 1.75rem); overflow-x: auto; scrollbar-width: none; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: var(--step--1); font-weight: 500; padding: 0.25rem 0; white-space: nowrap; }
.topbar nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(3.5rem, 11vw, 8rem); padding-bottom: clamp(3rem, 7vw, 5rem); }
.hero h1 { font-size: var(--step-hero); font-weight: 700; letter-spacing: -0.035em; line-height: 0.98; }
.hero-role { font-family: var(--font-head); font-size: var(--step-1); font-weight: 500; color: var(--accent); margin: 1.25rem 0 0; }
.hero-intro { font-size: clamp(1.15rem, 2.2vw, 1.4rem); max-width: 36rem; margin: 1.25rem 0 0; color: var(--text); line-height: 1.5; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.55rem 1.15rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--text);
  font: 500 var(--step--1)/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: #46506b; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #99dcee; border-color: #99dcee; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* ---------- About ---------- */
.about-grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .about-grid { grid-template-columns: 1.4fr 1fr; gap: 4rem; } }
.prose p { max-width: 38rem; }
.facts { margin: 0; display: grid; gap: 1.25rem; align-content: start; }
.facts div { padding-left: 1rem; border-left: 2px solid var(--line); }
.facts dt { font-family: var(--font-head); font-weight: 700; font-size: var(--step--1); color: var(--accent); margin-bottom: 0.15rem; }
.facts dd { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.55; }

/* ---------- Timeline (real sequence) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 0.31rem; top: 0.6rem; bottom: 0.6rem; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 2.25rem 2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 0.55rem; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.tl-head { display: flex; flex-wrap: wrap; gap: 0.15rem 1rem; align-items: baseline; justify-content: space-between; }
.tl-role { font-family: var(--font-head); font-size: var(--step-1); font-weight: 700; }
.tl-company { color: var(--muted); font-size: var(--step--1); margin: 0.1rem 0 0.5rem; }
.tl-dates { color: var(--muted); font-size: var(--step--1); white-space: nowrap; }
.tl-summary { max-width: 42rem; margin: 0; color: #cfd3e0; }

/* ---------- CV ---------- */
.cv-block { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 52rem) { .cv-block { grid-template-columns: 1fr 1fr; gap: 4rem; } }
.cv-preview {
  position: relative; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #fff; cursor: zoom-in; max-width: 22rem; justify-self: start; aspect-ratio: 1076 / 760;
}
.cv-preview img { width: 100%; height: auto; object-fit: cover; object-position: top; transition: transform 0.25s; }
.cv-preview:hover img { transform: scale(1.02); }

/* ---------- Projects: full-width banners ---------- */
.projects { padding: 0; border-top: 0; }
.projects > .wrap { border-top: 1px solid var(--line); padding-top: clamp(3.5rem, 8vw, 6rem); padding-bottom: 0.25rem; }
.section-intro { color: var(--muted); max-width: 36rem; margin: -0.75rem 0 2rem; }
.banners { display: grid; margin-top: 0.5rem; }

.banner {
  --pad: max(var(--gutter), calc((100% - 76rem) / 2));
  position: relative; overflow: hidden; background: #0e1120;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.banner-h { margin: 0; font: inherit; }
.banner-toggle {
  position: relative; isolation: isolate; display: block; width: 100%; overflow: hidden;
  min-height: clamp(22rem, 33vw, 27rem); padding: 2.75rem var(--pad);
  border: 0; background: none; color: #fff; text-align: left; font: inherit; cursor: pointer;
}
.banner-toggle:focus-visible { outline-offset: -4px; outline-color: var(--accent); }
.banner-bg {
  position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center;
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.banner-toggle::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(9, 12, 24, 0.82) 0%, rgba(9, 12, 24, 0.5) 36%, rgba(9, 12, 24, 0) 68%),
    linear-gradient(0deg, rgba(9, 12, 24, 0.35), rgba(9, 12, 24, 0) 40%);
}
.banner-toggle:hover .banner-bg { transform: scale(1.04); }

.banner-copy { position: relative; display: grid; gap: 1.1rem; justify-items: start; max-width: 25rem; }
.banner-logo { height: clamp(5.25rem, 11vw, 8rem); width: auto; max-width: 100%; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45)); }
.banner-short { font-size: 1.05rem; line-height: 1.5; color: rgba(255, 255, 255, 0.94); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5); }
.banner-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.banner-tags span { padding: 0.3rem 0.8rem; border-radius: 999px; background: rgba(12, 22, 52, 0.8); font-size: 0.8rem; font-weight: 600; }
.banner-cta {
  display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 0.25rem;
  padding: 0.62rem 0.95rem 0.62rem 1.2rem; border-radius: 999px;
  background: var(--accent); color: #0b1020; font-size: var(--step--1); font-weight: 600; line-height: 1;
  transition: transform 0.2s;
}
.banner-toggle:hover .banner-cta { transform: translateY(-2px); }
.banner-cta svg { transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.banner.is-open .banner-cta svg { transform: rotate(180deg); }

.phones {
  position: absolute; z-index: 1; top: 1.75rem; bottom: 0; right: var(--pad);
  width: min(50%, 36rem); display: flex; justify-content: center; align-items: flex-start; pointer-events: none;
}
.phones img { flex: none; height: 118%; width: auto; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.5)); transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.phones img:nth-child(1) { transform: translateY(7%) rotate(-5deg); margin-right: -9%; }
.phones img:nth-child(2) { position: relative; z-index: 1; height: 128%; transform: translateY(-1%); }
.phones img:nth-child(3) { transform: translateY(7%) rotate(5deg); margin-left: -9%; }
.banner-toggle:hover .phones img:nth-child(1) { transform: translateY(3%) rotate(-6deg); }
.banner-toggle:hover .phones img:nth-child(2) { transform: translateY(-4%); }
.banner-toggle:hover .phones img:nth-child(3) { transform: translateY(3%) rotate(6deg); }

@media (max-width: 46rem) {
  .banner-toggle { min-height: 0; padding: 2rem var(--gutter) 0; }
  .banner-toggle::before { background: linear-gradient(180deg, rgba(9, 12, 24, 0.72), rgba(9, 12, 24, 0.25) 70%, rgba(9, 12, 24, 0.5)); }
  .phones { position: relative; top: auto; right: auto; bottom: auto; width: 100%; height: 15.5rem; margin-top: 1.5rem; }
  .banner-copy { max-width: none; }
}

/* open panel */
.panel {
  display: grid; grid-template-rows: 0fr;
  background: color-mix(in srgb, var(--accent) 8%, #12151f);
  transition: grid-template-rows 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.banner.is-open .panel { grid-template-rows: 1fr; }
.panel-clip { overflow: hidden; min-height: 0; }
.panel-inner {
  display: grid; gap: 2.25rem; padding: 2.5rem var(--pad) 3rem;
  opacity: 0; transform: translateY(-14px);
  transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.banner.is-open .panel-inner { opacity: 1; transform: none; transition-delay: 0.12s; }
@media (min-width: 56rem) {
  .panel-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 3.5rem; align-items: start; }
}
.panel-text { display: grid; gap: 1.5rem; min-width: 0; }
.panel-summary { font-size: 1.2rem; line-height: 1.55; margin: 0; max-width: 38rem; }
.panel h4 { font-family: var(--font-head); font-size: var(--step-1); margin: 0 0 0.75rem; color: var(--accent); }
.panel-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.55rem; max-width: 38rem; color: #d3d7e4; }
.panel-list li::marker { color: var(--accent); }
.panel-details p { max-width: 38rem; color: #d3d7e4; }
.panel-media { display: grid; gap: 1.5rem; min-width: 0; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.shots button { padding: 0; border: 0; background: none; border-radius: 16px; cursor: zoom-in; transition: transform 0.2s; }
.shots button:hover { transform: translateY(-4px); }
.shots img { width: 100%; height: auto; border-radius: 16px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4); }
.video { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: 12px; background: #000; }
.panel-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.panel-links .btn-primary { background: var(--accent); border-color: var(--accent); color: #0b1020; }

/* ---------- Dialogs (CV viewer and image preview) ---------- */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); border-radius: 18px; max-width: min(56rem, 94vw); width: 100%; max-height: 92vh; overflow: auto; overscroll-behavior: contain; }
dialog::backdrop { background: rgba(8, 10, 16, 0.72); backdrop-filter: blur(3px); }
.dlg-close {
  position: sticky; top: 0.75rem; display: block; width: max-content; margin: 0.75rem 0.75rem -3.25rem auto; z-index: 3;
  min-height: 2.5rem; padding: 0.4rem 1rem; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--text); font: 500 var(--step--1)/1 var(--font-body); cursor: pointer;
}
.dlg-close:hover { background: var(--surface-2); }
.dlg-close-inline { position: static; display: inline-flex; margin: 0; }
.dlg-bar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.cv-pages { display: grid; gap: 1rem; padding: 1rem; background: var(--bg); }
.cv-pages img { width: 100%; height: auto; border-radius: 6px; background: #fff; }
#cv-dialog { max-width: min(46rem, 94vw); }
#lightbox { background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; width: auto; }
#lightbox img { max-height: 90vh; max-width: 92vw; width: auto; border-radius: 16px; margin-inline: auto; }
#lightbox .dlg-close { position: absolute; top: -2.9rem; right: 0; margin: 0; }

/* ---------- Footer ---------- */
footer.section { padding-bottom: 3rem; }
#contact { border-top: 0; }
.copyright { color: var(--muted); font-size: var(--step--1); margin: 3.5rem 0 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
