/* Shared layout from the approved WaveGrating study. Colors and scene geometry
   remain in the existing theme and diagram files. */
html { scroll-padding-top: 1.5rem; }
.apple-site { --page-surface: #f5f5f7; --contact-surface: #f0f6ee; font-size: 1.125rem; line-height: 1.55; }
/* The frame matches the home page, so the header and logo keep their place between pages. */
.apple-site .frame { width: min(calc(100% - 6rem), 1200px); max-width: none; padding-inline: 0; }
.apple-site :is(h1, h2, h3) { text-wrap: balance; overflow-wrap: break-word; }
.apple-site :is(p, li) { text-wrap: pretty; }
.apple-site :is(a, button, summary):focus-visible { outline-offset: 5px; }
.apple-site .skip-link:not(:focus) { top: 0; transform: translateY(calc(-100% - 12px)); }
body.apple-site { background: var(--page-surface); }
.apple-site .site-header { position: static; background: var(--page-surface); backdrop-filter: none; border-bottom: 0; }
.apple-site .nav { height: auto; min-height: 4rem; padding-block: .375rem; gap: 1.5rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.apple-site .brand { font-size: 1.0625rem; gap: .625rem; min-height: 44px; min-width: 0; max-width: 100%; white-space: normal; }
.apple-site .brand-mark { background: #30d158; font-size: 1.5rem; padding: .25rem .5rem .4375rem; flex-shrink: 0; }
.apple-site .nav-links { display: flex; gap: 1.75rem; margin-left: auto; margin-right: 0; font-size: .9375rem; }
.apple-site .nav-links a { min-height: 44px; display: inline-flex; align-items: center; padding-block: .5rem; }
.apple-site .nav-controls { margin-left: 0; padding-left: 0; border: 0; flex-shrink: 0; }
.apple-site .reading-line { display: none; }
.apple-site .button { min-height: 44px; padding: .75rem 1.125rem; font-size: .8125rem; gap: 2rem; }
.apple-site .text-link { font-size: .875rem; font-family: var(--sans); text-transform: none; gap: .75rem; }
.apple-site .ink-mark { color: inherit; background: none; box-shadow: none; white-space: normal; }
.apple-site .ink-mark::before { display: none; }
.apple-site .case-visual::before, .apple-site .case-visual::after { display: none; }

/* Home: one introduction, then one visual and one main link per project. */
.apple-home .hero { display: flex; flex-direction: column; align-items: center; min-height: 0; padding-top: 3.25rem; padding-bottom: 2rem; gap: 2.5rem; text-align: center; }
.apple-home .hero::before { display: none; }
.apple-home .hero-copy { padding: 0; width: 100%; }
.apple-home .hero .eyebrow { max-width: none; margin: 0 0 1rem; }
.apple-home .hero h1 { font-size: 5rem; line-height: 1.05; font-weight: 600; letter-spacing: -.055em; margin: 0 auto 1.25rem; }
.apple-home .highlight { color: inherit; white-space: normal; }
.apple-home .highlight::before { display: none; }
.apple-home .hero-description { margin: 0 auto; max-width: 40ch; font-size: 1.5rem; line-height: 1.35; }
.apple-home .hero-actions { justify-content: center; margin-top: 1.75rem; }
.apple-home .hero-visual { width: min(100%, 38rem); min-height: 0; height: 22rem; margin: 0; border: 0; text-align: left; }
.apple-home .hero-visual .art-plane { width: 100%; height: 100%; padding: 1rem 0 4.5rem; flex: none; }
.apple-home .hero-visual .hero-system { display: block; width: 100%; height: 100%; max-height: none; object-fit: contain; }
.apple-home .hero-visual .visual-topline { top: 0; left: 0; right: 0; font-size: .75rem; }
.apple-home .hero-visual .visual-bottomline { bottom: 0; left: 0; font-size: .8125rem; }
.apple-home .hero-controls { bottom: 1.75rem; }
.apple-home .work { padding-top: 3rem; padding-bottom: 0; }
.apple-home .work-index { position: static; display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.5rem; margin: 0 auto 4rem; padding: 0; border: 0; background: none; backdrop-filter: none; opacity: 1; visibility: visible; transform: none; }
.apple-home .work-index a { padding: .5rem .25rem; min-height: 44px; border: 0; font-size: .9375rem; font-family: var(--sans); font-weight: 400; letter-spacing: 0; }
.apple-home .work-index a + a { border: 0; }
.apple-home .work-index a span { display: none; }
.apple-home .case-study { margin: 0 0 7rem; padding: 0; overflow: visible; border: 0; background: none; scroll-margin-top: 1.5rem; }
.apple-home .case-study::before, .apple-home .case-study::after { display: none; }
.apple-home .case-study > .project-category { justify-content: center; margin: 0 auto 1rem; padding: 0; max-width: 46rem; background: none; border: 0; color: var(--muted); font-size: .75rem; gap: .75rem 1rem; }
.apple-home .status-label { font-size: .75rem; padding: .25rem .5rem; }
.apple-home .case-layout { display: flex; flex-direction: column; align-items: center; gap: 2.5rem; padding: 0; }
.apple-home .case-copy { width: min(100%, 44rem); text-align: center; }
.apple-home .case-copy h3 { font-size: 3rem; line-height: 1.12; font-weight: 600; letter-spacing: -.04em; margin: 0 auto .875rem; }
.apple-home .case-copy .project-name { display: inline; font: inherit; margin: 0; }
.apple-home .case-summary { font-size: 1.5rem; line-height: 1.3; max-width: 36ch; margin: 0 auto; letter-spacing: -.025em; }
.apple-home .case-intro { max-width: 53ch; margin: .875rem auto 0; font-size: 1.125rem; color: var(--muted); }
.apple-home .case-copy .tech-list { justify-content: center; font-size: .75rem; margin: 1.25rem 0 .25rem; }
.apple-home .case-links { justify-content: center; gap: .5rem 1.5rem; margin-top: .75rem; }
.apple-home .case-copy .case-notes { text-align: left; max-width: 40rem; margin-inline: auto; }
.apple-home .case-visual { width: min(100%, 46rem); margin: 0; border: 0; padding: 1.5rem; }
.apple-home .case-copy > figure { margin: 1.5rem auto 0; }

/* Cases: a short introduction above the actual result or measured chart. */
.apple-case .case-hero { padding-top: 2rem; padding-bottom: 0; }
.apple-case .breadcrumb { margin-bottom: 1.5rem; font-size: .8125rem; }
.apple-case .case-hero-grid { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.apple-case .case-hero-title { width: 100%; text-align: center; }
.apple-case .case-hero .project-category { justify-content: center; flex-wrap: wrap; max-width: none; margin: 0 auto 1rem; font-size: .75rem; gap: .75rem 1rem; }
.apple-case .case-hero h1 { font-size: 4.5rem; line-height: 1.05; font-weight: 600; letter-spacing: -.04em; max-width: 18ch; margin: 0 auto; }
.apple-case .case-subtitle { font-size: 1.75rem; line-height: 1.25; max-width: 35ch; margin: 1.25rem auto 0; letter-spacing: -.025em; }
.apple-case .case-hero-copy { text-align: center; width: min(100%, 42rem); }
.apple-case .case-hero-intro { width: min(100%, 42rem); text-align: center; }
.apple-case .case-lede { font-size: 1.125rem; line-height: 1.55; color: var(--muted); max-width: 56ch; margin: 0 auto 1rem; }
.apple-case .case-hero-copy .case-links { justify-content: center; margin-top: .5rem; }
.apple-case .case-role { font-size: .9375rem; color: var(--muted); margin: .75rem auto 0; }
.apple-case .case-overview { max-width: 42rem; margin: 1.75rem auto 0; text-align: left; border-top: 0; }
.apple-case .case-overview > h3 { font-size: 1.125rem; line-height: 1.35; font-weight: 500; margin: 0 0 1rem; }
.apple-case .case-overview summary { font-size: .9375rem; padding: .75rem 0; cursor: pointer; min-height: 44px; }
.apple-case .case-facts { width: 100%; max-width: none; border-top: 0; margin: .5rem 0 0; }
.apple-case .case-facts div { border-bottom-style: solid; }
.apple-case .case-facts div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.apple-case .case-facts dt { text-transform: none; font-size: .8125rem; }
.apple-case .case-facts dd { font-size: 1rem; }
.apple-case .case-hero-grid > figure { width: min(100%, 46rem); max-width: 46rem; margin: .75rem 0 0; }
.apple-case :is(.result-pair, .case-shot, .fit-chart) { border: 0; padding: 1.5rem; background: var(--pale); }
.apple-case :is(.case-shot, .result-pair) figcaption { font-size: .9375rem; line-height: 1.5; margin-top: 1rem; }
.apple-case .case-shot img { border: 0; }
.apple-case .case-section { display: block; padding-block: 0; margin-top: 7rem; border: 0; }
.apple-case .case-section-head { position: static; text-align: center; max-width: 44rem; margin: 0 auto 2rem; }
.apple-case .case-section h2 { max-width: 27ch; font-size: 2.75rem; line-height: 1.12; letter-spacing: -.04em; margin: 0 auto; }
.apple-case .case-section-body { width: min(100%, 46rem); margin-inline: auto; }
.apple-case .case-section-body > p { font-size: 1.125rem; line-height: 1.55; max-width: 60ch; margin: 0 auto 1.25rem; }
.apple-case .case-section-body > .case-visual { margin: 0 0 1.5rem; padding: 1.5rem; border: 0; }
.apple-case .case-key-points { font-size: 1.125rem; padding-left: 1.25rem; margin-block: 1.5rem; }
.apple-case .case-key-points li + li { margin-top: .625rem; }
.apple-site .case-notes { margin-top: 1.5rem; padding-top: 0; border-top: 1px solid var(--line); }
.apple-site .case-notes > h3 { font-size: 1.375rem; line-height: 1.3; font-weight: 500; margin: 1.5rem 0 .75rem; letter-spacing: -.015em; }
.apple-case [data-awaiting-input] *, .apple-case [data-awaiting-input] *::before, .apple-case [data-awaiting-input] *::after { animation: none !important; transition: none !important; }
.apple-site .case-notes summary { font: 1rem/1.4 var(--sans); text-transform: none; padding: 1rem 0; min-height: 44px; gap: 1rem; }
.apple-site .case-notes summary > span { flex-shrink: 0; }
.apple-site .note-body { font-size: 1rem; line-height: 1.6; padding-top: .75rem; }
.apple-site .note-body p { max-width: 65ch; }
.apple-site .note-body p + p { margin-top: 1rem; }
.apple-site .note-body a { overflow-wrap: anywhere; }
.apple-site .case-quote { margin-top: 2.5rem; }
.apple-site .case-quote blockquote { font-size: 1.75rem; line-height: 1.4; }
.apple-case .case-next { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 5rem; margin-bottom: 5rem; gap: 2rem; }
.apple-case .case-next a { border-top: 1px solid var(--line); border-bottom: 0; border-left: 0; padding-top: 1.5rem; }
.apple-case .case-next strong { font-size: 1.5rem; overflow-wrap: anywhere; }
.apple-case .case-next small { font-size: .75rem; }
.apple-case .benchmark-runs { margin-top: 2.5rem; }
.apple-case .benchmark-runs-caption { font-size: 1rem; max-width: 55ch; }
.apple-case .benchmark-runs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.apple-case .benchmark-run { margin-top: 1rem; border-top: 1px solid var(--line); }
.apple-case .benchmark-run h3 { font-size: 1.25rem; line-height: 1.3; font-weight: 600; margin: 1.25rem 0; }
.apple-case .benchmark-run dl { margin: 0; }
.apple-case .benchmark-run dl > div { margin-bottom: 1rem; }
.apple-case .benchmark-run dt { font-size: .875rem; color: var(--muted); }
.apple-case .benchmark-run dd { margin: .25rem 0 0; font-size: 1.125rem; font-variant-numeric: tabular-nums; }

/* Open-source evidence and contact share the same quiet spacing. */
.apple-home .oss { padding-top: 0; padding-bottom: 7rem; }
.apple-home .oss-head { display: block; max-width: 44rem; margin: 0 auto 2.5rem; text-align: center; }
.apple-home .oss-head h2 { font-size: 2.75rem; line-height: 1.12; }
.apple-home .oss-head h2 .title-line { display: inline; }
.apple-home .oss-head h2 .title-line + .title-line::before { content: ' '; }
.apple-home .oss-head > p { font-size: 1.125rem; max-width: 52ch; margin: 1rem auto 0; }
.apple-home .oss-grid { max-width: 58rem; margin-inline: auto; gap: 3rem; }
.apple-home .oss-quotes { position: static; padding: 2rem; border: 0; }
.apple-home .oss-quotes blockquote { font-size: 1.5rem; }
.apple-home .oss-quotes .case-quote + .case-quote { border-top-style: solid; }
.apple-site .about { background: var(--contact-surface); color: var(--ink); padding-top: 3.5rem; }
.apple-site .about-inner { gap: 4rem; padding-bottom: 3rem; }
.apple-site .about .eyebrow { color: var(--muted); }
.apple-site .about h2 { font-size: 2.75rem; line-height: 1.12; letter-spacing: -.04em; }
.apple-site .about h2 .ink-mark { color: var(--ink); }
.apple-site .about h2 .title-line { display: inline; }
.apple-site .about h2 .title-line + .title-line::before { content: ' '; }
.apple-site .about-copy > p { font-size: 1.125rem; line-height: 1.55; color: var(--muted); }
.apple-site .about-copy > p:first-child { color: var(--ink); font-size: 1.25rem; }
.apple-site .about-copy .contact-lead { font-size: 1.25rem; }
.apple-site .contact-actions { gap: .75rem 1.75rem; }
.apple-site .footer { font-size: .875rem; text-transform: none; line-height: 1.5; border-top: 1px solid var(--line); color: var(--muted); padding-block: 1.5rem; }
.apple-site .footer > span:nth-child(2) { display: inline; }

.apple-site .not-found { min-height: calc(100svh - 4.75rem); text-align: center; padding-block: 4rem; }
.apple-site .not-found h1 { font-size: 4.5rem; line-height: 1.08; margin-bottom: 1.5rem; }
.apple-site .not-found p { max-width: 40ch; margin: 0 auto 1.5rem; }
.apple-site .not-found-actions { justify-content: center; }

@media print { .apple-site { --page-surface: #fff; } }
@media screen {
  html[data-theme="dark"] .apple-site { --page-surface: #000; --contact-surface: #171717; }
}
@media (max-width: 60rem) {
  .apple-case .case-hero h1 { font-size: 3.75rem; }
  .apple-site .about-inner { gap: 2.5rem; }
  .apple-home .oss-grid { grid-template-columns: 1fr; max-width: 46rem; }
  .apple-home .oss-quotes { max-width: none; }
}
@media (max-width: 767px) {
  .apple-site .frame { width: calc(100% - 2rem); }
}
@media (max-width: 45rem) {
  .apple-site .nav { gap: .5rem 1rem; }
  .apple-site .nav-links { gap: 1rem; }
  .apple-site .nav-controls { margin-left: 0; }
  .apple-home .nav-links { display: none; }
  .apple-case .brand > span:last-child { display: none; }
  .apple-home .hero { padding-top: 2.5rem; gap: 2rem; }
  .apple-home .hero h1 { font-size: 3.25rem; max-width: 13ch; }
  .apple-home .hero-description { font-size: 1.375rem; }
  .apple-home .hero .eyebrow { font-size: .75rem; }
  .apple-home .hero .eyebrow > span { margin-inline: .25rem; }
  .apple-home .hero-visual { height: 20rem; }
  .apple-home .hero-visual .art-plane { padding-bottom: 5rem; }
  .apple-home .work { padding-top: 2rem; }
  .apple-home .work-index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 28rem; gap: .25rem .75rem; margin-bottom: 3rem; }
  .apple-home .case-study { margin-bottom: 5rem; }
  .apple-home .case-layout { gap: 2rem; }
  .apple-home .case-copy h3 { font-size: 2.125rem; }
  .apple-home .case-summary { font-size: 1.375rem; }
  .apple-home .case-visual { padding: 1rem; }
  .apple-case .case-hero { padding-top: 1.5rem; }
  .apple-case .breadcrumb { margin-bottom: 1.25rem; }
  .apple-case .case-hero h1 { font-size: 3rem; }
  .apple-case .case-subtitle { font-size: 1.5rem; }
  .apple-case .case-section { margin-top: 5rem; }
  .apple-case .case-section h2 { font-size: 2.125rem; }
  .apple-case :is(.result-pair, .case-shot, .fit-chart), .apple-case .case-section-body > .case-visual { padding: 1rem; }
  .apple-case .case-next { grid-template-columns: 1fr; gap: .75rem; margin-block: 3.5rem; }
  .apple-case .case-next a + a { align-items: flex-start; text-align: left; }
  .apple-case .case-next strong { font-size: 1.125rem; }
  .apple-case .bench-table { min-width: 0; table-layout: fixed; }
  .apple-case .bench-table :is(th, td) { overflow-wrap: anywhere; padding: .75rem .375rem .75rem 0; }
  .apple-case .bench-table :is(th, td):first-child { padding-left: 0; }
  .apple-case .benchmark-runs-grid { grid-template-columns: 1fr; gap: .75rem; }
  .apple-site .case-quote blockquote { font-size: 1.5rem; }
  .apple-home .oss { padding-bottom: 5rem; }
  .apple-home .oss-head h2, .apple-site .about h2 { font-size: 2.125rem; }
  .apple-home .oss-quotes { padding: 1.5rem; }
  .apple-site .about { padding-top: 2.5rem; }
  .apple-site .about-inner { grid-template-columns: 1fr; gap: 2rem; padding-bottom: 2.5rem; }
  .apple-site .footer { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .apple-site .footer a { margin-left: 0; }
  .apple-site .not-found h1 { font-size: 3rem; }
}
@media (max-width: 25rem) {
  .apple-site .brand { font-size: 1rem; gap: .5rem; }
  .apple-site .nav-links { margin-left: auto; }
  .apple-site .nav-controls { margin-left: auto; }
  .apple-home .hero h1 { font-size: 2.875rem; }
  .apple-case .case-hero h1 { font-size: 2.625rem; }
}
/* Figures and diagrams open as they scroll in, like the home panels. Pause and reduced motion keep them still. */
@media screen and (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    html:not([data-motion="paused"]) .apple-case :is(.case-section-body > .case-visual, .case-shot, .result-pair, .fit-chart) {
      animation: case-plate-open linear backwards;
      animation-timeline: view();
      animation-range: entry 10% entry 90%;
    }
  }
  @keyframes case-plate-open { from { clip-path: inset(6% 4%); } to { clip-path: inset(0); } }
}
@media print {
  .apple-site .site-header, .apple-site .not-found-actions { display: none; }
  .apple-site .hero, .apple-site .case-hero { padding-top: 0; }
  .apple-site .case-section, .apple-site .case-study { margin-block: 2rem; }
  .apple-site .about { padding-top: 1.5rem; }
}
