@layer reset, tokens, base, components, pages, responsive;

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

@layer tokens {
  :root {
    --birch: #f3efe6;
    --paper: #fffdf8;
    --slate: #25333a;
    --slate-2: #3f5058;
    --lingon: #a52b4b;
    --lingon-dark: #771b35;
    --sky: #bfd7df;
    --pine: #315447;
    --mustard: #e3b450;
    --line: rgba(37, 51, 58, .24);
    --shadow: 9px 9px 0 var(--slate);
    --sans: "Segoe UI", Arial, Helvetica, sans-serif;
  }
}

@layer base {
  body { background: var(--birch); color: var(--slate); font: 400 1rem/1.65 var(--sans); }
  h1, h2, h3 { line-height: .96; letter-spacing: -.045em; font-weight: 650; }
  h1 { font-size: clamp(3.25rem, 8.5vw, 8.75rem); max-width: 10ch; }
  h2 { font-size: clamp(2.5rem, 6vw, 5.8rem); }
  h3 { font-size: clamp(2rem, 4vw, 4.5rem); }
  a:focus-visible, button:focus-visible { outline: 4px solid var(--mustard); outline-offset: 4px; }
  .skip-link { position: fixed; z-index: 20; top: .75rem; left: .75rem; transform: translateY(-180%); padding: .8rem 1rem; background: var(--slate); color: white; }
  .skip-link:focus { transform: none; }
}

@layer components {
  .masthead { border-bottom: 1px solid var(--slate); }
  .masthead__utility { display: flex; justify-content: space-between; padding: .55rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); font-size: .72rem; text-transform: uppercase; letter-spacing: .13em; }
  .masthead__core { min-height: 10rem; display: grid; grid-template-columns: 1fr auto auto; gap: 2rem; align-items: end; padding: 1.2rem clamp(1rem, 4vw, 4rem); }
  .masthead__core > p { text-transform: uppercase; font-size: .78rem; letter-spacing: .14em; line-height: 1.35; }
  .wordmark { text-decoration: none; font-size: clamp(3rem, 8vw, 8rem); font-weight: 750; line-height: .75; letter-spacing: -.075em; }
  .wordmark--small { font-size: 2.5rem; }
  .menu-button { display: none; border: 1px solid var(--slate); background: transparent; padding: .7rem 1rem; color: var(--slate); }
  .site-nav { display: flex; justify-content: flex-end; gap: 2rem; padding: .7rem clamp(1rem, 4vw, 4rem); font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; }
  .site-nav a, .site-footer a { text-underline-offset: .3em; text-decoration-thickness: 1px; }
  .site-nav a:hover, .site-footer a:hover { color: var(--lingon-dark); }
  .eyebrow, .coordinate, .chapter-head p { text-transform: uppercase; letter-spacing: .15em; font-size: .72rem; font-weight: 700; }
  .editorial-link, .details-link, .amazon-link { display: inline-block; font-weight: 700; text-underline-offset: .35em; text-decoration-thickness: 2px; }
  .amazon-link { color: var(--lingon-dark); }
  .chapter-head { display: grid; grid-template-columns: minmax(11rem, 1fr) 3fr; align-items: end; gap: 2rem; margin-bottom: clamp(3rem, 7vw, 7rem); }
  .boundary { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; background: var(--slate); color: white; padding: 1.5rem clamp(1rem, 4vw, 4rem); }
  .boundary strong { color: var(--mustard); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
  .site-footer { background: var(--slate); color: white; padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 4vw, 4rem); display: grid; grid-template-columns: 1.1fr 1.6fr .7fr; gap: 3rem; }
  .site-footer nav { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
  .site-footer__notice { grid-column: 1 / -1; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.3); font-size: .85rem; }
}

@layer pages {
  .hero { min-height: 76vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(24rem, .65fr); gap: clamp(2rem, 6vw, 7rem); align-items: center; padding: clamp(4rem, 8vw, 9rem) clamp(1rem, 4vw, 4rem); overflow: hidden; }
  .hero__copy { display: flex; flex-direction: column; gap: 2rem; }
  .lede { max-width: 42rem; font-size: clamp(1.12rem, 2vw, 1.5rem); }
  .hero__copy .editorial-link { align-self: flex-start; }
  .bearing-map { position: relative; aspect-ratio: 1; border: 1px solid var(--slate); border-radius: 50%; background: var(--sky); box-shadow: var(--shadow); }
  .bearing-map::before, .bearing-map::after { content: ""; position: absolute; background: var(--slate); opacity: .35; }
  .bearing-map::before { width: 1px; top: 0; bottom: 0; left: 50%; }
  .bearing-map::after { height: 1px; left: 0; right: 0; top: 50%; }
  .bearing { position: absolute; width: 42%; font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; line-height: 1.35; }
  .bearing b { display: block; margin-top: .35rem; font-size: .9rem; text-transform: none; letter-spacing: 0; }
  .bearing--n { top: 6%; left: 29%; text-align: center; }
  .bearing--s { bottom: 6%; left: 29%; text-align: center; }
  .bearing--e { right: 4%; top: 44%; text-align: right; }
  .bearing--w { left: 4%; top: 44%; }
  .bearing-map__centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 50%; background: var(--lingon); color: white; font-size: 2rem; font-weight: 800; z-index: 2; }
  .catalogue, .method, .standard-page, .product-page { padding: clamp(5rem, 10vw, 11rem) clamp(1rem, 4vw, 4rem); }
  .book-card { container-type: inline-size; display: grid; grid-template-columns: minmax(17rem, .9fr) minmax(0, 1.8fr); gap: clamp(2rem, 6vw, 7rem); align-items: center; padding: clamp(3rem, 7vw, 7rem) 0; border-top: 1px solid var(--slate); }
  .book-card:nth-of-type(even) .cover { order: 2; }
  .cover { aspect-ratio: .72; max-width: 25rem; width: 100%; padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--slate); box-shadow: var(--shadow); }
  .cover span, .cover small { text-transform: uppercase; letter-spacing: .12em; font-size: .65rem; }
  .cover strong { font-size: clamp(2.2rem, 8cqw, 4.5rem); line-height: .9; letter-spacing: -.05em; }
  .cover--home { background: var(--mustard); }
  .cover--field { background: var(--pine); color: white; }
  .cover--north { background: var(--paper); color: var(--lingon-dark); }
  .cover--future { background: var(--sky); }
  .book-card__body { display: flex; flex-direction: column; align-items: flex-start; gap: 1.2rem; }
  .subtitle { font-size: 1.15rem; font-style: italic; }
  .book-card__body > p:not(.coordinate, .subtitle, .discrepancy) { max-width: 46rem; font-size: 1.12rem; }
  dl { width: 100%; max-width: 48rem; border-top: 1px solid var(--line); }
  dl div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
  dd { font-weight: 600; }
  .discrepancy { font-size: .78rem; max-width: 38rem; }
  .actions { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: .8rem; }
  .method { background: var(--sky); }
  .route { list-style: none; padding: 0; border-top: 1px solid var(--slate); }
  .route li { display: grid; grid-template-columns: 1fr 3fr; gap: 2rem; padding: 1.3rem 0; border-bottom: 1px solid var(--slate); font-size: clamp(1rem, 2vw, 1.35rem); }
  .route b { color: var(--lingon-dark); }
  .method__note { max-width: 47rem; margin: 3rem 0 0 auto; }
  .standard-page { max-width: 82rem; margin: 0 auto; }
  .standard-page h1 { margin-bottom: 3rem; }
  .standard-page h2 { font-size: 2rem; margin: 3rem 0 1rem; letter-spacing: -.02em; }
  .standard-page p, .standard-page li { max-width: 48rem; }
  .notice-panel { margin: 2rem 0; padding: 1.5rem; background: var(--sky); border-left: .5rem solid var(--lingon); }
  .product-page { display: grid; grid-template-columns: minmax(15rem, .8fr) minmax(0, 1.6fr); gap: clamp(2rem, 7vw, 8rem); align-items: start; }
  .product-page__info { display: flex; flex-direction: column; align-items: flex-start; gap: 1.4rem; }
  .breadcrumb { grid-column: 1 / -1; font-size: .8rem; }
  .product-page h1 { font-size: clamp(3rem, 7vw, 7rem); }
  .product-page__essay { max-width: 48rem; font-size: 1.1rem; }
  .retailer-panel { width: 100%; padding: 1.5rem; margin-top: 1rem; background: var(--slate); color: white; }
  .retailer-panel .amazon-link { color: var(--mustard); margin-top: 1rem; }
}

@layer responsive {
  @media (max-width: 760px) {
    .masthead__utility span:last-child { display: none; }
    .masthead__core { min-height: 7rem; grid-template-columns: 1fr auto; align-items: center; }
    .masthead__core > p { display: none; }
    .wordmark { font-size: 3.5rem; }
    .menu-button { display: block; }
    .site-nav { display: none; padding: 0 1rem 1rem; flex-direction: column; gap: .6rem; }
    .site-nav[data-open="true"] { display: flex; }
    .hero { grid-template-columns: 1fr; min-height: auto; }
    .bearing-map { width: min(95%, 28rem); margin: 2rem auto 1rem; }
    .boundary, .chapter-head, .site-footer, .route li, .product-page { grid-template-columns: 1fr; }
    .book-card { grid-template-columns: 1fr; }
    .book-card:nth-of-type(even) .cover { order: initial; }
    .cover { max-width: 19rem; }
    .site-footer__notice, .breadcrumb { grid-column: 1; }
  }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
  @media (forced-colors: active) { .cover, .bearing-map, .boundary, .retailer-panel { border: 2px solid CanvasText; } }
}
