/* ============================================================
   Nicho Portfolio — prototype
   Figma "Porto Nicho":
     4:149   Landing Page V2 - Split Sticky Layout
     22:2    Section 2 - About  (+ decorative vectors 34:219 / 34:225)
     34:7    Project cards (5)
     34:204  Project Highlight (detail modal)
   Desktop-first, 1440px reference width.
   ============================================================ */

:root {
  --bg:            #FBF7F2;
  --text-primary:  #2A2019;
  --text-secondary:#6B5D4F;
  --brand:         #D4551A;
  --brand-hover:   #A34F22;
  --accent-soft:   #F0D9C4;
  --border:        #E5D8C8;

  --font-heading: "Fraunces", Georgia, serif;
  --font-body:    "Karla", system-ui, -apple-system, sans-serif;

  --col-left:  627px;
  --left-pad:  154px;
  --about-pad: 104px;   /* nudged in from Figma's 64px to sit closer to the hero's 154px */
  --hero-shift: 30px;

  --card-w: 491px;
  --card-h: 435px;
  --card-radius: 28px;
  --dot-gap: 36px;

  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Line reveal: opaque down to --mask-a, feathered out by --mask-b.
     Both climb from 0% to 100% so the art draws in from top to bottom. */
  --mask-a: 0%;
  --mask-b: 12%;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.h1, .h2, .h3 { font-variation-settings: "SOFT" 0, "WONK" 1; }

.h1 { font-family: var(--font-heading); font-weight: 600; font-size: 60px; line-height: 1.1;  margin: 0; }
.h2 { font-family: var(--font-heading); font-weight: 600; font-size: 36px; line-height: 1.15; margin: 0; }
.h3 { font-family: var(--font-heading); font-weight: 400; font-size: 24px; line-height: 1.2;  margin: 0; }
.body    { font-size: 16px; line-height: 1.5;  margin: 0; font-weight: 400; }
.body-sm { font-size: 14px; line-height: 1.45; margin: 0; font-weight: 400; }
.caption {
  font-size: 13px; line-height: 1.3; font-weight: 500;
  letter-spacing: 0.52px; text-transform: uppercase;
  color: var(--text-secondary); margin: 0;
}

/* ---------- Scroll container ----------
   No scroll-snap. The About section is taller than the viewport (it ends on
   the CTA), so snapping either traps the scroll or yanks it back to a snap
   point mid-gesture. Section changes are a JS tween instead, which also lets
   them run slower and eased. scroll-behavior stays `auto` for the same reason. */
.scroller {
  position: relative;          /* positioning context for .pagelines */
  height: 100vh; height: 100dvh;
  overflow-y: scroll; overflow-x: hidden;
  scroll-snap-type: none;
  scroll-behavior: auto;
  scrollbar-width: none;
}
.scroller::-webkit-scrollbar { display: none; }

.section {
  position: relative;
  overflow: hidden;
}
.section--hero  { height: 100vh; height: 100dvh; }
/* About and the CTA grow with their content rather than locking to 100vh. */
.section--about,
.section--cta { min-height: 0; height: auto; }
.section--about .section__inner,
.section--cta .section__inner {
  height: auto;
  align-items: stretch;
}

.section__inner {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--col-left) 1fr;
  align-items: center;
}
.col--right { height: 100%; }

/* ---------- Page line-art (Figma "Frame 7" bg, 34:278) ----------
   One continuous drawing spanning hero + about, so the strokes carry across
   the section boundary instead of stopping at it. Figma's frame is 1440x900
   with the art bleeding out to 1595.34 x 3995.73 — i.e. 110.79% of the page
   width and 443.97% of one viewport tall, offset up and left by the bleed. */
.page {
  position: relative;
  overflow: hidden;   /* keeps the artwork's overhang out of the scroll height */
  /* Figma "new gradient" (42:173) does this with two huge #B8420F ellipses at
     20%/15% opacity under a 300px/150px blur, parked off the top and bottom
     edges — not a linear ramp. Rebuilt as radial gradients so it stays sharp
     at any size: a warm haze bleeding in from above the fold and rising again
     from the foot of the page, with clean background between. Each gradient's
     extent is the ellipse radius + 2σ of its blur, which is exactly the box
     Figma exports the blurred shape into. */
  background:
    radial-gradient(ellipse 148% 140vh at 49% -31vh,
      rgba(184, 66, 15, 0.20) 0%,
      rgba(184, 66, 15, 0.20) 8%,
      rgba(184, 66, 15, 0.13) 35%,
      rgba(184, 66, 15, 0.05) 65%,
      rgba(184, 66, 15, 0)    100%),
    radial-gradient(ellipse 87% 98vh at 49% calc(100% + 18vh),
      rgba(184, 66, 15, 0.15) 0%,
      rgba(184, 66, 15, 0.15) 30%,
      rgba(184, 66, 15, 0.08) 62%,
      rgba(184, 66, 15, 0)    100%),
    var(--bg);
}

.pagelines {
  position: absolute;
  left: -8.56%;
  top: -7.42vh;
  width: 110.79%;
  height: 443.97vh;
  z-index: 0;
  pointer-events: none;
  will-change: opacity;
  -webkit-mask-image: linear-gradient(to bottom, #000 var(--mask-a), transparent var(--mask-b));
          mask-image: linear-gradient(to bottom, #000 var(--mask-a), transparent var(--mask-b));
}

/* ---------- Section 1 left column ---------- */
.hero__left {
  display: flex; flex-direction: column; align-items: flex-start;
  padding-left: var(--left-pad);
  margin-top: var(--hero-shift);
  will-change: transform, opacity;
}
.hero__role { color: var(--text-secondary); margin-top: 6px; }
.hero__bio  { width: 360px; color: var(--text-secondary); margin-top: 22px; }
.hero__bio strong { font-weight: 700; }
.hero__left .circle-btn { margin-top: 34px; }

@keyframes heroIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
.hero__left > * { animation: heroIn 900ms var(--ease-out) both; }
.hero__left > *:nth-child(1) { animation-delay: 120ms; }
.hero__left > *:nth-child(2) { animation-delay: 220ms; }
.hero__left > *:nth-child(3) { animation-delay: 320ms; }
.hero__left > *:nth-child(4) { animation-delay: 440ms; }

/* ---------- Circle buttons ---------- */
.circle-btn {
  position: relative;
  width: 48px; height: 48px; flex: 0 0 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #FFFFFF;
  border: none;
  box-shadow: 0 8px 20px rgba(41, 26, 15, 0.12);
  color: var(--text-primary);
  cursor: pointer;
  transition: box-shadow 300ms ease, transform 420ms var(--ease-out);
}
.circle-btn svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  will-change: transform;
}
.circle-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(41, 26, 15, 0.18); }
.circle-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.circle-btn.is-pressed { transform: scale(0.9); }
.circle-btn::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%; border: 2px solid var(--brand);
  opacity: 0; pointer-events: none;
}
.circle-btn.is-pressed::after { animation: ringPulse 620ms var(--ease-out); }
@keyframes ringPulse {
  0%   { opacity: .9; transform: scale(1); }
  100% { opacity: 0;  transform: scale(1.75); }
}

/* ---------- Sticky project rail ---------- */
.rail {
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: min(1440px, 100%);
  height: 100vh; height: 100dvh;
  pointer-events: none;
  z-index: 2;
}
.rail__inner {
  position: absolute;
  left: var(--col-left); right: 0; top: 0; bottom: 0;
  pointer-events: auto;
  will-change: transform;
}
.rail__label { display: none; }   /* only needed once the rail joins the flow */

.stack {
  position: absolute;
  top: 50%; left: 50%;
  width: var(--card-w); height: var(--card-h);
  margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
  /* Solved against the Figma peek's taper at the 435px reference card (see GEO
     in script.js). Scaled with the card so the trapezoid keeps the same shape
     at smaller sizes — a fixed perspective would flatten it out on mobile. */
  perspective: calc(2518 * var(--card-h) / 435);
  outline: none;
}
.stack:focus-visible { outline: 2px solid var(--brand); outline-offset: 16px; border-radius: 32px; }
.stack__viewport { position: absolute; inset: 0; transform-style: preserve-3d; }

.card {
  position: absolute;
  inset: 0;
  /* Peek state. The tilt squashes the card to ~14% of its height, which would
     also squash a plain 28px radius down to ~4px and read as a sharp corner.
     Inflating the vertical radius by that same factor makes the rendered
     corner come out round, matching the ~12px radius on Figma's 19:4. */
  border-radius: 12px / 87px;
  background: var(--border);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 620ms cubic-bezier(.22,.75,.24,1),
    opacity   620ms cubic-bezier(.22,.75,.24,1),
    border-radius 620ms cubic-bezier(.22,.75,.24,1),
    background 620ms ease;
}
.card.is-active {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
}
.card.is-hidden { pointer-events: none; }

.card__body {
  height: 100%;
  display: flex; flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 30px 43px;
  opacity: 0;
  transition: opacity 420ms ease;
}
.card.is-active .card__body { opacity: 1; }

.card__thumb {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
}
.card__panel { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.4); }
.card__shot  { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.card__shot--tilt {
  inset: auto;
  left: 59%; top: 50%;
  width: auto; height: 163%;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(-19.37deg);
}
.card__shot--icon {
  inset: auto;
  left: 50%; top: 50%;
  width: 70%; height: auto;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.card__foot {
  flex: 0 0 44px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}

.pill-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; min-width: 109px;
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--accent-soft);
  border: 1px solid var(--text-secondary);
  box-shadow: 0 8px 20px rgba(41, 26, 15, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 14px; line-height: 1.45;
  text-decoration: none; cursor: pointer;
  transition: background 240ms ease, color 240ms ease, transform 240ms var(--ease-out);
}
.pill-btn:hover { background: var(--brand); border-color: var(--brand); color: #fff; transform: translateY(-2px); }
.pill-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.dots {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--card-w) / 2 + var(--dot-gap));
  transform: translateY(-50%);
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.dot {
  display: block;
  width: 6px; height: 6px;
  padding: 0; border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 300ms ease, transform 300ms var(--ease-out);
}
.dot:hover { transform: scale(1.3); }
.dot.is-active { background: var(--brand); transform: scale(1.15); }
.dot:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- Section 2 left column ----------
   Taller than the viewport on purpose: the column ends on the CTA, so the
   generous top/bottom padding keeps the back button off the screen edge. */
.about__left {
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start;
  gap: 28px;
  padding: clamp(88px, 13vh, 150px) 48px 0 var(--about-pad);
}

/* The CTA is its own section now, so the rail can sit between it and the
   experience list when the layout goes single-column on mobile. */
.cta__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* Figma 42:59 pulls the CTA up: its title sits 40px into the block instead
     of 120px, landing ~68px below the experience list. */
  padding: clamp(44px, 7.2vh, 78px) 48px clamp(96px, 14vh, 160px) var(--about-pad);
}
.about__left > * { will-change: transform, opacity; }
.about__bio { width: 500px; color: var(--text-secondary); }

.block { display: flex; flex-direction: column; gap: 12px; }

.pills {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
  width: 500px;
}
.pill {
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 14px; line-height: 1.45;
  padding: 8px 14px;
  border-radius: 100px;
  transition: transform 260ms var(--ease-out), background 260ms ease;
}
.pill:hover { transform: translateY(-2px); background: #E9CDB2; }

/* Experience cards — Figma 37:52 */
.exp {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  width: 500px; max-width: 100%;
}
.exp__card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.exp__head { display: flex; flex-direction: column; gap: 2px; }
.exp__meta { color: var(--text-secondary); }
.exp__desc { color: var(--text-secondary); }

.exp__tags {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag {
  background: var(--accent-soft);
  color: var(--text-primary);
  font-size: 13px; font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.52px;
  padding: 6px 12px;
  border-radius: 100px;
}

/* ---------- Closing CTA ---------- */
.cta {
  width: 500px;
  display: flex; flex-direction: column;
  align-items: center; gap: 24px;
  text-align: center;
}
.cta__title { text-align: center; }
.cta__btn {
  background: var(--brand);
  color: #fff;
  font-size: 16px; line-height: 1.5;
  text-decoration: none;
  padding: 16px 32px;
  border-radius: 100px;
  transition: background 220ms ease, transform 260ms var(--ease-out);
}
.cta__btn:hover { background: var(--brand-hover); transform: translateY(-2px); }

.socials {
  list-style: none; margin: 4px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px; line-height: 1.45;
  text-decoration: none;
  transition: background 220ms ease, color 220ms ease, border-color 220ms ease, transform 220ms var(--ease-out);
}
.social__icon { width: 16px; height: 16px; flex: 0 0 16px; }
.socials a:hover { background: var(--accent-soft); color: var(--text-primary); border-color: var(--accent-soft); transform: translateY(-2px); }
.socials a:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- Project detail modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 50;
  display: grid; place-items: center;
  padding: 32px;
}
.modal[hidden] { display: none; }

.modal__scrim {
  position: absolute; inset: 0;
  background: rgba(251, 247, 242, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  transition: opacity 420ms ease;
}
.modal__card {
  position: relative;
  width: min(779px, 100%);
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: 0 24px 60px rgba(41, 26, 15, 0.18);
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition: opacity 460ms var(--ease-out), transform 460ms var(--ease-out);
}
.modal.is-open .modal__scrim { opacity: 1; }
.modal.is-open .modal__card { opacity: 1; transform: none; }

.modal__body { display: flex; flex-direction: column; gap: 20px; padding: 30px 43px; }
.modal__body .card__thumb { flex: none; height: 299px; }
.modal__body .card__shot--tilt { left: 50%; }
.modal__meta p { margin: 0; }
.modal__meta strong { font-weight: 700; }

.modal__close {
  position: absolute; top: 18px; right: 18px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  cursor: pointer; z-index: 1;
  transition: background 220ms ease, color 220ms ease;
}
.modal__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.modal__close:hover { background: var(--brand); color: #fff; }
.modal__close:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

body.modal-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1439px) {
  :root { --left-pad: clamp(40px, 10vw, 154px); }
}

@media (max-width: 1200px) {
  :root { --col-left: 52%; --card-w: 400px; --card-h: 354px; --dot-gap: 24px; }
  .h1 { font-size: 48px; }
  .h2 { font-size: 30px; }
  .about__bio, .pills, .cta { width: 100%; max-width: 500px; }
  .card__body { padding: 24px 32px; gap: 20px; }
}

/* ---------- Mobile: one column, everything in flow ----------
   The rail stops being a fixed overlay and becomes a normal section sitting
   between Experience and the CTA, so the page is just a straight scroll:
   Hero -> About -> Experience -> Projects -> CTA. */
@media (max-width: 900px) {
  :root {
    --card-w: min(340px, 86vw);
    --card-h: 300px;
    --dot-gap: 0px;
    --side-pad: 24px;
  }

  /* The artwork is 1595 x 3996. Forcing that width into a phone squeezes the
     curves flat — they looked wrung out. Sizing the width off the height
     instead keeps the drawing's own proportions; only a slice of it shows,
     which is fine for a background. */
  .pagelines {
    width: 177.3vh;                  /* 1595.34 / 3134.11 x 348.23vh */
    left: calc(50% - 88.65vh);
  }

  .section--hero { height: auto; min-height: 100dvh; }
  .section__inner {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 0;
  }
  .col--right { display: none; }

  .hero__left {
    padding: 96px var(--side-pad) 72px;
    margin-top: 0;
    min-height: 100dvh;
    justify-content: center;
  }
  .hero__bio { width: 100%; max-width: 380px; }

  .about__left { padding: 8px var(--side-pad) 0; gap: 22px; }
  .about__bio, .pills, .exp { width: 100%; }

  .cta__col { padding: 40px var(--side-pad) 88px; align-items: center; }
  .cta { width: 100%; }

  /* rail joins the document flow */
  .rail {
    position: static;
    width: auto; height: auto;
    transform: none;
    opacity: 1 !important;          /* the desktop scroll-fade must not apply */
    pointer-events: auto;
    padding: 56px var(--side-pad) 0;
  }
  .rail__inner {
    position: relative;
    left: auto; right: auto; top: auto; bottom: auto;
    height: auto;
    transform: none !important;     /* desktop parallax off */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  .rail__label { display: block; align-self: flex-start; }

  /* In flow the stack needs an explicit box. The card sits flush at the top
     and the box is only tall enough for the peek hanging below it — centring
     it like the desktop rail would leave ~90px of dead space above. */
  .stack {
    position: relative;
    top: auto; left: auto;
    margin: 0;
    width: var(--card-w);
    height: calc(var(--card-h) * 1.31);
    /* The card no longer sits in the middle of this box, so the vanishing
       point has to be moved back onto the card's centre — otherwise the peek
       projects lower than it should and collides with the dots. */
    perspective-origin: 50% calc(var(--card-h) / 2);
  }
  .stack__viewport { inset: 0; }
  .card {
    top: 0; left: 50%; right: auto; bottom: auto;
    width: var(--card-w); height: var(--card-h);
    margin: 0 0 0 calc(var(--card-w) / -2);
  }

  .dots {
    position: relative;
    top: auto; left: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }
  .dot { width: 7px; height: 7px; }

  .card__body { padding: 20px 22px; gap: 18px; }
  .card__foot { flex: 0 0 40px; }
  .pill-btn { height: 40px; min-width: 96px; }

  .modal { padding: 16px; }
  .modal__body { padding: 22px 20px; gap: 16px; }
  .modal__body .card__thumb { height: 200px; }
}

@media (max-width: 560px) {
  .h1 { font-size: 40px; }
  .h2 { font-size: 26px; }
  .h3 { font-size: 21px; }
  .cta__title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card__body, .circle-btn, .dot, .pill, .cta__btn,
  .pill-btn, .modal__card, .modal__scrim, .socials a { transition-duration: 1ms; }
  .hero__left > * { animation: none; }
  .circle-btn.is-pressed::after { animation: none; }
}
