/* Shared case-study layout and components. Update this file to change every case study. */
:root {
      --page-width: 1080px;
      --sidebar-width: 240px;
      --main-width: 840px;
      --reading-width: var(--content-width);
      --font-utility: var(--font-mono);
      --type-hero: var(--type-display);
      --type-quote: var(--type-body);
      --type-story: clamp(18px, 2vw, 24px);
      --type-subtitle: var(--type-md);
      --type-body: 16px;
      --type-label: var(--type-md);
      --type-annotation: var(--type-sm);
      --leading-body: 1.6;
    }

    html {
      scroll-padding-top: 40px;
    }

    body {
      -moz-osx-font-smoothing: grayscale;
    }

    .mobile-nav { display: none; }

    .case-layout {
      display: grid;
      width: min(calc(100% - 40px), var(--page-width));
      margin: 0 auto;
      padding-top: var(--space-section-first);
      grid-template-columns: var(--sidebar-width) minmax(0, var(--main-width));
      align-items: start;
    }

    /* ── Quiet project navigation ── */
    .side-nav {
      position: sticky;
      top: 40px;
      padding-right: 28px;
    }

    .back-link {
      display: grid;
      width: 32px;
      height: 32px;
      place-items: center;
      margin-bottom: 30px;
      color: var(--text-secondary);
      font-family: var(--font-utility);
      font-size: 20px;
      line-height: 1;
      text-decoration: none;
      transition: color 160ms ease;
    }

    .back-link:hover { color: var(--accent); }

    .side-nav ol {
      display: grid;
      gap: 4px;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .side-nav a:not(.back-link) {
      position: relative;
      display: block;
      padding: 5px 0;
      color: var(--text-tertiary);
      font-family: var(--font-body);
      font-size: var(--type-annotation);
      line-height: var(--leading-sm);
      text-decoration: none;
      transition: color var(--duration-fast) var(--ease-standard);
    }

    .side-nav a:not(.back-link):hover { color: var(--accent); }

    .side-nav a[aria-current="location"] {
      color: var(--text);
    }

    .side-nav a[aria-current="location"]::before {
      content: "";
      position: absolute;
      top: calc(5px + var(--leading-sm) / 2);
      left: -14px;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: var(--accent);
      transform: translateY(-50%);
    }

    .story-nav-link a {
      padding-left: 12px !important;
    }

    .story-preview-link { display: list-item; }
    body:has(.case-details[open]) .story-preview-link { display: none; }

    /* ── Reading column ── */
    .case-main {
      width: 100%;
      min-width: 0;
      padding-bottom: 0;
    }

    .reading-column {
      width: min(calc(100% - 120px), var(--reading-width));
      margin: 0 auto;
    }

    .hero { padding: 0 0 72px; }

    .hero h1 {
      max-width: 570px;
      margin: 0 0 var(--space-3);
      font-family: var(--font-body);
      font-size: clamp(36px, 4.5vw, 44px);
      font-weight: 500;
      letter-spacing: -0.03em;
      line-height: 1.14;
      text-wrap: balance;
    }

    .project-tags {
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-2);
      margin-top: var(--space-6);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
    }

    .project-tags span {
      padding: 5px var(--space-2);
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: var(--surface);
      color: var(--text-secondary);
    }

    .hero-placeholder {
      display: grid;
      width: 100%;
      aspect-ratio: 16 / 9;
      margin-top: var(--space-8);
      place-items: center;
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      background: var(--surface);
      color: var(--text-tertiary);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
    }

    .hero-visual {
      margin: var(--space-8) 0 0;
    }

    .hero-visual img {
      display: block;
      width: 100%;
      height: auto;
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      background: var(--surface);
    }

    .hero-caption {
      margin: var(--space-2) 0 0;
      color: var(--text-tertiary);
      font-family: var(--font-body);
      font-size: var(--type-annotation);
      line-height: 1.5;
      overflow-wrap: break-word;
      text-wrap: pretty;
    }

    .hook {
      margin: 0 0 72px;
      letter-spacing: normal;
      line-height: 1.5;
      overflow-wrap: break-word;
      text-wrap: pretty;
    }

    /* ── Trailer: the whole story in one screen ── */
    .trailer {
      padding-bottom: 0;
    }

    .summary-section {
      margin-bottom: 48px;
    }

    .summary-section:last-of-type { margin-bottom: 0; }

    .section-label {
      margin: 0 0 var(--space-3);
      color: var(--text-tertiary);
      font-family: var(--font-body);
      font-size: var(--type-label);
      font-weight: 460;
      line-height: var(--leading-md);
    }

    .summary-section p,
    .summary-section li {
      color: var(--text-secondary);
      font-size: var(--type-body);
      letter-spacing: normal;
      line-height: var(--leading-body);
      overflow-wrap: break-word;
    }

    .summary-section p {
      max-width: 70ch;
      margin: 0 0 12px;
    }
    .summary-section p:last-child { margin-bottom: 0; }

    .outcome-list {
      margin: 0;
      padding-left: 22px;
      font-size: var(--type-body);
      letter-spacing: normal;
      line-height: var(--leading-body);
    }

    .outcome-list li { margin-bottom: 8px; padding-left: 4px; }
    .outcome-list li::marker { color: var(--accent); }

    .project-details {
      margin: 0 0 64px;
      padding: 0;
      border-top: 1px solid var(--line);
    }

    .project-detail {
      display: grid;
      min-width: 0;
      grid-template-columns: 92px minmax(0, 1fr);
      gap: 22px;
      padding: 18px 0;
      border-bottom: 1px solid var(--line);
    }

    .project-detail dt {
      margin: 0;
      color: var(--accent);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
      line-height: 1.5;
    }

    .project-detail dd {
      margin: 0;
      color: var(--text-secondary);
      font-size: var(--type-body);
      line-height: 1.5;
      overflow-wrap: break-word;
      text-wrap: pretty;
    }

    .case-details {
      border-bottom: 1px solid var(--line-soft);
    }

    .expand-control {
      display: block;
      padding: 72px 0 64px;
      cursor: pointer;
      list-style: none;
    }

    .expand-control::-webkit-details-marker { display: none; }
    .expand-control::marker { content: ""; }

    .teaser-content {
      display: block;
      max-height: 235px;
      overflow: hidden;
      -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
      mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
    }

    .teaser-label {
      display: block;
      margin-bottom: 12px;
      color: var(--text-tertiary);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
      letter-spacing: 0.06em;
      line-height: 1.4;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .teaser-title {
      display: block;
      margin-bottom: 14px;
      font-family: var(--font-body);
      font-size: var(--type-story);
      font-weight: 500;
      line-height: 1.1;
      overflow-wrap: break-word;
      text-wrap: balance;
    }

    .teaser-copy {
      display: block;
      margin-bottom: 14px;
      color: var(--text-secondary);
      font-size: var(--type-body);
      letter-spacing: normal;
      line-height: var(--leading-body);
      overflow-wrap: break-word;
      text-wrap: pretty;
    }

    .read-more {
      display: flex;
      width: max-content;
      min-height: 42px;
      align-items: center;
      justify-content: center;
      margin: -10px auto 0;
      padding: 0 16px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: var(--background);
      color: var(--text);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
      text-decoration: none;
      transition: border-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
    }

    .expand-control:hover .read-more { border-color: var(--accent); color: var(--accent); }

    .case-details[open] > .expand-control,
    .case-details[open] .teaser-content,
    .case-details[open] .read-more { display: none; }

    .detail-link { display: none; }
    body:has(.case-details[open]) .detail-link { display: list-item; }
    body:has(.case-details[open]) .mobile-links .detail-link { display: inline; }

    /* ── Full story ── */
    .full-story {
      padding-top: var(--space-section-first);
    }

    .full-story-intro {
      margin-bottom: 72px;
    }

    .full-story-intro h2 {
      margin: 0 0 12px;
      font-family: var(--font-body);
      font-size: var(--type-story);
      font-weight: 500;
      letter-spacing: var(--tracking-body);
      line-height: 1.1;
      overflow-wrap: break-word;
      text-wrap: balance;
    }

    .full-story-intro p {
      max-width: 70ch;
      margin: 0;
      color: var(--text-secondary);
      font-size: var(--type-body);
      letter-spacing: normal;
      line-height: var(--leading-body);
      overflow-wrap: break-word;
      text-wrap: pretty;
    }

    .story-section {
      margin-bottom: var(--space-section-first);
    }

    .story-section + .story-section:not(.reflection) {
      position: relative;
    }

    .story-section + .story-section:not(.reflection)::before {
      content: "";
      position: absolute;
      top: calc(var(--space-section-first) / -2);
      right: 0;
      left: 0;
      height: 1px;
      background: var(--line-soft);
    }

    .story-section h2 {
      margin: 0 0 14px;
      font-family: var(--font-body);
      font-size: var(--type-story);
      font-weight: 500;
      letter-spacing: var(--tracking-body);
      line-height: 1.25;
      overflow-wrap: break-word;
      text-wrap: wrap;
    }

    .story-section h3 {
      margin: 34px 0 10px;
      font-size: var(--type-body);
      font-weight: 500;
      line-height: 1.3;
      overflow-wrap: break-word;
      text-wrap: balance;
    }

    .story-section p {
      max-width: 70ch;
      margin: 0 0 16px;
      color: var(--text-secondary);
      font-size: var(--type-body);
      letter-spacing: normal;
      line-height: var(--leading-body);
      overflow-wrap: break-word;
    }

    .story-section strong { color: var(--text); font-weight: 500; }

    .figure-placeholder {
      display: grid;
      width: 100%;
      aspect-ratio: 4 / 3;
      margin: 28px 0 8px;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      background: var(--surface);
      color: var(--text-tertiary);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
    }

    .figure-caption {
      margin: var(--space-3) 0 0 !important;
      padding-inline: var(--space-2);
      color: var(--text-tertiary) !important;
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
      line-height: 1.5;
      overflow-wrap: break-word;
      text-wrap: pretty;
    }

    .decision-list {
      margin: 26px 0 0;
      padding: 0;
      border-top: 1px solid var(--line);
      list-style: none;
    }

    .decision-list li {
      display: grid;
      padding: 18px 0;
      grid-template-columns: 92px 1fr;
      gap: 22px;
      border-bottom: 1px solid var(--line);
    }

    .decision-number {
      color: var(--accent);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
    }

    .decision-copy {
      color: var(--text-secondary);
      font-size: var(--type-body);
      letter-spacing: normal;
      line-height: 1.5;
      overflow-wrap: break-word;
    }

    .case-study-references {
      max-width: 70ch;
      margin-top: var(--space-section-first);
      padding-top: var(--space-7);
      border-top: 1px solid var(--line-soft);
      color: var(--text-tertiary);
      font-family: var(--font-body);
      font-size: var(--type-annotation);
      letter-spacing: normal;
      line-height: 1.5;
      overflow-wrap: break-word;
    }

    .case-study-references h2 {
      margin: 0 0 var(--space-3);
      color: var(--text-secondary);
      font-size: inherit;
      font-weight: 500;
      line-height: inherit;
    }

    .case-study-references ol {
      margin: 0;
      padding-left: var(--space-6);
    }

    .case-study-references li {
      margin-bottom: var(--space-2);
      padding-left: var(--space-1);
    }

    .case-study-references a {
      color: inherit;
      text-decoration: underline;
      text-decoration-skip-ink: auto;
      text-decoration-thickness: from-font;
      text-underline-position: from-font;
    }

    .framework-note {
      margin-top: var(--space-section-first);
      padding-top: 26px;
      border-top: 1px solid var(--line);
    }

    .framework-note summary {
      color: var(--text-secondary);
      font-family: var(--font-utility);
      font-size: var(--type-annotation);
      cursor: pointer;
    }

    .framework-note ol {
      margin: 20px 0 0;
      padding-left: 22px;
      color: var(--text-secondary);
      font-size: var(--type-subtitle);
      line-height: var(--leading-copy);
    }

    .framework-note li { margin-bottom: 8px; padding-left: 4px; }

    @media (max-width: 820px) {
      html { scroll-padding-top: 72px; }

      .mobile-nav {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        min-height: 56px;
        align-items: center;
        justify-content: space-between;
        padding: 0 88px 0 20px;
        border-bottom: 1px solid var(--line);
        background: color-mix(in srgb, var(--background) 94%, transparent);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
      }

      .theme-toggle {
        top: 13px;
        right: 16px;
      }

      .mobile-nav > a {
        display: inline-flex;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        margin-left: -10px;
        color: var(--text-secondary);
        text-decoration: none;
      }

      .mobile-back-icon {
        color: var(--text);
        font-size: 18px;
        line-height: 1;
      }

      .mobile-links {
        display: none;
        gap: 14px;
      }

      .mobile-links a {
        color: var(--text-secondary);
        font-family: var(--font-utility);
        font-size: var(--type-annotation);
        text-decoration: none;
      }

      .case-layout {
        display: block;
        width: 100%;
        padding-top: 52px;
      }

      .side-nav { display: none; }
      .case-main { width: 100%; }
      .reading-column { width: min(calc(100% - 32px), var(--reading-width)); }
    }

    @media (max-width: 480px) {
      .mobile-nav { padding-left: 16px; }
      .mobile-links { gap: 12px; }
      .mobile-links .detail-link { display: none !important; }
      .case-layout { padding-top: 40px; }
      .hero { padding-bottom: 56px; }
      .project-tags { gap: 7px; }
      .hero-placeholder { margin-top: 28px; }
      .hook { margin-bottom: 48px; }
      .summary-section { margin-bottom: 40px; }
      .project-details { margin-bottom: 48px; }
      .project-detail { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
      .expand-control { padding: 56px 0 52px; }
      .full-story { padding-top: 72px; }
      .full-story-intro { margin-bottom: 48px; }
      .story-section { margin-bottom: 72px; }
      .story-section + .story-section:not(.reflection)::before { top: -36px; }
      .framework-note { margin-top: 72px; }
      .decision-list li { grid-template-columns: 72px 1fr; gap: 14px; }
    }

    @media (prefers-reduced-motion: reduce) {
      html { scroll-behavior: auto; }
      *, *::before, *::after { transition-duration: 0.01ms !important; }
    }
