/* make.html shell in the "Field Map" look (SITE_REDESIGN.md §11; site critic R1 fix 1).
   Screen only and scoped to the generator's chrome: worksheet rules in styles.css are untouched, and nothing
   here applies when a sheet is printed or rendered to PDF (render-library and check-page-fill use print media).
   The worksheet itself (.worksheet-page and everything in it) is never restyled here, only the stage it sits on. */
@media screen {
  body { background: var(--pp-ground); color: var(--pp-ink); }
  /* The generator chrome reads the site tokens; the worksheet preview keeps its own --ink and --line. */
  .subject-nav, .topbar, .landing-view, .panel-strip, .placeholder-view, .downloads-heading {
    --ink: var(--pp-ink); --muted: var(--pp-muted); --line: var(--pp-line); --panel: var(--pp-ground);
    --accent: var(--pp-ink); --accent-dark: var(--pp-ink); --shadow: none;
    font-family: var(--pp-sans);
  }

  /* header: the same 1240 container and the same items as the library, so moving between the two never jumps */
  .pp-hdr.pp-sticky { position: sticky; top: 0; z-index: 30; }
  .pp-hdr.pp-sticky .pp-hrow { flex-wrap: nowrap; max-width: var(--pp-wrap); min-height: 68px; height: 68px; margin: 0 auto; padding: 0 var(--pp-gut); }
  .pp-hdr svg { stroke-width: inherit; }
  .pp-logo .pp-mark { width: 30px; height: 36px; }
  .pp-logo .pp-shim { width: 116%; height: 7px; } /* styles.css sizes every svg 22px; the wordmark wave keeps its own box */
  .pp-navlink .pp-chev { width: 11px; height: 11px; stroke-width: 2; }

  /* section rail: light ground, ink, ruled; sits under the header */
  .subject-nav { top: 69px; color: var(--pp-ink); background: var(--pp-ground); border-right: var(--pp-rule); }
  .brand-mark { display: none; }
  .install-nav-item { display: none !important; } /* its icon duplicated Downloads (critic R1) */
  .nav-item { color: var(--pp-ink); border-radius: 0; font-weight: 700; }
  .nav-item:hover, .nav-item:focus-visible { color: var(--pp-ink); background: #FBF7EC; outline: 2px solid var(--pp-ink); outline-offset: -2px; }
  .nav-item.active { color: var(--pp-ground); background: var(--pp-ink); }

  .workspace { min-width: 0; }
  .topbar { max-width: none; }
  .topbar h1 { color: var(--pp-ink); font-family: var(--pp-display); font-weight: 800; letter-spacing: -.02em; }
  .home-link { color: var(--pp-ink); text-decoration: underline; }
  .eyebrow { color: var(--pp-muted); letter-spacing: .11em; }
  .panel-strip h2, .panel-strip h3, .placeholder-view h2, .downloads-heading h2 { color: var(--pp-ink); }

  /* tool panels: square, ruled, on the ground, no shadow (only paper casts a shadow) */
  .controls-panel, .tips-panel, .placeholder-view { border: var(--pp-rule); border-radius: 0; background: var(--pp-ground); box-shadow: none; }
  .tips-panel p, .placeholder-view p { color: var(--pp-ink); }
  .panel-strip label span, .panel-strip legend { color: var(--pp-ink); }
  .panel-strip input, .panel-strip select { border: var(--pp-rule); border-radius: 0; background-color: var(--pp-paper); color: var(--pp-ink); }
  .panel-strip input[type=checkbox], .panel-strip input[type=radio] { accent-color: var(--pp-ink); }
  .panel-strip input:focus, .panel-strip select:focus { border-color: var(--pp-ink); outline: 3px solid var(--pp-ink); outline-offset: 2px; }
  .panel-strip fieldset { border: 1.5px solid var(--pp-line); border-radius: 0; }

  /* page status: a dashed, ticked label instead of the mint box */
  .page-status { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1.5px dashed var(--pp-ink); border-radius: 0; background: var(--pp-paper); color: var(--pp-ink); font-weight: 700; }
  .page-status::before { content: ""; flex: none; width: 15px; height: 12px; margin-top: 4px; background: var(--pp-tick-ink) no-repeat; }
  .page-status.warning { border-style: solid; background: var(--pp-canola); color: var(--pp-ink); }
  .page-status.warning::before { content: "!"; width: auto; height: auto; margin-top: 0; background: none; font-weight: 800; }

  /* the preview stage is a field in the chosen subject's colour; the sheet keeps the only shadow */
  .worksheet-stage { border: var(--pp-rule); border-radius: 0; background: url("images/site/hatch-math-stage.svg") center / cover no-repeat, var(--pp-math-field-2); }
  #english .worksheet-stage, #somali .worksheet-stage { background: url("images/site/hatch-english-stage.svg") center / cover no-repeat, var(--pp-eng-field-2); }

  /* landing: ground panel with a rule (sky stays for the header and the library hero), plain badges, ruled tiles */
  .landing-curves { display: none; }
  .landing-shell { min-height: 0; background: var(--pp-ground); border: var(--pp-rule); border-radius: 0; box-shadow: none; }
  .landing-content h2 { font-family: var(--pp-display); font-weight: 800; letter-spacing: -.02em; color: var(--pp-ink); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.04; }
  .landing-lede { color: var(--pp-ink); }
  .landing-badges span { min-height: 30px; border: var(--pp-rule); border-radius: 0; background: var(--pp-paper); color: var(--pp-ink); font-weight: 600; }
  .landing-badges .tick::before { content: ""; display: inline-block; width: 15px; height: 12px; margin-right: 6px; background: var(--pp-tick-red) no-repeat; }
  .quick-access { gap: 0; border-top: var(--pp-rule); border-left: var(--pp-rule); }
  .quick-card, .quick-card[class*=accent-] { border: 0; border-right: var(--pp-rule); border-bottom: var(--pp-rule); border-radius: 0; background: var(--pp-ground); box-shadow: none; color: var(--pp-ink); }
  .quick-card > span:last-child { color: var(--pp-muted); }
  .quick-card:hover, .quick-card:focus-visible { position: relative; z-index: 1; background: #FBF7EC; outline: 3px solid var(--pp-ink); outline-offset: -4px; transform: none; }
  .quick-card .quick-icon, .quick-card[class*=accent-] .quick-icon { border-radius: 0; border: var(--pp-rule); background: var(--pp-paper); color: var(--pp-ink); }

  /* buttons */
  .primary-button, .secondary-button, .ghost-button, .icon-button, .primary-icon-button { border-radius: 0; font-family: var(--pp-sans); font-weight: 700; }
  .primary-button, .primary-icon-button { color: var(--pp-ink); border: var(--pp-rule); background: var(--pp-canola); box-shadow: 3px 3px 0 var(--pp-ink); }
  .primary-button:hover, .primary-icon-button:hover { background: var(--pp-canola); transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--pp-ink); }
  .secondary-button, .ghost-button, .icon-button { color: var(--pp-ink); border: var(--pp-rule); background: var(--pp-paper); }
  .secondary-button:hover, .ghost-button:hover, .icon-button:hover { border-color: var(--pp-ink); background: #FBF7EC; }
  .primary-button:focus-visible, .secondary-button:focus-visible, .ghost-button:focus-visible, .icon-button:focus-visible, .primary-icon-button:focus-visible { outline: 3px solid var(--pp-ink); outline-offset: 2px; }

  /* narrow screens: the sheet scales to the stage (site-chrome.js sets --pp-fit) instead of overflowing the page */
  .worksheet-stage { overflow: auto; }
  .worksheet-preview { zoom: var(--pp-fit, 1); }

  /* ---------- site critic R2 fix 5 ---------- */
  /* (a) the section rail shows its labels and scrolls with the page (sticky, not fixed), so the shared footer sits
     under the whole page; under 760px it becomes a horizontal tab row instead of a 64px column. */
  .app-shell { align-items: flex-start; min-height: calc(100vh - 69px); }
  .subject-nav, .subject-nav:hover, .subject-nav:focus-within, .subject-nav.nav-dismissed {
    position: sticky; inset: auto; top: 69px; flex: none; width: 176px; height: calc(100vh - 69px); padding: 18px 10px; transition: none;
  }
  .subject-nav .nav-item { gap: 12px; padding: 0 12px; }
  .subject-nav .nav-item span { opacity: 1; transform: none; transition: none; }
  .workspace { margin-left: 0; }
  /* (c) Book Builder chrome text on the site's muted ink (the book pages keep their own colours) */
  .book-toolbar, .book-sidebar, .book-preview-heading, .book-print-tip { --muted: var(--pp-muted); }
  /* Book Builder and Readers chrome on the site look (consistency, site critic R2): square ruled panels, paper buttons,
     canola primary, ink focus. Only the tool chrome; the book and reader pages in the preview keep their own styles. */
  .book-panel, .reader-panel { border: var(--pp-rule); border-radius: 0; background: var(--pp-paper); box-shadow: none; }
  #books button, .reader-actions button, .reader-panel button, .reader-tab, .reader-download a {
    border: var(--pp-rule); border-radius: 0; background: var(--pp-paper); color: var(--pp-ink); font-family: var(--pp-sans); font-weight: 700;
  }
  #books button:hover, .reader-actions button:hover, .reader-panel button:hover, .reader-tab:hover { background: #FBF7EC; border-color: var(--pp-ink); }
  #books button.book-primary, .reader-actions .reader-primary, .reader-panel .reader-primary {
    background: var(--pp-canola); border-color: var(--pp-ink); color: var(--pp-ink); box-shadow: 3px 3px 0 var(--pp-ink);
  }
  .reader-tab[aria-selected=true] { background: var(--pp-ink); border-color: var(--pp-ink); color: var(--pp-ground); }
  #books .book-outline-select, #books .book-move { border: 0; background: transparent; box-shadow: none; }
  .book-outline-row { border-radius: 0; }
  .book-outline-row.selected { background: #FBF7EC; border-color: var(--pp-ink); }
  .book-panel input:not([type=checkbox]), .book-panel select, .book-panel textarea,
  .reader-panel input:not([type=checkbox]), .reader-panel select, .reader-panel textarea { border: var(--pp-rule); border-radius: 0; color: var(--pp-ink); }
  .book-panel input[type=checkbox], .reader-panel input[type=checkbox] { accent-color: var(--pp-ink); }
  #books button:focus-visible, #books a:focus-visible, .reader-actions button:focus-visible, .reader-panel button:focus-visible,
  .reader-tab:focus-visible, .reader-panel a:focus-visible, .reader-download a:focus-visible { outline: 3px solid var(--pp-ink); outline-offset: 2px; }
  .book-live-badge { border: 1.5px dashed var(--pp-ink); border-radius: 0; background: var(--pp-paper); color: var(--pp-ink); font-size: 12px; }
  .book-toolbar h2, .reader-heading h2 { font-family: var(--pp-display); font-weight: 800; letter-spacing: -.02em; color: var(--pp-ink); }
  .reader-heading p, .reader-muted, .reader-sheet-label { color: var(--pp-muted); }
  .reader-panel a { color: var(--pp-ink); }
  /* sections that carry their own title show it once: the page h1 stays for screen readers only */
  body[data-own-heading] .topbar h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* (e) the landing is no longer a large near-empty frame */
  .landing-shell { border: 0; padding: 8px 0 0; min-height: 0; }
  /* focus rings that a clipping parent would cut (keyboard walk-through, site critic R2) */
  .download-cover:focus-visible { outline: 3px solid var(--pp-ink); outline-offset: -5px; }
  .subject-nav .nav-item:focus-visible { outline: 3px solid var(--pp-ink); outline-offset: -4px; }
  .subject-nav .nav-item.active:focus-visible { outline-color: var(--pp-canola); }
  /* fix 2: a deep link (make.html#math) opens at the top of the page, not under the sticky header */
  .section-view { scroll-margin-top: 400px; }

  @media (max-width: 1023px) {
    .subject-nav, .subject-nav:hover, .subject-nav:focus-within, .subject-nav.nav-dismissed { width: 148px; }
  }
  @media (max-width: 760px) {
    .app-shell { display: block; }
    .subject-nav, .subject-nav:hover, .subject-nav:focus-within, .subject-nav.nav-dismissed {
      position: relative; top: auto; width: auto; height: auto; padding: 0; overflow-x: auto; overscroll-behavior-x: contain;
      border-right: 0; border-bottom: var(--pp-rule); scrollbar-width: thin; scroll-padding-inline: 16px;
    }
    .subject-nav nav { display: flex; padding: 0 var(--pp-gut); }
    .subject-nav .nav-item { flex: none; width: auto; min-height: 48px; margin: 0; padding: 0 12px; gap: 8px; }
    .subject-nav .nav-item svg { width: 18px; height: 18px; }
    .workspace { margin-left: 0; }
  }

  @media (max-width: 1023px) {
    .pp-hdr.pp-sticky .pp-nav { display: none; }
    .pp-hdr.pp-sticky .pp-nav.open { position: fixed; top: 68px; left: 0; right: 0; display: block; background: var(--pp-ground); border-bottom: var(--pp-rule); }
    .pp-hdr.pp-sticky .pp-navlist { flex-direction: column; padding: 4px var(--pp-gut) 12px; }
    .pp-hdr.pp-sticky .pp-navlink { min-height: 48px; font-size: 17px; }
    .pp-hdr.pp-sticky .pp-navlink .pp-chev { display: none; }
  }
  @media (max-width: 720px) {
    .pp-hdr.pp-sticky .pp-search { display: none; }
    .quick-access { grid-template-columns: minmax(0, 1fr); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .primary-button:hover, .primary-icon-button:hover { transform: none; }
}

/* ---------- site critic R3 fix 4 (screen only; the worksheet and print are untouched) ---------- */
@media screen {
  /* the main column ends where the header's 1240 container ends (padding % is of the shell's width, so this tracks
     the header's margin:auto exactly, scrollbar or not) */
  @media (min-width: 1249px) { .workspace { padding-right: calc(50% - var(--pp-wrap) / 2 + var(--pp-gut)); } }
  .quick-access { max-width: none; }
  /* titles line up: each tile's rows start at the top instead of stretching to the tallest tile */
  .quick-card { align-content: start; }
  /* seven tiles: 4 + 3 at desktop, 2 + 2 + 2 + 1 between; the last tile spans the gap so every row closes */
  @media (min-width: 721px) { .quick-card[data-section=downloads] { grid-column: span 2; } }
}
