@layer reset, base, layout, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, h3, p, figure, dl, dd { margin: 0; }
  img { display: block; max-width: 100%; }
  button, a { font: inherit; }
}

@layer base {
  :root {
    --coa-atlas-cream: #f4eddf;
    --coa-atlas-paper: #fffaf0;
    --coa-atlas-ink: #171311;
    --coa-atlas-muted: #675e57;
    --coa-atlas-aubergine: #4c1748;
    --coa-atlas-coral: #ff596d;
    --coa-atlas-lime: #d9ff68;
    --coa-atlas-line: rgba(23, 19, 17, 0.18);
    --coa-atlas-shell: 1220px;
    --coa-atlas-shadow: 0 18px 60px rgba(48, 20, 40, 0.18);
  }

  html { background: var(--coa-atlas-cream); color: var(--coa-atlas-ink); }
  body {
    min-width: 320px;
    background: var(--coa-atlas-cream);
    font-family: "Trebuchet MS", "Avenir Next", Arial, sans-serif;
    line-height: 1.55;
    overflow-wrap: anywhere;
    text-rendering: optimizeLegibility;
  }
  h1, h2, h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    line-height: 0.98;
    text-wrap: balance;
  }
  h1 { font-size: clamp(2.35rem, 8vw, 5.8rem); letter-spacing: -0.055em; }
  h2 { font-size: clamp(2rem, 4.7vw, 4rem); letter-spacing: -0.045em; }
  h3 { font-size: clamp(1.22rem, 2vw, 1.65rem); letter-spacing: -0.025em; }
  p { text-wrap: pretty; }
  a { color: inherit; }
  :focus-visible { outline: 3px solid var(--coa-atlas-coral); outline-offset: 4px; }
  section[id] { scroll-margin-top: 5.5rem; }
  :where([dir="auto"], bdi) { unicode-bidi: isolate; }
  [dir="rtl"] .coa-atlas-wordmark { direction: ltr; unicode-bidi: isolate; }
}

@layer layout {
  .coa-atlas-shell {
    width: min(100% - 2rem, var(--coa-atlas-shell));
    margin-inline: auto;
  }
  .coa-atlas-nav > *,
  .coa-atlas-hero__inner > *,
  .coa-atlas-section-head > *,
  .coa-atlas-model-grid > *,
  .coa-atlas-gallery > *,
  .coa-atlas-fact-strip dl > div > *,
  .coa-atlas-final__inner > *,
  .coa-atlas-footer .coa-atlas-shell > * { min-width: 0; }

  .coa-atlas-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 4.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.72rem max(1rem, calc((100vw - var(--coa-atlas-shell)) / 2));
    border-bottom: 1px solid var(--coa-atlas-line);
    background: rgba(244, 237, 223, 0.94);
    backdrop-filter: blur(12px);
  }
  .coa-atlas-nav nav { display: none; }
  .coa-atlas-age { margin-inline-start: auto; }

  .coa-atlas-hero { width: 100%; background: var(--coa-atlas-cream); }
  .coa-atlas-hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "media" "copy";
    gap: 1.2rem;
    padding-block: 1rem 3.4rem;
  }
  .coa-atlas-hero__media { grid-area: media; min-width: 0; }
  .coa-atlas-hero__copy {
    grid-area: copy;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
  }

  .coa-atlas-note-band__grid {
    display: grid;
    gap: 1px;
    background: rgba(255, 255, 255, 0.18);
  }

  .coa-atlas-characters { padding-block: 5rem; }
  .coa-atlas-section-head {
    display: grid;
    gap: 1.3rem;
    margin-bottom: 2rem;
  }
  .coa-atlas-model-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }
  .coa-atlas-gallery { display: grid; gap: 1rem; }
  .coa-atlas-fact-strip dl { display: grid; gap: 1px; }
  .coa-atlas-guide { padding-block: 5.5rem; }
  .coa-atlas-final__inner { display: grid; gap: 2rem; }
  .coa-atlas-footer .coa-atlas-shell { display: grid; gap: 1.25rem; }
}

@layer components {
  .coa-atlas-skip {
    position: fixed;
    inset-inline-start: 1rem;
    top: 0.5rem;
    z-index: 100;
    transform: translateY(-180%);
    padding: 0.75rem 1rem;
    background: var(--coa-atlas-lime);
    color: var(--coa-atlas-ink);
    font-weight: 800;
  }
  .coa-atlas-skip:focus { transform: translateY(0); }

  .coa-atlas-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    white-space: nowrap;
  }
  .coa-atlas-wordmark span {
    display: grid;
    place-items: center;
    width: 2.35rem;
    aspect-ratio: 1;
    border: 1px solid var(--coa-atlas-ink);
    border-radius: 50%;
    background: var(--coa-atlas-coral);
    font-family: Georgia, serif;
    font-size: 0.78rem;
    font-weight: 800;
  }
  .coa-atlas-wordmark strong { font-size: 0.96rem; letter-spacing: -0.02em; }
  .coa-atlas-nav nav { align-items: center; gap: 1.6rem; }
  .coa-atlas-nav nav a {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
  }
  .coa-atlas-nav nav a:hover { text-decoration: underline; text-underline-offset: 0.3em; }
  .coa-atlas-age {
    border: 1px solid var(--coa-atlas-ink);
    border-radius: 999px;
    padding: 0.38rem 0.72rem;
    background: var(--coa-atlas-lime);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .coa-atlas-hero__portrait {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 1px solid var(--coa-atlas-ink);
    border-radius: 0.2rem 3rem 0.2rem 0.2rem;
    background: #dfd6c7;
    box-shadow: var(--coa-atlas-shadow);
  }
  .coa-atlas-hero__portrait::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 38%;
    background: linear-gradient(to top, rgba(15, 10, 12, 0.72), transparent);
    pointer-events: none;
  }
  .coa-atlas-hero__portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 260ms ease;
  }
  .coa-atlas-hero__portrait:hover img { transform: scale(1.018); }
  .coa-atlas-image-label {
    position: absolute;
    z-index: 2;
    inset-inline-start: 0.85rem;
    top: 0.85rem;
    max-width: calc(100% - 1.7rem);
    padding: 0.42rem 0.62rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(23, 19, 17, 0.76);
    color: white;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.035em;
  }
  .coa-atlas-mobile-cta {
    position: absolute;
    z-index: 3;
    inset-inline: 0.85rem;
    bottom: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.25rem;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: var(--coa-atlas-lime);
    color: var(--coa-atlas-ink);
    font-weight: 900;
    text-decoration: none;
  }
  .coa-atlas-kicker {
    margin-bottom: 0.75rem;
    color: var(--coa-atlas-coral);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .coa-atlas-hero__copy h1 { max-width: 13ch; }
  .coa-atlas-lead {
    max-width: 42rem;
    margin-top: 1.25rem;
    color: var(--coa-atlas-muted);
    font-size: clamp(1rem, 2.2vw, 1.3rem);
  }
  .coa-atlas-cta,
  .coa-atlas-mobile-cta,
  .coa-atlas-filter button {
    max-width: 100%;
    white-space: normal;
  }
  .coa-atlas-cta {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.35rem;
    padding: 0.85rem 1.15rem;
    border: 1px solid var(--coa-atlas-ink);
    border-radius: 999px;
    background: var(--coa-atlas-coral);
    color: var(--coa-atlas-ink);
    box-shadow: 4px 4px 0 var(--coa-atlas-ink);
    font-weight: 900;
    text-decoration: none;
    transition: transform 150ms ease, box-shadow 150ms ease;
  }
  .coa-atlas-cta:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--coa-atlas-ink); }
  .coa-atlas-cta--desktop { display: none; margin-top: 1.55rem; }
  .coa-atlas-disclosure {
    max-width: 42rem;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--coa-atlas-line);
    color: var(--coa-atlas-muted);
    font-size: 0.82rem;
  }

  .coa-atlas-note-band { background: var(--coa-atlas-aubergine); color: #fff8ee; }
  .coa-atlas-note-band p { padding: 1.3rem 0; font-size: 0.86rem; }
  .coa-atlas-note-band strong { color: var(--coa-atlas-lime); }
  .coa-atlas-note-band code { color: var(--coa-atlas-lime); }

  .coa-atlas-section-head > p { max-width: 44rem; color: var(--coa-atlas-muted); }
  .coa-atlas-section-head h2 { max-width: 15ch; }
  .coa-atlas-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.35rem;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .coa-atlas-filter button {
    flex: none;
    min-height: 2.75rem;
    padding: 0.62rem 0.92rem;
    border: 1px solid var(--coa-atlas-ink);
    border-radius: 999px;
    background: transparent;
    color: var(--coa-atlas-ink);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 800;
  }
  .coa-atlas-filter button[aria-pressed="true"] { background: var(--coa-atlas-ink); color: var(--coa-atlas-paper); }
  .coa-atlas-model-card {
    min-width: 0;
    border-top: 1px solid var(--coa-atlas-ink);
    padding-top: 0.55rem;
  }
  .coa-atlas-model-card[hidden] { display: none; }
  .coa-atlas-model-card > a {
    display: block;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #d7cabb;
    text-decoration: none;
  }
  .coa-atlas-model-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: saturate(0.9) contrast(1.02);
    transition: transform 220ms ease, filter 220ms ease;
  }
  .coa-atlas-model-card > a:hover img { transform: scale(1.035); filter: saturate(1.05) contrast(1.02); }
  .coa-atlas-model-card > div { padding: 0.8rem 0.1rem 1.15rem; }
  .coa-atlas-model-card span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--coa-atlas-coral);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.085em;
    text-transform: uppercase;
  }
  .coa-atlas-model-card p { margin-top: 0.5rem; color: var(--coa-atlas-muted); font-size: 0.82rem; }

  .coa-atlas-evidence { padding-block: 5.4rem; background: var(--coa-atlas-ink); color: var(--coa-atlas-paper); }
  .coa-atlas-section-head--light > p { color: #cfc4b9; }
  .coa-atlas-gallery figure {
    align-self: start;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: #231e1c;
  }
  .coa-atlas-gallery figure > a {
    display: block;
    overflow: hidden;
    background: #09080e;
  }
  .coa-atlas-gallery img { width: 100%; height: auto; transition: transform 220ms ease; }
  .coa-atlas-gallery a:hover img { transform: scale(1.012); }
  .coa-atlas-gallery figcaption { padding: 1rem; color: #cfc4b9; font-size: 0.8rem; }
  .coa-atlas-gallery figcaption strong { color: var(--coa-atlas-lime); }

  .coa-atlas-fact-strip { padding-block: 5rem; background: var(--coa-atlas-coral); }
  .coa-atlas-fact-strip h2 { max-width: 14ch; margin-bottom: 2rem; }
  .coa-atlas-fact-strip dl { border-block: 1px solid var(--coa-atlas-ink); }
  .coa-atlas-fact-strip dl > div {
    display: grid;
    gap: 0.5rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--coa-atlas-ink);
  }
  .coa-atlas-fact-strip dl > div:last-child { border-bottom: 0; }
  .coa-atlas-fact-strip dt { font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; }
  .coa-atlas-fact-strip dd { max-width: 58rem; }

  .coa-atlas-guide { max-width: 880px; }
  .coa-atlas-guide > h2 { margin-top: 3.2rem; font-size: clamp(1.85rem, 4vw, 3.15rem); }
  .coa-atlas-guide > h2:first-of-type { margin-top: 0; }
  .coa-atlas-guide p { margin-top: 1rem; color: #403934; font-size: 1.02rem; }
  .coa-atlas-guide ul {
    columns: 1;
    margin: 1.3rem 0 0;
    padding-block: 1.2rem;
    padding-inline: 2.2rem 1.2rem;
    border: 1px solid var(--coa-atlas-ink);
    background: var(--coa-atlas-paper);
  }
  .coa-atlas-guide li { break-inside: avoid; margin-bottom: 0.45rem; }

  .coa-atlas-final { padding-block: 4.5rem; background: var(--coa-atlas-lime); }
  .coa-atlas-final h2 { max-width: 15ch; }
  .coa-atlas-final p:not(.coa-atlas-kicker) { max-width: 48rem; margin-top: 1rem; }
  .coa-atlas-final .coa-atlas-cta { align-self: start; background: var(--coa-atlas-paper); }

  .coa-atlas-footer { padding-block: 2.4rem; border-top: 1px solid var(--coa-atlas-line); background: var(--coa-atlas-cream); }
  .coa-atlas-footer p { max-width: 52rem; color: var(--coa-atlas-muted); font-size: 0.8rem; }
  .coa-atlas-footer nav { display: flex; flex-wrap: wrap; gap: 0.8rem 1.2rem; }
  .coa-atlas-footer a { font-size: 0.8rem; font-weight: 800; text-underline-offset: 0.2em; }

  .coa-atlas-legal {
    width: min(100% - 2rem, 780px);
    margin-inline: auto;
    padding-block: 4rem 6rem;
  }
  .coa-atlas-legal__back {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    margin-bottom: 3rem;
    font-weight: 900;
    text-underline-offset: 0.25em;
  }
  .coa-atlas-legal h1 { max-width: 12ch; font-size: clamp(2.7rem, 8vw, 5.2rem); }
  .coa-atlas-legal h2 { margin-top: 2.8rem; font-size: clamp(1.7rem, 4vw, 2.65rem); }
  .coa-atlas-legal p, .coa-atlas-legal li { color: #403934; }
  .coa-atlas-legal p { margin-top: 1rem; }
  .coa-atlas-legal ul { margin-top: 1rem; padding-inline-start: 1.3rem; }
  .coa-atlas-legal__stamp {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--coa-atlas-ink);
    border-radius: 999px;
    background: var(--coa-atlas-lime);
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .coa-atlas-legal__notice {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid var(--coa-atlas-ink);
    background: var(--coa-atlas-paper);
  }
}

@layer utilities {
  @media (min-width: 700px) {
    .coa-atlas-nav nav { display: flex; }
    .coa-atlas-note-band__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .coa-atlas-note-band p { padding-inline: 1.25rem; }
    .coa-atlas-section-head { grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr); align-items: end; }
    .coa-atlas-model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
    .coa-atlas-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .coa-atlas-fact-strip dl > div { grid-template-columns: 10rem minmax(0, 1fr); gap: 2rem; }
    .coa-atlas-guide ul { columns: 2; column-gap: 2.5rem; }
    .coa-atlas-footer .coa-atlas-shell { grid-template-columns: 1fr auto; align-items: end; }
  }

  @media (min-width: 900px) {
    .coa-atlas-hero__inner {
      grid-template-columns: minmax(0, 0.9fr) minmax(24rem, 0.76fr);
      grid-template-areas: "copy media";
      align-items: center;
      gap: clamp(2rem, 6vw, 6rem);
      min-height: calc(100svh - 4.25rem);
      padding-block: 3rem;
    }
    .coa-atlas-hero__copy { padding-block: 2rem; }
    .coa-atlas-hero__portrait { max-height: min(76svh, 760px); border-radius: 8rem 0.25rem 0.25rem 0.25rem; }
    .coa-atlas-mobile-cta { display: none; }
    .coa-atlas-cta--desktop { display: inline-flex; }
    .coa-atlas-final__inner { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  }

  @media (min-width: 900px) and (max-height: 900px) {
    .coa-atlas-hero__inner { padding-block: 1rem; }
    .coa-atlas-hero__copy { padding-block: 0; }
    .coa-atlas-hero__copy h1 { font-size: clamp(2.75rem, 5vw, 4.5rem); }
    .coa-atlas-lead { margin-top: 0.85rem; font-size: 1rem; line-height: 1.45; }
    .coa-atlas-cta--desktop { margin-top: 1rem; }
    .coa-atlas-disclosure { margin-top: 0.8rem; padding-top: 0.75rem; }
    .coa-atlas-hero__portrait { max-height: calc(100svh - 6.25rem); }
  }

  @media (min-width: 1100px) {
    .coa-atlas-model-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.15rem; }
    .coa-atlas-model-card:nth-child(5),
    .coa-atlas-model-card:nth-child(12) { transform: translateY(2.4rem); }
    .coa-atlas-characters { padding-bottom: 7.6rem; }
  }

  @media (max-width: 380px) {
    .coa-atlas-shell { width: min(100% - 1.25rem, var(--coa-atlas-shell)); }
    .coa-atlas-nav { padding-inline: 0.65rem; }
    .coa-atlas-wordmark strong { font-size: 0.86rem; }
    .coa-atlas-age { font-size: 0.68rem; }
    .coa-atlas-hero__inner { gap: 0.95rem; padding-top: 0.65rem; }
    .coa-atlas-image-label { font-size: 0.61rem; }
    .coa-atlas-model-card p { font-size: 0.76rem; }
  }

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