/* ==========================================================================
   Case-study chrome — the top bar, the "next project" cards and the footer
   every work/*.html page shares.

   Geometry follows the Figma components on Port2026 · Works/ElfieResearch:
   "TOP NAV / sub page" (700:41642), "next project" (700:42267) and "footer"
   (57:321). The frames are
   1512px wide; the 48px inset, 80px contact offset and 851px footer band are
   theirs. Colours, fonts and easings come from the token block each case-study
   page declares on :root, so this file adds no tokens of its own.
   ========================================================================== */

/* -- Responsive images ------------------------------------------------------ */
/* <picture> only chooses the file (AVIF, else WebP); it takes no part in layout,
   so frame rules written against the img keep working unchanged. */
picture { display: contents; }
/* A ~24px preview inlined as the img's own background shows the composition
   at once and is painted over when the real file decodes. */
.lqip { background-size: cover; background-position: center; background-repeat: no-repeat; }

/* -- Top bar ---------------------------------------------------------------- */
/* No edge of its own: the page colour fades out beneath it, so copy scrolling
   under the bar dissolves rather than colliding with a rule. */
.chrome {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  padding: clamp(16px, 3.17vw, 48px) var(--rail-x) 12px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-background) 72%, transparent),
    color-mix(in srgb, var(--color-background) 0%, transparent));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

/* A bracketed mono link, not a filled control. The brackets and arrow sit
   outside the scrambled span so the letter storm never touches them. */
.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 24px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.3;
  text-transform: uppercase;
  text-decoration: none;
  white-space: pre;
  color: var(--color-foreground);
  transition: color var(--duration-reveal) var(--ease-soul);
}
.back:hover, .back:focus-visible { color: var(--color-primary); }

/* -- Next project ----------------------------------------------------------- */
/* Three cards closing every case study (Figma 700:42267), one per other
   project. The whole card is the target: the title's link is stretched over
   it, and the "read more" line is its visual affordance, not a second link. */
.next .eyebrow { margin: 0; }
.next__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-5);
}
.ncard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 6px 6px var(--space-3);
  border-radius: 25px;
  background: var(--surface-card);
  box-shadow: inset 0 0 0 1px var(--ring-card);
}
.ncard:focus-within { outline: 2px solid var(--color-primary); outline-offset: 4px; }
.ncard__media {
  aspect-ratio: 400 / 300;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface-media-deep, #F1B8CF);
}
.ncard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-reveal) var(--ease-soul);
}
.ncard__text { display: flex; flex-direction: column; gap: 12px; padding-inline: var(--space-2); }
.ncard__title {
  margin: 0;
  font-size: var(--type-h3, clamp(1.25rem, 1.72vw, 1.625rem));   /* 26px @1512 */
  font-weight: 500;
  line-height: var(--lh-display);
}
.ncard__link { color: inherit; text-decoration: none; }
.ncard__link:focus-visible { outline: none; }
.ncard__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.ncard__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ncard__tag {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-tag);
  box-shadow: inset 0 0 0 0.5px var(--color-card);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--type-label);
  line-height: var(--lh-mono);
  text-transform: uppercase;
  color: var(--color-tag-foreground);
}
/* Pinned to the card foot so the row's affordances align when tags wrap. */
.ncard__cta {
  margin: auto 0 0;
  padding: 8px var(--space-2);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
  transition: color var(--duration-reveal) var(--ease-soul);
}
.ncard:hover .ncard__media img { transform: scale(1.03); }
.ncard:hover .ncard__cta, .ncard:focus-within .ncard__cta { color: var(--color-primary); }

@media (max-width: 63.99rem) {
  .next__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
}
@media (max-width: 47.99rem) {
  .next__cards { grid-template-columns: minmax(0, 1fr); }
}

/* -- Footer ----------------------------------------------------------------- */
/* One band: contact block from the top, colophon flush to the bottom, the
   drawn wordmark layered between them. 851/1512 of the width at the source. */
.footer {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-10);
  min-height: clamp(560px, 56.28vw, 960px);
  margin-top: var(--section-gap, 0px);
  padding: var(--space-10) var(--rail-x) 0;
  overflow: hidden;
  background: var(--color-background);
}
/* Only the upper arc of the glow shows; its core sits below the band. */
.footer__glow {
  position: absolute;
  z-index: -2;
  left: 50%;
  top: 0;
  width: 152.4%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--primary-200) 25%, var(--color-background) 100%);
}
/* The fade is baked into the exported SVG's glyph gradients. */
.footer__wordmark {
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 22.1%;   /* 188 / 851 */
  width: 91.27%;   /* 1380 / 1512 */
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

/* Each block is head, rule, content. The contact block holds two such groups;
   on desktop they flow column-first into one grid with no column gap, so their
   two rules meet as the single rule the source draws. */
.footer__block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 12px;
  padding-bottom: var(--space-5);
}
.footer__block--contact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
}
.footer__group { display: contents; }
.footer__group:first-child > * { padding-right: var(--space-3); }
.footer__group:first-child > .footer__rule { padding: 0; }
.footer__block .eyebrow { margin: 0; font-size: var(--type-label-lg, 0.875rem); }
.footer__rule {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--color-border);
}

.footer__links { display: flex; flex-direction: column; gap: var(--space-1); }
.footer__link {
  align-self: flex-start;
  padding-block: 12px;
  font-size: clamp(1.75rem, 3.17vw, 3rem);   /* 48px @1512 */
  font-weight: 500;
  line-height: var(--lh-display);
  text-decoration: none;
  color: var(--color-foreground);
  transition: color 240ms var(--ease-soul);
}

.footer__meta {
  display: flex;
  gap: 12px;
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--type-label);
  line-height: var(--lh-mono);
  text-transform: uppercase;
}
.footer__colophon {
  margin: 0;
  font-size: clamp(1.125rem, 1.59vw, 1.5rem);   /* 24px @1512 */
  font-weight: 500;
  line-height: 1.275;
}
.footer__colophon a { text-decoration: none; transition: color 240ms var(--ease-soul); }

/* Same hover language on every footer link: ink softens to muted. */
.footer__link:hover, .footer__link:focus-visible,
.footer__colophon a:hover, .footer__colophon a:focus-visible { color: var(--color-muted-foreground); }

@media (prefers-reduced-motion: reduce) {
  .back, .footer__link, .footer__colophon a, .ncard__media img, .ncard__cta { transition: none; }
  .ncard:hover .ncard__media img { transform: none; }
}

/* Phone: the two contact groups stack, each under its own head and rule, and
   the band sizes to its content with the wordmark back in flow. */
@media (max-width: 47.99rem) {
  .footer { min-height: auto; gap: var(--space-6); padding-bottom: env(safe-area-inset-bottom); }
  .footer__block--contact { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
  .footer__group:first-child > * { padding-right: 0; }
  .footer__group + .footer__group > .eyebrow { margin-top: var(--space-4); }
  .footer__wordmark { position: relative; left: auto; bottom: auto; transform: none; width: 100%; }
}
