/* =========================================================
   Bohdan Savchenko — Portfolio
   Tokens measured on the live Framer site:
     font    : Funnel Sans (400 / 500 / 700)
     dark    : bg #141414, cream text #ECE8DF (bright #F6F4F0)
     borders : cream @ 12%
     radii   : images 8px · buttons/pills 4px
     hero h1 : 192px @ desktop, letter-spacing -0.06em
     display : 120px lowercase headings ("my experience")
   Dark is default; [data-theme="light"] / body.light overrides.
   ========================================================= */

/* ---------- Design tokens: DARK (default) ---------- */
:root,
[data-theme="dark"] {
  --bg:            #141414;
  --bg-elevated:   #1C1C1C;
  --border:        rgba(236, 232, 223, 0.12);
  --text:          #ECE8DF;
  --text-bright:   #F6F4F0;
  --text-muted:    rgba(236, 232, 223, 0.62);
  --text-faint:    rgba(236, 232, 223, 0.40);
  --accent:        #ECE8DF;   /* pill / CTA fill  */
  --accent-ink:    #141414;   /* text on pill     */
  --shadow:        0 24px 60px -24px rgba(0, 0, 0, 0.8);

  /* radii measured on the live site */
  --radius-media:  8px;
  --radius-btn:    4px;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 400ms;

  --maxw: 1440px;
  --gutter: clamp(20px, 5vw, 64px);
}

/* ---------- Design tokens: LIGHT (warm inverse) ---------- */
[data-theme="light"] {
  --bg:            #F6F4F0;
  --bg-elevated:   #FFFFFF;
  --border:        rgba(20, 20, 20, 0.12);
  --text:          #141414;
  --text-bright:   #000000;
  --text-muted:    rgba(20, 20, 20, 0.60);
  --text-faint:    rgba(20, 20, 20, 0.42);
  --accent:        #141414;
  --accent-ink:    #F6F4F0;
  --shadow:        0 24px 60px -28px rgba(20, 20, 20, 0.22);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Funnel Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  transition: background var(--dur) var(--ease-in-out),
              color var(--dur) var(--ease-in-out),
              opacity 250ms var(--ease-in-out);
  animation: page-in 350ms var(--ease-out);   /* page fade-in */
}
body.page-exit { opacity: 0; }                 /* page fade-out (app.js) */
body.no-scroll { overflow: hidden; }           /* lightbox scroll lock */
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; padding: 0; }
figure { margin: 0; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.is-hidden { display: none !important; }

/* =========================================================
   HEADER — fixed, backdrop blur
   ========================================================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out);
}
.site-header.scrolled { border-bottom-color: var(--border); }

.header-inner {
  position: relative;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 16px var(--gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; white-space: nowrap; }

/* language switcher */
.lang-switch { display: flex; align-items: center; gap: 6px; }
.lang-btn {
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .82rem; letter-spacing: .05em;
  color: var(--text-faint);
  min-height: 44px; display: inline-flex; align-items: center;
  transition: color 200ms var(--ease-out);
}
.lang-btn:hover { color: var(--text-muted); }
.lang-btn.is-active { color: var(--text); }
.lang-sep { color: var(--text-faint); font-size: .8rem; }

/* theme toggle — centered on desktop */
.theme-toggle {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; color: var(--text);
}
.theme-toggle .icon {
  position: absolute; width: 20px; height: 20px;
  transition: opacity 300ms var(--ease-out), transform 400ms var(--ease-out);
}
.icon-sun  { opacity: 0; transform: rotate(-90deg) scale(.6); }
.icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .icon-sun  { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .icon-moon { opacity: 0; transform: rotate(90deg) scale(.6); }

/* nav — lowercase like the live site */
.main-nav { margin-left: auto; display: flex; gap: 28px; }
.main-nav a {
  position: relative; font-weight: 500; font-size: 1rem; color: var(--text-muted);
  padding: 4px 0; transition: color 200ms var(--ease-out);
}
.main-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--text); transition: width 300ms var(--ease-out);
}
.main-nav a:hover { color: var(--text); }
.main-nav a:hover::after { width: 100%; }
.main-nav a[aria-current="page"] { color: var(--text); }

/* hamburger */
.menu-toggle {
  display: none; position: relative;
  width: 44px; height: 44px;
  background: none; border: 0; cursor: pointer; color: var(--text);
}
.menu-toggle .menu-line {
  position: absolute; left: 12px;
  width: 20px; height: 2px; border-radius: 2px;
  background: var(--text);
  transition: transform 300ms var(--ease-out), opacity 200ms var(--ease-out), top 300ms var(--ease-out);
}
.menu-toggle .menu-line:nth-child(1) { top: 16px; }
.menu-toggle .menu-line:nth-child(2) { top: 22px; }
.menu-toggle .menu-line:nth-child(3) { top: 28px; }
.menu-toggle.open .menu-line:nth-child(1) { top: 22px; transform: rotate(45deg); }
.menu-toggle.open .menu-line:nth-child(2) { opacity: 0; }
.menu-toggle.open .menu-line:nth-child(3) { top: 22px; transform: rotate(-45deg); }

/* =========================================================
   SHARED LAYOUT
   ========================================================= */
main { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* lowercase display headings ("my experience", "other projects") */
.display-title {
  font-size: clamp(2.4rem, 8.5vw, 7.5rem);   /* 120px @ desktop */
  letter-spacing: -0.05em;
  color: var(--text-bright);
}
/* page titles ("about me") */
.page-title {
  font-size: clamp(2.8rem, 8vw, 5.75rem);    /* 92px @ desktop */
  letter-spacing: -0.06em;
  color: var(--text-bright);
}
/* buttons — 4px radius, 12x24 padding (measured) */
.btn-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 500; font-size: 1rem;
  transition: transform 300ms var(--ease-out), opacity 200ms var(--ease-out);
}
.btn-pill:hover { transform: translateY(-2px); }

/* =========================================================
   HOME — HERO
   ========================================================= */
.hero { padding-block: clamp(140px, 24vh, 220px) clamp(40px, 6vw, 72px); }
.hero-title {
  font-size: clamp(40px, 8vw, 130px);        /* fallback; JS fits it to the full 1440 width */
  letter-spacing: -0.06em;
  line-height: 1.1;
  color: var(--text-bright);
  white-space: nowrap;                       /* one line — filled to container width */
}
/* per-letter spans for the repel effect (built by app.js) */
.hero-title .repel-letter {
  display: inline-block;
  white-space: pre;
  will-change: transform;
}
.hero-eyebrow {
  display: block;
  width: 100%;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: clamp(.78rem, 1.4vw, .95rem);
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;                          /* aligned to the left edge, in line with the rest */
}

/* =========================================================
   HOME — SKILLS MARQUEE (infinite loop, 1440 grid-aligned)
   ========================================================= */
/* lives inside <main>, which already provides the 1440 + gutter container,
   so it just adds vertical rhythm — its edges align with the rest of the grid */
.marquee-section {
  padding-block: clamp(28px, 4vw, 56px);
  border-block: 1px solid var(--border);
}
.marquee {
  position: relative;
  overflow: hidden;
}
/* edge blur + fade (like the original: text softens as it enters/leaves).
   Each pseudo blurs the scrolling text behind it and fades to the page bg,
   concentrated at the very edge via its own mask. */
.marquee::before, .marquee::after {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 15%;
  z-index: 2;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.marquee::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg) 12%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000, transparent);
          mask-image: linear-gradient(90deg, #000, transparent);
}
.marquee::after {
  right: 0;
  background: linear-gradient(-90deg, var(--bg) 12%, transparent);
  -webkit-mask-image: linear-gradient(-90deg, #000, transparent);
          mask-image: linear-gradient(-90deg, #000, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 60s linear infinite;   /* slower, closer to the original */
}
.marquee:hover .marquee-track { animation-play-state: paused; }   /* pause on hover */
.marquee-group { display: flex; flex-shrink: 0; align-items: center; }
.marquee-item {
  font-size: clamp(0.95rem, 2vw, 1.75rem);   /* ~1.5× smaller than before */
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-bright);
  white-space: nowrap;
}
.marquee-sep {
  margin-inline: clamp(14px, 1.8vw, 28px);
  font-size: clamp(.75rem, 1.4vw, 1.1rem);
  color: var(--text-faint);
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }   /* one duplicated group → seamless loop */
}

/* =========================================================
   HOME — PROJECT GRID (2-col, image 8px radius, text below)
   ========================================================= */
.work { padding-block: clamp(24px, 4vw, 56px) clamp(60px, 9vw, 120px); }

/* "selected work" head + filter bar */
.work-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: clamp(28px, 4vw, 48px);
}
.filter-bar { display: flex; gap: 24px; }
.filter-btn {
  position: relative;
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font: inherit; font-weight: 500; font-size: 1rem;
  color: var(--text-faint);
  min-height: 44px; display: inline-flex; align-items: center;
  transition: color 200ms var(--ease-out);
}
.filter-btn::after {
  content: ""; position: absolute; left: 0; bottom: 8px; height: 1.5px; width: 0;
  background: var(--text); transition: width 300ms var(--ease-out);
}
.filter-btn:hover { color: var(--text-muted); }
.filter-btn.is-active { color: var(--text); }
.filter-btn.is-active::after { width: 100%; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* strict 2-column */
  gap: 40px;
}

.project-card { display: block; }
.project-media {
  position: relative;
  aspect-ratio: 5 / 4;                       /* ≈424x340 measured card media */
  border-radius: var(--radius-media);
  overflow: hidden;
  background: var(--bg-elevated);
  /* 3D tilt card (JS drives the transform) */
  transform: perspective(1200px);
  transform-style: preserve-3d;
  transition: transform 0.2s ease-out, box-shadow 0.3s ease;
  will-change: transform;
}
/* shadow while tilting — themed for dark / light */
.project-media.tilting { box-shadow: 0 30px 60px -18px rgba(0, 0, 0, 0.55); }
[data-theme="light"] .project-media.tilting { box-shadow: 0 30px 60px -20px rgba(20, 20, 20, 0.28); }
.project-media img {
  width: 100%; height: 100%; object-fit: cover;
}

/* cursor-following spotlight overlay (built by app.js) */
.tilt-spotlight {
  position: absolute; inset: 0; z-index: 10;
  pointer-events: none; overflow: hidden;
  opacity: 0; transition: opacity 0.3s;
}
.project-media.tilting .tilt-spotlight { opacity: 1; }
.tilt-spotlight::before {
  content: "";
  position: absolute; width: 200%; height: 200%; border-radius: 50%;
  left: var(--sx, 50%); top: var(--sy, 50%);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 40%);
  opacity: 1;                                /* light theme: full (per the component) */
}
[data-theme="dark"] .tilt-spotlight::before { opacity: 0.5; }   /* dark:opacity-50 */
/* placeholder when the image is missing */
.project-media.is-empty::after {
  content: attr(data-label);
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-faint); font-weight: 700;
  font-size: 1.3rem; letter-spacing: -0.03em; text-align: center; padding: 0 16px;
}

.project-info { padding-top: 16px; }
.project-name {
  display: block;
  font-size: 1.2rem;                          /* 19px measured */
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color 200ms var(--ease-out);
}
.project-cat {
  display: block; margin-top: 2px;
  font-size: 1rem; font-weight: 400;
  color: var(--text-muted);
}
.project-card:hover .project-name { color: var(--text-bright); }

/* -------- DESKTOP: alternating mirrored collage (homepage grid only) --------
   Cards vary in height via grid-row spans to form a staggered collage.
   Cards 1–4 set a pattern; cards 5–8 mirror it left↔right. Repeats every 8. */
@media (min-width: 768px) {
  #projectGrid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;          /* row unit; spans build the card heights */
    grid-auto-flow: row dense;      /* backfill gaps → tight staggered collage */
    gap: 40px 32px;
    align-items: stretch;
  }
  #projectGrid .project-card {
    display: flex;
    flex-direction: column;         /* media grows, text sits at the bottom */
  }
  #projectGrid .project-media {
    aspect-ratio: auto;             /* override the fixed 5/4 — fill the card */
    flex: 1 1 auto;
    min-height: 0;
    /* img already uses object-fit: cover, so every shape is filled cleanly */
  }
  #projectGrid .project-media img {
    object-fit: cover;              /* fill the card — no blank background */
    width: 100%;
    height: 100%;
  }

  /* pin the columns so the tall/short pattern stays consistent side-to-side */
  #projectGrid .project-card:nth-child(odd)  { grid-column: 1; }   /* left  */
  #projectGrid .project-card:nth-child(even) { grid-column: 2; }   /* right */

  /* one 4-card pattern that REPEATS every 4 (cards 5–8 == cards 1–4) */
  #projectGrid .project-card:nth-child(4n + 1) { grid-row: span 3; }  /* tall  · left  */
  #projectGrid .project-card:nth-child(4n + 2) { grid-row: span 2; }  /* short · right */
  #projectGrid .project-card:nth-child(4n + 3) { grid-row: span 2; }  /* short · left  */
  #projectGrid .project-card:nth-child(4n + 4) { grid-row: span 3; }  /* tall  · right */
}

/* MOBILE / small screens: plain 1-column list, no spans, no collage */
@media (max-width: 767px) {
  #projectGrid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  #projectGrid .project-card { display: block; }
  #projectGrid .project-media { aspect-ratio: 5 / 4; }
}

/* =========================================================
   HOME — ABOUT BLOCK (full-width intro + 3-column grid)
   ========================================================= */
.about-block { padding-block: clamp(48px, 8vw, 120px); }

/* full-width intro; second half dimmed like the design */
.about-intro {
  font-size: clamp(1.5rem, 3.6vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-bright);
}
.about-intro .dim { color: var(--text-faint); }

/* col1 avatar · col2 why + resume · col3 when */
.about-cols {
  margin-top: clamp(32px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.about-cols.no-avatar { grid-template-columns: 1fr 1fr; }
.about-portrait {
  border-radius: var(--radius-media);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }
.about-col { display: grid; gap: 20px; justify-items: start; align-content: start; }
.about-sub {
  font-size: .95rem; font-weight: 400;
  color: var(--text-muted);
}
.about-col p { font-size: 1.05rem; line-height: 1.6; color: var(--text); }
.about-col .btn-pill { margin-top: 4px; }

/* =========================================================
   ABOUT PAGE
   ========================================================= */
.about-page { padding-top: clamp(120px, 18vh, 180px); }
.about-grid {
  margin-top: clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: 1fr minmax(280px, 424px);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.about-grid.no-avatar { grid-template-columns: 1fr; }
.about-copy { display: grid; gap: 24px; justify-items: start; max-width: 640px; }
.about-copy p { font-size: clamp(1.1rem, 1.8vw, 1.25rem); font-weight: 500; line-height: 1.55; color: var(--text); }
.about-copy .btn-pill { margin-top: 8px; }

.about-portrait {
  border-radius: var(--radius-media);
  overflow: hidden;
  aspect-ratio: 1 / 1;                        /* 548x545 natural (measured) */
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }

.experience { padding-block: clamp(64px, 10vw, 140px); }
.exp-list { margin-top: clamp(32px, 5vw, 56px); }
.exp-row {
  display: grid;
  /* fixed last column so every row shares the same track widths — otherwise
     the auto period column varies per row and shifts the middle column */
  grid-template-columns: 1fr 1.4fr 200px;
  gap: 16px 32px;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.exp-row:last-child { border-bottom: 1px solid var(--border); }
.exp-who { display: flex; flex-direction: column; gap: 4px; }
.exp-company { font-size: 1.1rem; font-weight: 700; color: var(--text-bright); }
.exp-role { font-size: .875rem; font-weight: 400; color: var(--text-muted); text-align: left; }
.exp-description { font-size: .875rem; font-weight: 400; line-height: 1.5; color: var(--text-muted); margin: 0; }
.exp-period { font-size: 1.1rem; font-weight: 700; color: var(--text-bright); white-space: nowrap; text-align: right; }

/* =========================================================
   CASE STUDY PAGE
   ========================================================= */
.case-study { padding-top: clamp(110px, 16vh, 150px); }

.cs-back {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-weight: 500; font-size: .95rem;
  margin-bottom: clamp(24px, 4vw, 40px); min-height: 44px;
  transition: color 200ms var(--ease-out), transform 300ms var(--ease-out);
}
.cs-back:hover { color: var(--text); transform: translateX(-3px); }

.cs-title {
  font-size: clamp(2.2rem, 4.5vw, 3rem);     /* 48px measured */
  letter-spacing: -0.05em;
  color: var(--text-bright);
}

/* large hero image */
.cs-figure {
  border-radius: var(--radius-media);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.cs-figure img { width: 100%; height: 100%; object-fit: cover; }

/* hero breaks out into the same centered 1440px band as the gallery */
.cs-hero-media {
  width: min(1440px, calc(100vw - 2 * var(--gutter)));
  margin-inline: calc((100% - min(1440px, calc(100vw - 2 * var(--gutter)))) / 2);
  margin-top: clamp(24px, 4vw, 40px);
  border: 0;                 /* no border → image edges match the gallery exactly */
  background: none;
}
.cs-hero-media img { width: 100%; height: auto; object-fit: contain; display: block; }

/* project overview: full-width label + big lead paragraph */
.cs-overview { padding-top: clamp(40px, 6vw, 72px); max-width: 1100px; }
.cs-label { font-size: 1.05rem; font-weight: 400; color: var(--text-muted); margin-bottom: 16px; }
.cs-lead {
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  font-weight: 500; line-height: 1.35; letter-spacing: -0.02em;
  color: var(--text-bright);
}

/* project details: 4 items in ONE horizontal row (4 equal columns) */
.cs-meta-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(20px, 3vw, 40px);
  margin: 0;
  padding-block: clamp(32px, 5vw, 64px);
  border-bottom: 1px solid var(--border);
}
.cs-meta-item dt {
  font-size: 1.05rem; font-weight: 400;       /* 20px/400 labels (measured) */
  color: var(--text-muted); margin-bottom: 6px;
}
.cs-meta-item dd { margin: 0; font-size: 1.15rem; font-weight: 500; }  /* value */

.cs-sections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);       /* three columns side-by-side */
  align-items: start;                          /* top-aligned */
  gap: clamp(24px, 3vw, 48px);
  padding-block: clamp(40px, 7vw, 80px);
}
.cs-section { max-width: 42ch; }               /* paragraphs wrap over 2–3 lines */
.cs-section h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  color: var(--text-bright);
}
.cs-text { font-size: 1.05rem; line-height: 1.65; color: var(--text-muted); }

/* gallery: auto-collected 1…9.webp|.gif — stacked vertically, massive,
   NEVER cropped. Same 1440px band as the hero image so every big image
   lines up on the exact same left/right edges. */
.cs-gallery {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: min(1440px, calc(100vw - 2 * var(--gutter)));   /* identical to .cs-hero-media */
  margin: 80px auto;
}

/* every figure fills the gallery width so no image can shrink */
.cs-gallery .cs-figure {
  width: 100%;
  border: 0;
  background: none;
  border-radius: 0;
  overflow: visible;
}
/* strict: EVERY image stretches to 100% of the container — no exceptions */
.cs-gallery img {
  width: 100%;
  max-width: 100%;      /* fills the container; never constrained smaller */
  height: auto;         /* keeps aspect ratio, no cropping */
  display: block;
  border-radius: 16px;
  cursor: zoom-in;
}

/* horizontal group row (2–3 images side by side). Columns/gap/ratio are set
   inline per project. MOBILE: stacked, natural height (default gallery flow).
   DESKTOP (≥768px): a real horizontal row. Two modes:
     • .is-equal  → every block identical (shared aspect-ratio) + object-fit cover
     • default    → widest column (.pair-tall) drives height, others (.pair-fill) match */
.cs-gallery-pair {
  display: flex;                 /* mobile: plain vertical stack */
  flex-direction: column;
  gap: 40px;
  width: 100%;
}
.cs-gallery-pair .cs-figure {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
}
.cs-gallery-pair .cs-figure img { width: 100%; height: auto; object-fit: contain; display: block; }

@media (min-width: 768px) {
  .cs-gallery-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;    /* overridden inline (e.g. "1fr 2fr", "1fr 1fr 1fr") */
    gap: var(--pair-gap, 40px);        /* uniform gap, set inline per project */
    align-items: stretch;              /* all blocks share the same height */
  }
  /* tall/fill mode */
  .cs-gallery-pair .pair-tall img { width: 100%; height: auto; object-fit: contain; }
  .cs-gallery-pair .pair-fill img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  /* equal mode — identical dimensions via a shared aspect-ratio + cover */
  .cs-gallery-pair.is-equal .cs-figure { aspect-ratio: var(--pair-ratio, 4 / 3); }
  .cs-gallery-pair.is-equal .cs-figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  /* contain mode — side by side, whole image shown (no crop) */
  .cs-gallery-pair.is-contain { align-items: start; }   /* size to content, no stretch gaps */
  .cs-gallery-pair.is-contain .cs-figure img { object-fit: contain; width: 100%; height: auto; }
}

/* lives outside <main> (after the full-width gallery), so it carries
   the page column constraint itself */
.cs-other {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: clamp(64px, 10vw, 140px);
}
.cs-other .project-grid { margin-top: clamp(32px, 5vw, 56px); }

.cs-notfound { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 24px; }

/* =========================================================
   FOOTER — 3 tiers: [get in · Let's Go! · touch] / meta+social /
   giant name bleeding to the bottom edge
   ========================================================= */
.site-footer {
  width: 100%;
  max-width: var(--maxw);            /* same 1440px container as <main> */
  margin: 0 auto;                    /* centered */
  /* SAME horizontal gutter as the rest of the site so all edges line up */
  padding: clamp(60px, 9vw, 110px) var(--gutter) clamp(20px, 2.5vw, 40px);
  border-top: 1px solid var(--border);
  overflow: hidden;                  /* safety: no horizontal body scroll */
}
/* tiers inherit the container's width + padding; no extra constraint needed */

/* ---- tier 1: get in — [Let's Go! gif] — touch (strictly horizontal) ---- */
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(16px, 4vw, 56px);
}
.footer-word {
  font-weight: 700;
  font-size: clamp(2.4rem, 10.5vw, 9rem);
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text-bright);
  white-space: nowrap;
}
.footer-go {
  flex: 0 1 auto;
  display: grid; place-items: center;
  border-radius: var(--radius-media);
  overflow: hidden;
  transition: transform 300ms var(--ease-out);
}
.footer-go:hover { transform: scale(1.03); }
.footer-go-gif { height: clamp(110px, 18vw, 260px); width: auto; display: block; }
.footer-go-text { display: none; }
.footer-go.no-gif {
  background: var(--accent); color: var(--accent-ink);
  padding: clamp(36px, 6vw, 88px) clamp(44px, 8vw, 110px);
}
.footer-go.no-gif .footer-go-text {
  display: inline; font-weight: 500;
  font-size: clamp(1.2rem, 2.4vw, 2rem); white-space: nowrap;
}

/* ---- tier 2: meta (left) + social (right) ---- */
.footer-mid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px 32px;
  margin-top: clamp(48px, 8vw, 110px);
  padding-bottom: clamp(24px, 3vw, 40px);
}
.footer-meta { display: grid; gap: 10px; align-content: start; }
.footer-meta p { font-size: .95rem; color: var(--text); margin: 0; }
.footer-meta a { color: inherit; transition: color 200ms var(--ease-out); }
.footer-meta a:hover { color: var(--text-muted); }
.footer-social { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.footer-social a {
  font-weight: 500; font-size: .95rem; color: var(--text);
  transition: color 200ms var(--ease-out);
}
.footer-social a:hover { color: var(--text-muted); }

/* ---- tier 3: massive name, sized to the CONTAINER so it always fills
   the 1440px band and scales down on every screen without clipping ---- */
.footer-bottom {
  container-type: inline-size;   /* cqw = 1% of this box's width (capped at 1440) */
  width: 100%;
  line-height: 1;
}
.footer-name {
  display: block;
  font-weight: 700;
  font-size: clamp(2.6rem, 12vw, 12rem);   /* fallback for no container-query support */
  font-size: 12.6cqw;                       /* fills the full container width, fully adaptive */
  letter-spacing: -0.05em;
  line-height: 0.95;                        /* full glyph height — no bottom clipping */
  color: var(--text-bright);
  white-space: nowrap;                      /* stays on one line */
}

/* floating contact button — always visible bottom-right */
.contact-fab {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 150;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  font-weight: 500; font-size: .95rem;
  box-shadow: var(--shadow);
  transition: transform 300ms var(--ease-out);
}
.contact-fab:hover { transform: translateY(-3px); }

/* =========================================================
   SMOOTH CURSOR FOLLOWER (dot + trailing ring, grows on hover)
   ========================================================= */
.cursor-follower {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;                     /* above lightbox (200) and fab (150) */
}
.cursor-dot, .cursor-ring {
  position: absolute; top: 0; left: 0;
  border-radius: 50%;
  will-change: transform;
}
.cursor-dot {
  width: 8px; height: 8px;
  background: var(--text-bright);    /* cream in dark, black in light */
}
.cursor-ring {
  width: 28px; height: 28px;
  border: 1px solid var(--text-bright);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out);
}
.cursor-ring.is-hover { width: 44px; height: 44px; }   /* grows over interactive elements */

/* hide the native cursor while the follower is active */
body.has-custom-cursor, body.has-custom-cursor * { cursor: none; }

/* =========================================================
   LIGHTBOX
   ========================================================= */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  /* extra horizontal room so the image never slips under the arrows */
  padding: clamp(16px, 4vw, 56px) clamp(64px, 9vw, 110px);
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: zoom-out;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 300ms var(--ease-out), visibility 0s linear 300ms;
}
.lightbox.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity 300ms var(--ease-out);
}
.lightbox-img {
  max-width: 100%; max-height: 88dvh;
  border-radius: var(--radius-media);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.6);
  transform: scale(0.96);
  transition: transform 400ms var(--ease-out);
}
.lightbox.open .lightbox-img { transform: scale(1); }
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(236, 232, 223, 0.1);
  border: 1px solid rgba(236, 232, 223, 0.18);
  border-radius: 999px;
  color: #ECE8DF; cursor: pointer;
  transition: background 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.lightbox-close:hover { background: rgba(236, 232, 223, 0.22); transform: rotate(90deg); }

/* prev / next arrows — vertically centered, large tap target, high contrast */
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: rgba(236, 232, 223, 0.1);
  border: 1px solid rgba(236, 232, 223, 0.18);
  border-radius: 999px;
  color: #ECE8DF; cursor: pointer;
  z-index: 1;                       /* above the image */
  transition: background 200ms var(--ease-out),
              transform 200ms var(--ease-out),
              opacity 200ms var(--ease-out);
}
.lightbox-prev { left: clamp(12px, 3vw, 40px); }
.lightbox-next { right: clamp(12px, 3vw, 40px); }
.lightbox-nav:hover { background: rgba(236, 232, 223, 0.22); }
.lightbox-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(3px); }
.lightbox-nav:disabled { opacity: 0.25; cursor: default; pointer-events: none; }

@media (max-width: 560px) {
  .lightbox { padding-inline: clamp(52px, 15vw, 64px); }
  .lightbox-nav { width: 44px; height: 44px; }
}

/* =========================================================
   SCROLL REVEALS
   ========================================================= */
.reveal, .project-card { opacity: 0; transform: translateY(28px); }
.reveal.in-view, .project-card.in-view {
  opacity: 1; transform: none;
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}

/* word-by-word text reveal on scroll (fade-in-blur), built by app.js */
.reveal-word {
  display: inline-block;
  opacity: 0;
  filter: blur(12px);
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), filter 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  transition-delay: calc(var(--wr-i, 0) * 0.05s);   /* stagger per word */
}
[data-reveal-words].wr-in .reveal-word {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .cs-meta-row { grid-template-columns: repeat(2, 1fr); }   /* 4 → 2 columns */
  /* homepage about block: avatar full-width on top, why/when below */
  .about-cols, .about-cols.no-avatar { grid-template-columns: 1fr 1fr; }
  .about-cols .about-portrait { grid-column: 1 / -1; max-width: 424px; aspect-ratio: 16 / 10; }
  /* dedicated about page */
  .about-grid { grid-template-columns: 1fr; }
  .about-grid .about-portrait { max-width: 424px; order: -1; }
}
@media (max-width: 860px) {
  .main-nav { gap: 18px; }
  .logo { font-size: .92rem; }
}
@media (max-width: 768px) {
  .cs-sections { grid-template-columns: 1fr; }   /* stack into 1 column on mobile */
  .cs-section { max-width: none; }
}
@media (max-width: 720px) {
  .project-grid { grid-template-columns: 1fr; }
  .header-inner { gap: 12px; }
  .theme-toggle { position: static; transform: none; width: 40px; height: 40px; }

  /* nav collapses into a dropdown panel under the header */
  .menu-toggle { display: block; margin-left: auto; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    margin: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    opacity: 0; transform: translateY(-10px);
    visibility: hidden; pointer-events: none;
    transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out),
                visibility 0s linear 300ms;
  }
  .main-nav.open {
    opacity: 1; transform: none;
    visibility: visible; pointer-events: auto;
    transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
  }
  .main-nav a { font-size: 1.15rem; font-weight: 600; color: var(--text); padding: 14px 0; width: 100%; }
  .main-nav a::after { display: none; }

  .exp-row { grid-template-columns: 1fr auto; row-gap: 4px; align-items: start; }
  .exp-who { display: contents; }
  .exp-company { grid-column: 1; grid-row: 1; }
  .exp-role { grid-column: 1; grid-row: 2; }
  .exp-period { grid-column: 2; grid-row: 1; }
  .exp-description { grid-column: 1 / -1; grid-row: 3; margin-top: 12px; }
  .about-cols, .about-cols.no-avatar { grid-template-columns: 1fr; }
  .about-cols .about-portrait { aspect-ratio: 4 / 5; }
  /* footer CTA stacks: get in / button / touch */
  .footer-top { flex-direction: column; align-items: center; text-align: center; }
  .footer-mid { grid-template-columns: 1fr; }
  .footer-social { align-items: flex-start; }
  .contact-fab { right: 16px; bottom: 16px; }
  /* the follower is desktop/pointer-only (JS guard) — nothing to hide here */
}
@media (max-width: 560px) {
  .logo { font-size: .85rem; }
  .lang-btn { font-size: .78rem; }
  .header-inner { padding-inline: 18px; gap: 10px; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal, .project-card { opacity: 1 !important; transform: none !important; transition: none !important; }
  .reveal-word { opacity: 1 !important; filter: none !important; transform: none !important; transition: none !important; }
  .marquee-track { animation: none !important; }
  .project-card:hover .project-media img { transform: none; }
  .btn-pill:hover, .footer-cta:hover, .cs-back:hover { transform: none; }
  .theme-toggle .icon { transition: opacity 120ms linear; }
  body { animation: none; }
  .lightbox { transition: opacity 120ms linear; backdrop-filter: none; }
  .lightbox-img { transform: none; transition: none; }
  .lightbox-close:hover { transform: none; }
  .lightbox-nav { transition: background 120ms linear; }
  .lightbox-prev:hover, .lightbox-next:hover { transform: translateY(-50%); }
}
