/* ==========================================================================
   HOMEPAGE · layout from Diana's Figma sketch (frame "Home", 1440 wide)

   On wide screens (1100px and up) the work, intro, lab and contact are placed
   like in Figma. Positions are written in Figma pixels and scaled by --u
   (1 unit = 1px on a 1440px window), so the composition and the blue line
   keep their shape at any width. Narrower screens get a simple column.
   ========================================================================== */

/* ---------- the work items: simple column (phones, tablets) ---------- */
.works {
  display: grid;
  gap: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  margin: clamp(2.5rem, 2rem + 3vw, 4rem) 0 0;
  padding: 0;
  list-style: none;
}
.wi { position: relative; display: flex; flex-direction: column; }
.wi__glass { display: none; }
/* phones and tablets: the video takes the place of the photo (the wide screen layout below uses both) */
.wi__media--video { order: 1; display: block; position: relative; overflow: hidden; background: var(--night-2); }
.wi--has-video .wi__media--main { display: none; }
.wi__media--video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.wi__media--video:not(.is-wide) { background: var(--poster, var(--night-2)); padding: 1.5rem 0; }
.wi__media--video:not(.is-wide) video {
  width: min(62%, 260px);
  margin: 0 auto;
  aspect-ratio: 540 / 1094;
  clip-path: inset(1% 3.3% 1.9% 4.1% round 12.6% / 6.2%);   /* clip to the phone's own edge */
}
.wi__media--main { order: 1; display: block; position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--night-2); }
.wi__media--main img { width: 100%; height: 100%; object-fit: cover; }
.wi__title { order: 2; margin-top: 1.25rem; }
.wi__text { order: 3; }
.wi__meta { order: 4; }

.wi__link {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-index);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: color var(--dur-card) var(--ease-out), text-shadow var(--dur-card) var(--ease-out), transform var(--dur-card) var(--ease-out);
}
.wi__desc { max-width: 56ch; margin-top: 1.1rem; color: var(--text-muted); }
.wi__role { margin-top: 0.5rem; color: var(--text-muted); }
.wi__meta {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-top: 1rem;
  color: var(--text-muted);
  text-decoration: none;
}
.wi__arrow {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--paper);
  transition: transform var(--dur-card) var(--ease-out);
}

/* hover / keyboard focus on any link of a project */
.wi:has(a:hover) .wi__link,
.wi:has(a:focus-visible) .wi__link { color: var(--accent); text-shadow: var(--glow); }
.wi:has(a:hover) .wi__arrow,
.wi:has(a:focus-visible) .wi__arrow { transform: translateX(6px); }
.wi__media { transition: box-shadow var(--dur-card) var(--ease-out); }
.wi:has(a:hover) .wi__media--main,
.wi:has(a:hover) .wi__media--video video { box-shadow: 0 0 0 1px var(--accent), 0 0 28px color-mix(in srgb, var(--accent) 30%, transparent); }

/* intro: text and button; photo frames only show when there are photos */
.intro { padding-block: var(--section-y); }
.intro__lead {
  max-width: 30ch;
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: 300;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.intro__lead em { font-style: normal; color: var(--ice); }
.intro__more { margin-top: 2rem; }
/* the button text and its arrow are the same colour as the highlighted words in the sentence above */
.intro__more, .intro__more span { color: var(--ice); text-shadow: none; }
.intro__more:hover, .intro__more:focus-visible { color: #dbe5ff; }
.intro__more:hover span, .intro__more:focus-visible span { color: #dbe5ff; }
.intro__photos { display: none; }
.intro__photos.has-photos { display: flex; gap: 1rem; margin-bottom: 2.5rem; }
.intro__photo { flex: 1; max-width: 240px; aspect-ratio: 3 / 4; overflow: hidden; background: rgba(217, 217, 217, 0.9); }
.intro__photo:not(.has-photo) { display: none; }
.intro__photo img { width: 100%; height: 100%; object-fit: cover; }

.home-line { display: none; }

/* hero links and sound switch: only on wide screens (smaller screens use the Menu) */
.hero__nav, .hero__sound { display: none; }
.hero__nav ul { margin: 0; }
.hero__link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--paper);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-shadow: var(--glow);
  transition: color var(--dur-button) var(--ease-out);
}
.hero__link:hover { color: var(--accent); }
.hero__link[aria-current] { text-decoration: none; }
.hero__link[aria-current]::before { content: ""; width: 6px; height: 1px; margin-right: 8px; background: currentColor; }

/* ==========================================================================
   WIDE SCREENS: the Figma composition
   ========================================================================== */
@media (min-width: 1100px) {
  .is-home {
    --u: calc(min(100vw, 1680px) / 1440);
    --line-blue: #7aa2ff;   /* the same blue as the line in the case studies */
  }

  /* ---- hero: links scattered around the name, sound switch top right (as in Figma).
          The logo stays top left; "Menu" comes in once the first screen is scrolled away. ---- */
  /* Each link is placed from the centre of the name, in Figma pixels (dx, dy) scaled with the name's size,
     so they stay around "DIANA" whatever the window's width and height. 102.4px = the name's size in Figma. */
  .hero__nav {
    display: block;
    position: absolute;                                   /* out of the hero's grid, so the name stays centred */
    inset: 0;
    pointer-events: none;
    --k: calc(var(--fs-hi) / 102.4);
  }
  .hero__nav a { pointer-events: auto; }
  .hero__nav li {
    position: absolute;
    left: calc(50% + var(--dx) * var(--k));
    top: calc(50% + var(--dy) * var(--k));
    margin-top: -8px;                                     /* the link box is taller than its text */
  }
  .hero__nav li:nth-child(1) { --dx: -295; --dy: 141; }   /* Index   */
  .hero__nav li:nth-child(2) { --dx: 154;  --dy: -177; }  /* About   */
  .hero__nav li:nth-child(3) { --dx: -235; --dy: -202; }  /* Work    */
  .hero__nav li:nth-child(4) { --dx: 22;   --dy: -320; }  /* Lab     */
  .hero__nav li:nth-child(5) { --dx: 161;  --dy: 215; }   /* Contact */
  .hero__sound { display: block; position: absolute; top: 26px; right: 32px; }

  .is-home.hero-in .side:not(.is-open) > :not(.side__brand),
  .is-home.hero-in .barcode {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease-out), visibility 0s linear 0.35s;
  }
  .is-home .barcode { transition: opacity 0.35s var(--ease-out); }

  /* ---- shared frame: every section is 1440 units wide, centred ---- */
  .is-home .work,
  .is-home .intro,
  .is-home .lab,
  .is-home .contact {
    width: 100%;
    max-width: 1680px;
    margin-inline: auto;
    padding: 0;
  }
  .is-home .lab__inner { position: relative; height: 100%; padding: 0; }

  /* ---- the blue line (Figma y 880–7704, starts just above the work) ---- */
  .home-line {
    display: block;
    position: absolute;
    z-index: -1;
    top: calc(-20 * var(--u));
    left: 0;
    width: calc(1440 * var(--u));
    height: calc(6824 * var(--u));
    max-width: none;
    overflow: visible;
    pointer-events: none;
  }
  .home-line path {
    fill: none;
    stroke: var(--line-blue);
    stroke-width: 1.6;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px var(--line-blue));   /* soft glow, as in the cases */
  }
  .home-line circle { fill: #dbe5ff; filter: drop-shadow(0 0 5px var(--line-blue)) drop-shadow(0 0 14px var(--line-blue)); }
  .home-line.is-live path { stroke-dasharray: 1; }
  .home-line.is-live circle { opacity: 0; transition: opacity 0.4s var(--ease-out); }
  .home-line.is-live circle.is-on { opacity: 1; }

  /* ---- B · work (Figma y 900–4000) ---- */
  .is-home .work { position: relative; }
  .is-home .work__head { position: relative; height: calc(353 * var(--u)); }
  .is-home .work__head .section-title {
    position: absolute;
    left: calc(243 * var(--u));
    top: calc(243 * var(--u));
    margin: 0;
    font-size: calc(53.44 * var(--u));
    white-space: nowrap;
  }
  .is-home .work__head .label { position: absolute; left: calc(803 * var(--u)); top: calc(264 * var(--u)); }

  .is-home .works { display: block; margin: 0; }
  .is-home .wi { display: block; }
  .is-home .wi--a { height: calc(964 * var(--u)); }
  .is-home .wi--b { height: calc(1063 * var(--u)); }
  .is-home .wi--c { height: calc(720 * var(--u)); }

  .is-home .wi > *,
  .is-home .wi--b .wi__text > * {
    position: absolute;
    left: calc(var(--x) * var(--u));
    top: calc(var(--y) * var(--u));
    width: calc(var(--w) * var(--u));
    margin: 0;
  }
  .is-home .wi--b .wi__text { display: contents; }
  .is-home .wi__desc { margin-top: 0; }
  .is-home .wi__media--video { display: block; padding: 0; background: transparent; overflow: visible; }
  .is-home .wi--has-video .wi__media--main { display: block; }
  .is-home .wi__glass {   /* the pane behind the picture: faint blue glass with a softly lit edge, like the blue line */
    display: block;
    z-index: 0;
    height: calc(var(--h) * var(--u));
    background: linear-gradient(135deg, rgba(122, 162, 255, 0.13), rgba(122, 162, 255, 0.04)), #090c14;   /* solid underneath, so the blue line goes behind the pane instead of showing through */
    border: 1px solid rgba(122, 162, 255, 0.45);
    box-shadow: 0 0 26px rgba(122, 162, 255, 0.2), inset 0 0 22px rgba(122, 162, 255, 0.08);
    pointer-events: none;
  }
  .is-home .wi__media--main, .is-home .wi__media--video { z-index: 1; }
  .is-home .wi__media--main { aspect-ratio: auto; height: calc(var(--h) * var(--u)); }
  /* the poster card (Solis): a tall coloured card with the photo at its bottom */
  .is-home .wi__media.is-poster { background: var(--poster); }
  .is-home .wi__media.is-poster img { position: absolute; left: 0; right: 0; bottom: 0; height: 39.3%; }
  /* the sun's light fades into the card at the top of the photo, instead of ending on a hard edge */
  .is-home .wi__media.is-poster img { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 38%); mask-image: linear-gradient(to bottom, transparent 0, #000 38%); }
  .is-home .wi__media--video video { width: 100%; height: auto; }
  .is-home .wi__media--video:not(.is-wide) video {
    aspect-ratio: 540 / 1094;
    object-fit: cover;
    /* the phone recordings have a light page around the phone: clip to the phone's own edge */
    clip-path: inset(1% 3.3% 1.9% 4.1% round 12.6% / 6.2%);
  }
  .is-home .wi__media--video.is-wide video { aspect-ratio: 16 / 9; object-fit: cover; }
  .is-home .wi__link { font-size: calc(84.8 * var(--u)); }
  .is-home .wi__meta { justify-content: flex-end; }
  .is-home .wi__meta > span:first-child { flex: 1; text-align: right; }

  /* a · poster + phone video (Solis) */
  .wi--a .wi__glass  { --x: 190;  --y: 6;   --w: 120; --h: 130; }
  .wi--a .wi__media--main  { --x: 243;  --y: 38;  --w: 380; --h: 601; }
  .wi--a .wi__media--video { --x: 689;  --y: 39;  --w: 309; }
  .wi--a .wi__meta   { --x: 1029; --y: 290; --w: 208; }
  .wi--a .wi__title  { --x: 243;  --y: 694; --w: 521; }
  .wi--a .wi__text   { --x: 243;  --y: 796; --w: 521; }

  /* b · wide image + wide video (Design for Safety) */
  .wi--b .wi__glass  { --x: 1000; --y: 14;  --w: 250; --h: 100; }
  .wi--b .wi__media--main  { --x: 610;  --y: 70;  --w: 638; --h: 378; }
  .wi--b .wi__media--video { --x: 244;  --y: 519; --w: 647; }
  .wi--b .wi__meta   { --x: 982;  --y: 653; --w: 208; }
  .wi--b .wi__title  { --x: 239;  --y: 54;  --w: 360; }
  .wi--b .wi__desc   { --x: 239;  --y: 342; --w: 327; }
  .wi--b .wi__role   { --x: 257;  --y: 921; --w: 560; }

  /* c · one big photo (Chip the Sheep) */
  .wi--c .wi__title  { --x: 144;  --y: 0;   --w: 521; }
  .wi--c .wi__glass  { --x: 392;  --y: 410; --w: 130; --h: 180; }
  .wi--c .wi__media--main  { --x: 436;  --y: 130; --w: 660; --h: 445; }
  .wi--c .wi__meta   { --x: 1112; --y: 139; --w: 208; }
  .wi--c .wi__text   { --x: 175;  --y: 628; --w: 521; }

  /* ---- A · intro (Figma y 4000–4945) ---- */
  .is-home .intro { position: relative; height: calc(945 * var(--u)); }
  .is-home .intro__photos { display: block; }
  .is-home .intro__photo {
    position: absolute;
    max-width: none;
    aspect-ratio: auto;
    background: #d9d9d9;
  }
  .is-home .intro__photo:not(.has-photo) { display: block; }
  .is-home .intro__photo--1 { left: calc(553 * var(--u)); top: calc(194 * var(--u)); width: calc(334 * var(--u)); height: calc(440 * var(--u)); }
  .is-home .intro__photo--2 { left: calc(760 * var(--u)); top: calc(67 * var(--u));  width: calc(208 * var(--u)); height: calc(283 * var(--u)); z-index: 1; }
  .is-home .intro__photo--1 { z-index: 1; }
  .is-home .intro__photo--2:not(.has-photo) {   /* the pane behind the photo: faint blue glass with a lit edge */
    z-index: 0;
    background: linear-gradient(135deg, rgba(122, 162, 255, 0.13), rgba(122, 162, 255, 0.04)), #090c14;   /* solid underneath, so the blue line goes behind the pane instead of showing through */
    border: 1px solid rgba(122, 162, 255, 0.45);
    box-shadow: 0 0 26px rgba(122, 162, 255, 0.2), inset 0 0 22px rgba(122, 162, 255, 0.08);
  }
  .is-home .intro__lead {
    position: absolute;
    left: calc(218 * var(--u));
    top: calc(694 * var(--u));
    width: calc(1040 * var(--u));
    max-width: none;
    font-size: calc(37.6 * var(--u));
  }
  /* the invitation hangs at the end of the blue line (its dot is at Figma 1080, 5010), just below it */
  .is-home .intro__more { position: absolute; z-index: 2; left: calc(900 * var(--u)); top: calc(1042 * var(--u)); margin: 0; }

  /* ---- C · lab (Figma y 4945–6480) ---- */
  .is-home .lab { height: calc(1535 * var(--u)); overflow: visible; }
  .is-home .lab__head,
  .is-home .lab__head > div { display: contents; }
  .is-home .lab .section-title {   /* a calmer size: the board below is the main thing here */
    position: absolute;
    left: calc(125 * var(--u));
    top: calc(250 * var(--u));
    margin: 0;
    font-size: calc(30 * var(--u));
    letter-spacing: 0.12em;
    white-space: nowrap;
  }
  .is-home .lab .label { position: absolute; left: calc(125 * var(--u)); top: calc(205 * var(--u)); }
  .is-home .board__pause { position: absolute; right: calc(120 * var(--u)); top: calc(340 * var(--u)); }
  .is-home .board {
    position: absolute;
    left: calc(317 * var(--u));
    top: calc(419 * var(--u));
    width: calc(886 * var(--u));
    height: calc(770 * var(--u));
    aspect-ratio: auto;
    margin: 0;
  }
  .is-home .lab__note {
    position: absolute;
    left: calc(135 * var(--u));
    top: calc(1123 * var(--u));
    width: calc(370 * var(--u));
    max-width: none;
    margin: 0;
  }
  .is-home .lab__quote { font-size: calc(36 * var(--u)); }

  /* ---- D · contact (Figma y 6480–7704) ---- */
  .is-home .contact { padding: calc(48 * var(--u)) 0 calc(108 * var(--u)); }
  .is-home .contact > .label { margin-left: calc(280 * var(--u)); }
  .is-home .contact__title {
    margin: calc(24 * var(--u)) 0 0 calc(333 * var(--u));
    max-width: calc(940 * var(--u));
    font-size: calc(63.36 * var(--u));
  }
  .is-home .contact__grid {
    grid-template-columns: calc(568 * var(--u)) calc(454 * var(--u));
    column-gap: calc(136 * var(--u));
    margin-top: calc(72 * var(--u));
    padding-left: calc(124 * var(--u));
  }
  .is-home .contact__side { margin-top: calc(487 * var(--u)); }
}

/* the photo in the About block is a link to the About page */
.intro__photo a { display: block; width: 100%; height: 100%; transition: box-shadow var(--dur-card, .3s) var(--ease-out); }
.intro__photo:has(a:hover), .intro__photo:has(a:focus-visible) { box-shadow: 0 0 0 1px var(--accent), 0 0 28px color-mix(in srgb, var(--accent) 30%, transparent); }
