/* Site layout. Colors and type come from ui-kit/ — no raw values here. */

/* Page-to-page transitions without a white flash (Chrome/Safari; others just swap) */
@view-transition {
  navigation: auto;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: clip; /* sections replace each other; no native page scroll */
  background: var(--color-white);
  color: var(--color-black);
}

/* The dot (.cursor) replaces the system cursor on mouse/trackpad devices */
@media (pointer: fine) {
  html,
  html * {
    cursor: none !important;
  }
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

/* Header ----------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 8px 8px auto;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.site-header__logo {
  transition: color 0.3s ease;
  position: absolute;
  left: 50%;
  top: 4px; /* 12px from viewport top */
  transform: translateX(-50%);
  color: var(--color-black);
  text-decoration: none;
}

/* Deck: full-viewport sections stacked on top of each other -------- */
.deck {
  position: relative;
  height: 100vh;
  height: 100dvh; /* the visible height: on iPhone Safari 100vh runs under the toolbar */
}
.section {
  position: absolute;
  inset: 0;
  /* clip, not hidden: a hidden box can still be scrolled (by focus, text
     selection…), which shifted the 1440px stage off-center on narrow windows */
  overflow: clip;
  visibility: hidden; /* only the current section shows (scripts/hero.js) */
}
.section.is-current,
html:not(.js) .section:first-child {
  visibility: visible;
}
/* Section accents: tags and wires take the section's color */
.section--skills {
  --tag-accent: var(--color-magenta);
}

/* Hero ------------------------------------------------------------- */
/* The stage is the whole screen. Figma's 1440×900 artboard is mapped onto it:
   the headline sits at its Figma offset from the middle (× --sy, the height
   ratio), and scripts/hero.js places the tags around the middle (x squeezed to
   fit narrow screens, y × --sy). Tags and the name keep their full size. */
.hero__stage {
  position: absolute;
  inset: 0;
  --sy: 1;
}
.hero__stage > *,
.hero__tags > * {
  position: absolute;
}

.hero__name {
  left: 0;
  right: 0;
  top: calc(50% - 170px * var(--sy)); /* Figma: 280 of 900 */
  text-align: center;
}
.hero__title {
  left: 16px;
  right: 16px;
  top: calc(50% - 114px * var(--sy)); /* Figma: 336 of 900 */
  text-align: center;
  /* 96px on desktop; shrinks with the width so the widest line ("same passion
     for design" = 13.2 × the font size) fits; never below 44px — under ~600px
     wide the lines wrap by word instead */
  font-size: clamp(44px, (100vw - 32px) / 13.2, 96px);
}
/* Phones (Figma 89:267338, 430 wide): 64px, wrapping by word into
   PRODUCT / DESIGNER & / DESIGN / ENGINEER; the name + headline group (24px
   apart) is centered on the screen, lifted 16px.
   Narrower phones step the size down just enough for "DESIGNER &" (5.74 × the
   font size, kept together by a no-break space; 5.9 leaves a little room) to
   fit.
   The footer's longer headline is sized so "TURBULENT TIMES," (9.17 × the
   font size) fits on a line, instead of one word per line. */
@media (max-width: 599px) {
  /* scripts/hero.js centers the name + headline as one group (--name-top /
     --title-top); the fallbacks are Figma's offsets */
  .hero__title {
    top: var(--title-top, calc(50% - 175px));
    font-size: min(64px, (100vw - 32px) / 5.9);
  }
  .hero__name {
    top: var(--name-top, calc(50% - 175px - 56px));
  }
  /* Footer: just the headline, centered */
  .footer .hero__title {
    top: 50%;
    transform: translateY(-50%);
    font-size: min(64px, (100vw - 32px) / 9.4);
  }
}

/* Each headline line is its own mask for the rise-in */
.hero__title .line {
  display: block;
  overflow: clip;
}
.hero__title .line > span {
  display: block;
}

.hero__tags {
  inset: 0;
  list-style: none;
}
.hero__tags .tag {
  will-change: transform;
}
.hero__tags .tag.is-active {
  z-index: 2;
}

.hero__wires {
  inset: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3; /* over the tags and headline, as in Figma */
}
.hero__wires line {
  stroke: var(--tag-accent, var(--color-lime));
  stroke-width: 2;
  stroke-dasharray: 1; /* with pathLength=1, lets the intro draw them in */
}

/* Hidden until fonts load and tags are measured; then the intro reveals it */
.js body:not(.is-ready)
  :is(.site-header, .hero__name, .hero__title, .hero__tags, .hero__wires, .cv, .cursor) {
  visibility: hidden;
}

/* CV section (Figma frame 80:225799) -------------------------------- */
/* Centered on the viewport's middle (in the 900px Figma frame that is exactly
   top: 106px). On windows too short for it, --cv-scale (set by script) shrinks
   the job list — never the name — so the whole CV stays visible. */
.cv {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(458px, 100vw - 32px); /* 16px sides on phones */
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 32px;
  text-align: center;
}
.cv__jobs {
  zoom: var(--cv-scale, 1); /* zoom (unlike scale) shrinks its layout box too, so centering stays true */
  display: flex;
  flex-direction: column;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.job {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.job__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.job__title {
  margin: 0;
}
/* Phones: the narrow column wraps into more lines, so tighten the gaps a
   little before the fit has to shrink the text */
@media (max-width: 599px) {
  .cv,
  .cv__jobs {
    gap: 24px;
  }
  .job {
    gap: 12px;
  }
}

/* Header over a photo: set by scripts/hero.js while a case study shows */
body[data-header="image"] .site-header .btn {
  background: var(--color-black-10);
}
body[data-header="image"] .site-header .btn:hover,
body[data-header="image"] .site-header .btn:focus-visible {
  background: var(--color-black);
}
/* The CV button leaving the CV for a photo section takes the photo style at
   once (scripts/hero.js), before the header's style catches up */
.site-header .btn.is-to-photo {
  background: var(--color-black-10);
  color: var(--color-white);
  transition: none;
}
.site-header .btn.is-to-photo:hover,
.site-header .btn.is-to-photo:focus-visible {
  background: var(--color-black);
}
body[data-header="image"] .site-header__logo {
  color: var(--color-white);
}

/* Case study (Figma frame 80:225862) ----------------------------------- */
.case__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 696px square card, centered; --card-scale (script) shrinks it on small windows */
.case__card {
  display: block; /* also used as a link (<a>) when the case has a page */
  text-decoration: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 696px;
  height: 696px;
  transform: translate(-50%, -50%) scale(var(--card-scale, 1));
  background: var(--color-white);
  color: var(--color-black);
  overflow: clip;
}
.case__media {
  position: absolute;
  left: 356px; /* 50% + 8px */
  top: 16px;
  width: 324px;
  height: 324px;
  margin: 0;
}
.case__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.case__logo {
  filter: var(--shadow-logo);
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
}
/* A logo whose SVG carries a glow beyond its 120px mark (Studysphere): shown
   at its own size so the mark matches the Living logo; the mark sits 1.25px
   above the SVG's middle, so nudge it down to center the mark itself */
.case__logo--glow {
  width: 156.338px;
  height: 156.337px;
  margin-top: 1.25px;
}
.case__count {
  position: absolute;
  left: 32px;
  top: 32px;
  white-space: pre; /* keep the spaces in "[ 1 / 3 ]" */
}
.case__text {
  position: absolute;
  left: 32px;
  bottom: 32px;
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.case__title,
.case__desc {
  margin: 0;
}
/* "NDA" chip pinned to the image's top-right (Figma: 16px from top, 267px from left) */
.case__chip {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--color-magenta); /* the Skills section's accent */
}
/* Phones: the square composition would scale down to unreadable text, so the
   card restacks into a column at full text size — count, a full-width square
   image (logo and chip stay on it), then title and description. */
@media (max-width: 599px) {
  .case__card {
    width: calc(100vw - 16px); /* 8px from the screen edges */
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .case__count,
  .case__media,
  .case__text {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
  }
  .case__media {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  .case__text {
    width: auto;
    gap: 16px;
    margin-top: 8px; /* 24px between the image and the title (8 + the card's 16 gap) */
  }
}

/* Footer / contact (Figma frame 80:225819) -------------------------------- */
.footer__bg {
  position: absolute;
  inset: 0;
  background: var(--color-white);
}
.footer__link {
  position: absolute;
  bottom: 24px;
  margin: 0;
  color: var(--color-black);
  text-decoration: none;
}
.footer__link--start {
  left: 24px;
}
.footer__link--end {
  right: 24px;
}
a.footer__link:hover,
a.footer__link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}
