/* ============================================================
   Case study page: Jörð.tech
   Loads after styles.css and only adds what the case study needs.
   Same tokens, type and rules as the home page.
   ============================================================ */

/* ─────────────── Hero ─────────────── */

.case-hero { padding-bottom: clamp(3rem, 7vw, 5rem); border-bottom: 1px solid var(--ink); }
.case-hero .eyebrow a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.case-hero .eyebrow a:hover { color: var(--ink); border-bottom-color: var(--ink); }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.25rem clamp(1.5rem, 3vw, 2.5rem);
  margin: 0 0 clamp(3rem, 7vw, 4.5rem); max-width: 54rem;
}
.facts div { border-top: 1px solid var(--ink); padding-top: 0.85rem; }
.facts dt {
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.35rem;
}
.facts dd { margin: 0; font-size: 0.9375rem; font-weight: 500; }

/* ─────────────── Shared ─────────────── */

.kicker {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 1.5rem;
}
#gap .statement, #gap .prose { max-width: 52rem; }   /* left-aligned like every other section; only the text column is narrowed */

.statement {
  font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1.12; letter-spacing: -0.03em;
  margin-bottom: 2rem;
}
.prose p { color: var(--ink-soft); font-size: 1.0625rem; }

.two-up {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem); align-items: start;
  margin-top: clamp(3.5rem, 7vw, 5rem);
}
.two-up h3, .build-grid h3 { font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 0.9rem; }
.two-up p, .build-grid p { color: var(--ink-soft); }
@media (max-width: 52rem) { .two-up { grid-template-columns: minmax(0, 1fr); } }

.sub { font-size: 1.5rem; letter-spacing: -0.02em; margin: clamp(3.5rem, 7vw, 5rem) 0 1.75rem; }

/* ─────────────── Hero gallery ───────────────
   Full-bleed row of screens, one per view, scroll-snapped (so swipe works without JS).
   Arrows, keys and the full-screen toggle are wired in the page script. */

.case-hero .facts { margin-bottom: clamp(2rem, 5vw, 3rem); }
.gallery { position: relative; }
.g-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.g-count { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; color: var(--ink-faint); }
.g-now { color: var(--ink); }
.g-ctrls { display: flex; gap: 0.5rem; }
.g-btn {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0;
  color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 50%;
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.g-btn:hover { background: var(--ink); color: var(--paper); }
.g-btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.g-full .i-close, .is-full .g-full .i-open { display: none; }
.is-full .g-full .i-close { display: block; }

.g-track {
  list-style: none; margin: 0; padding: 0;
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.g-track::-webkit-scrollbar { display: none; }
.g-track:focus-visible { outline: 3px solid var(--spec-2); outline-offset: -3px; }
.g-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.g-slide figure {
  /* table layout: the caption takes the width of the screen above it */
  display: table; margin: 0 auto;
}
.g-slide figure > img, .g-slide .pair { display: block; margin-inline: auto; }
.g-slide img {
  display: block; width: auto; height: auto;
  max-width: min(calc(100vw - 2 * var(--gutter)), calc(var(--wrap) + 8rem)); max-height: 72vh;
  border: 0; border-radius: var(--radius); cursor: zoom-in;
  /* hairline frame: a half-pixel ring that follows the corner radius and takes no layout space */
  box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--ink) 55%, transparent);
}
.g-slide .pair { display: flex; justify-content: center; gap: clamp(1rem, 4vw, 3rem); }
.g-slide .pair img {
  height: min(72vh, 46rem); width: auto; max-width: 42vw; aspect-ratio: 1 / 2;
  border-radius: 13% / 6.5%;   /* trims the export's square corners to the phone's own; keeps the hairline ring */
}
.g-slide figcaption {
  display: table-caption; caption-side: bottom; padding-top: 1rem;
  font-size: 0.9375rem; color: var(--ink-soft);
}
.g-slide figcaption > span { display: block; }
.g-slide .pair + figcaption, .g-slide figcaption { min-width: 18rem; }
.g-role { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-bottom: 0.3rem; }

/* Full screen: the gallery takes over the window. */
.g-lock, .g-lock body { overflow: hidden; }
.gallery.is-full {
  position: fixed; inset: 0; z-index: 200; background: var(--paper);
  display: grid; grid-template-rows: auto minmax(0, 1fr); padding-block: 1rem;
}
.is-full .g-bar { max-width: none; margin-bottom: 0.75rem; }
.is-full .g-track { height: 100%; }
.is-full .g-slide { display: grid; place-items: center; }
.is-full .g-slide img { max-height: calc(100vh - 12rem); max-width: calc(100vw - 2 * var(--gutter)); cursor: default; }
.is-full .g-slide .pair img { height: calc(100vh - 12rem); }

/* ─────────────── Product philosophy ─────────────── */

.primitives { list-style: none; margin: 0; padding: 0; }
.primitives li {
  padding: 1.1rem 0; border-top: 1px solid var(--ink); color: var(--ink-soft);
}
.primitives li:last-child { border-bottom: 1px solid var(--ink); }
.primitives b { display: block; font-family: var(--font-display); font-size: 1.375rem; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 0.2rem; }

.expressions {
  list-style: none; counter-reset: ex; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.5rem clamp(1rem, 2.5vw, 2rem);
}
@media (min-width: 40rem) { .expressions { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.expressions li { counter-increment: ex; border-top: 1px solid var(--ink); padding-top: 1rem; }
.expressions li::before {
  content: counter(ex, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; color: var(--ink-faint);
}
.expressions h4 { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: -0.02em; margin: 0.6rem 0 0.5rem; }
.expressions p { font-size: 0.875rem; color: var(--ink-soft); }

/* ─────────────── Screen design philosophy ─────────────── */

.borders, .swap { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.borders th, .swap th {
  text-align: left; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
  padding: 0 0.75rem 0.6rem 0; border-bottom: 1px solid var(--ink);
}
.borders td, .swap td { padding: 0.7rem 0.75rem 0.7rem 0; border-bottom: 1px solid var(--rule); color: var(--ink-soft); vertical-align: top; }
.borders td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }
.note { font-size: 0.9375rem; margin-top: 1rem; }

/* A plain drawing of the frame: four fixed borders around one canvas. */
.frame-diagram {
  display: grid; aspect-ratio: 16 / 11;
  grid-template-columns: 12% 1fr 26%;
  grid-template-rows: 9% 18% 1fr 13%;
  grid-template-areas:
    "side top    top"
    "side band   band"
    "side canvas rail"
    "side bottom bottom";
  gap: 6px; padding: 6px;
  border: 1px solid var(--ink); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.frame-diagram > div {
  border: 1px solid var(--ink-faint); border-radius: 4px; padding: 0.45rem 0.55rem; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; overflow: hidden;
}
.fd-shell-side { grid-area: side; background: color-mix(in srgb, var(--ink) 6%, transparent); writing-mode: vertical-rl; transform: rotate(180deg); justify-content: flex-end; }
.fd-shell-top  { grid-area: top; background: color-mix(in srgb, var(--ink) 6%, transparent); justify-content: center; }
.fd-top        { grid-area: band; }
.fd-rail       { grid-area: rail; }
.fd-canvas     { grid-area: canvas; border-style: dashed !important; }
.fd-canvas i   { display: block; height: 0.45rem; border-radius: 2px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.fd-bottom     { grid-area: bottom; flex-direction: row !important; justify-content: space-between; align-items: center; }
.fd-bottom b   { width: 22%; height: 60%; border-radius: 3px; border: 1.5px solid var(--spec-1); }
@media (max-width: 30rem) { .frame-diagram { font-size: 0.5625rem; } }

.rules {
  list-style: none; margin: clamp(3.5rem, 7vw, 5rem) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.5rem clamp(1.25rem, 3vw, 2.25rem);
}
.rules li { border-top: 1px solid var(--ink); padding-top: 1rem; }
.rules h4 { font-family: var(--font-display); font-size: 1.125rem; letter-spacing: -0.015em; line-height: 1.2; margin: 0 0 0.5rem; }
.rules p { font-size: 0.875rem; color: var(--ink-soft); }

/* ─────────────── Build ─────────────── */

.cols-2 {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start;
}
@media (max-width: 56rem) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
.prose h3 { font-size: 1.375rem; letter-spacing: -0.02em; margin: 2.25rem 0 0.75rem; }
.prose h3:first-child { margin-top: 0; }
.prose code, .swap code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  padding: 0.1em 0.35em; border-radius: 3px;
}
.swap { margin: 0.5rem 0 0; font-size: 0.875rem; }

.pipeline {
  list-style: none; margin: 0 0 clamp(3rem, 6vw, 4rem); padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-block: 1px solid var(--ink);
}
.pipeline li { padding: 1.1rem 1rem 1.2rem; border-left: 1px solid var(--rule); position: relative; }
.pipeline li:first-child { border-left: 0; padding-left: 0; }
.pipeline li:not(:last-child)::after {
  content: "→"; position: absolute; right: -0.45rem; top: 1rem;
  background: var(--paper); color: var(--ink-faint); font-size: 0.85rem; line-height: 1; padding: 0.1rem 0;
}
.pipeline b { display: block; font-family: var(--font-display); font-size: 1.125rem; letter-spacing: -0.015em; margin-bottom: 0.35rem; }
.pipeline span { font-size: 0.8125rem; color: var(--ink-soft); display: block; line-height: 1.45; }
.pipeline .is-live b { background: var(--spectrum) no-repeat 0 100% / 100% 2px; padding-bottom: 0.15rem; display: inline-block; }
@media (max-width: 56rem) {
  .pipeline { grid-template-columns: 1fr; }
  .pipeline li, .pipeline li:first-child { border-left: 0; border-top: 1px solid var(--rule); padding: 0.9rem 0; display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; }
  .pipeline li:first-child { border-top: 0; }
  .pipeline li::after { display: none; }
}

.code { margin: 0; position: sticky; top: 6.5rem; }
.code figcaption {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em; color: #a8a8be;
  background: #1f1f28; padding: 0.7rem 1rem; border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid #38384a; border-bottom: 0;
}
.code pre {
  margin: 0; overflow-x: auto;
  background: #131318; color: #ebebeb;
  border: 1px solid #38384a; border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.1rem 1.15rem; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.65;
}
.code .c { color: #8a8aa0; }
.code .k { color: #6cb4c4; }
.code .f { color: #ebebeb; font-weight: 500; }
.code .s { color: #ff9a42; }
.code .t { color: #a8a8be; }
@media (max-width: 56rem) { .code { position: static; } }

/* ─────────────── Close ─────────────── */

.case-close .pull { margin-bottom: 2.5rem; }
.close-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }
.back-link {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--rule);
}
.back-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.section-title + .two-up { margin-top: clamp(1.5rem, 3vw, 2.25rem); }
