/*
 * GPW theme editor hooks. Load after retro.css/editorial.css/gallery.css, then
 * load theme-custom.css last. The latter only needs a :root token override.
 * Colors: --paper, --surface, --ink, --muted, --red, --teal, --gold, --line.
 * Font stacks: --body (UI/reading), --display (editorial headings).
 * Lengths: --radius (px), --gpw-max-width (px), --gpw-text-size (px).
 * Unitless: --gpw-line-height, --gpw-heading-scale, --gpw-spacing.
 * Suggested editor ranges: radius 0–24; width 960–1600; text 14–24;
 * line height 1.4–2.2; heading scale .8–1.3; spacing .75–1.5.
 * Logo lettering, imported inline formatting and the dark lightbox palette
 * remain independent. Print retains the existing white/black paper treatment.
 */
:root {
  --paper: #f5f0e5;
  --surface: #fffcf5;
  --ink: #172e32;
  --muted: #576668;
  --red: #ae3d2c;
  --teal: #236568;
  --gold: #dfac44;
  --line: #cecbbc;
  --body: Arial, Helvetica, sans-serif;
  --display: Georgia, 'Times New Roman', serif;
  --radius: 3px;
  --gpw-max-width: 1280px;
  --gpw-text-size: 17px;
  --gpw-line-height: 1.8;
  --gpw-heading-scale: 1;
  --gpw-spacing: 1;
  --space: calc(clamp(1rem, 2.5vw, 2rem) * var(--gpw-spacing));
}

/* Override hard-coded font stacks without replacing weights or line heights. */
body, .gpw-picture-page,
.gpw-editorial-kicker, .gpw-editorial-meta, .gpw-editorial-label,
.gpw-editorial-tabs > a, .gpw-editorial-placeholder small,
.gpw-reader-pages a, .gpw-reader-pages span,
.gpw-editorial-form button, .gpw-editorial-action, .gpw-score-missing,
.gpw-gallery-path, .gpw-gallery-meta, .gpw-gallery-hint, .gpw-gallery-details,
.gpw-gallery-heading .gpw-kicker, .gpw-gallery-description,
.gpw-gallery-placeholder, .gpw-gallery-excerpt, .gpw-gallery-badge,
.gpw-gallery-expand, .gpw-gallery-caption, .gpw-gallery-choose label,
.gpw-gallery-choose select, .gpw-gallery-choose button,
.gpw-gallery-picture-nav a, .gpw-gallery-empty,
.gpw-lightbox-header h2, .gpw-lightbox-counter, .gpw-lightbox button,
.gpw-lightbox-status, .gpw-lightbox-caption, .gpw-lightbox-detail,
#gpw-lightbox-help { font-family: var(--body); }

.gpw-editorial-heading h1, .gpw-editorial-summary h2,
.gpw-editorial-placeholder, .gpw-review-copy h3, .gpw-reader-page-title,
.gpw-editorial-related h2, .gpw-reader-media h2, .gpw-review-verdict h2,
.gpw-review-score dd, .gpw-product-layout > article > h2,
.gpw-product-info h2, .gpw-product-row h2, .gpw-search-results h2,
.gpw-search-results h3, .gpw-archive-months h2, .gpw-picture-page h1,
.gpw-gallery-heading h1, .gpw-gallery-cardbody h2, .gpw-gallery-cardbody h3,
.gpw-gallery-subsection > h2, .gpw-gallery-empty h2,
.gpw-gallery-feedback h2 { font-family: var(--display); }

/* Preserve each heading's original responsive proportions. */
h1 { font-size: calc(clamp(2rem, 4.4vw, 3.7rem) * var(--gpw-heading-scale)); }
h2 { font-size: calc(clamp(1.6rem, 2.8vw, 2.4rem) * var(--gpw-heading-scale)); }
h3 { font-size: calc(1.3rem * var(--gpw-heading-scale)); }
.gpw-cover-copy h1 { font-size: calc(clamp(2.3rem, 4.2vw, 3.9rem) * var(--gpw-heading-scale)); }
.gpw-news-card h2 { font-size: calc(clamp(1.45rem, 2.3vw, 2rem) * var(--gpw-heading-scale)); }
.gpw-ticker h3 { font-size: calc(1.05rem * var(--gpw-heading-scale)); }
.gpw-note h3 { font-size: calc(1.75rem * var(--gpw-heading-scale)); }
.gpw-filter h2 { font-size: calc(1.35rem * var(--gpw-heading-scale)); }
.gpw-asidebox h2 { font-size: calc(1.5rem * var(--gpw-heading-scale)); }
.gpw-editorial-heading h1 { font-size: calc(clamp(2.1rem, 5vw, 4.25rem) * var(--gpw-heading-scale)); }
.gpw-editorial-summary h2 { font-size: calc(clamp(1.25rem, 2.5vw, 1.9rem) * var(--gpw-heading-scale)); }
.gpw-review-copy h3 { font-size: calc(1.25rem * var(--gpw-heading-scale)); }
.gpw-reader-page-title { font-size: calc(1.7rem * var(--gpw-heading-scale)); }
.gpw-review-verdict h2 { font-size: calc(2.4rem * var(--gpw-heading-scale)); }
.gpw-review-balance h3 { font-size: calc(1rem * var(--gpw-heading-scale)); }
.gpw-product-info h2 { font-size: calc(1.5rem * var(--gpw-heading-scale)); }
.gpw-product-row h2 { font-size: calc(1.25rem * var(--gpw-heading-scale)); }
.gpw-picture-page h1 { font-size: calc(clamp(1.6rem, 4vw, 3rem) * var(--gpw-heading-scale)); }
.gpw-gallery-heading h1 { font-size: calc(clamp(2.15rem, 5vw, 4.3rem) * var(--gpw-heading-scale)); }
.gpw-gallery-cardbody h2, .gpw-gallery-cardbody h3 { font-size: calc(clamp(1rem, 2vw, 1.4rem) * var(--gpw-heading-scale)); }
.gpw-gallery-subsection > h2, .gpw-gallery-empty h2,
.gpw-gallery-feedback h2 { font-size: calc(1.4rem * var(--gpw-heading-scale)); }

/* Reading controls leave compact navigation and metadata sizes intact. */
.gpw-prose, .gpw-legacy { font-size: var(--gpw-text-size); line-height: var(--gpw-line-height); }
.gpw-reader .gpw-prose { font-size: calc(var(--gpw-text-size) * .997647); line-height: calc(var(--gpw-line-height) + .05); }
.gpw-gallery-description { font-size: calc(var(--gpw-text-size) * .941176); line-height: var(--gpw-line-height); }

/* Existing panels derive from the chosen paper/ink instead of fixed greens. */
body, .gpw-picture-page { background: var(--paper); color: var(--ink); }
.gpw-editorial-meta, .gpw-editorial-links > li > span,
.gpw-editorial-links small, .gpw-gallery-meta, .gpw-gallery-hint { color: var(--muted); }
.gpw-picture-back { color: var(--teal); }
.gpw-filter, .footer { background: color-mix(in srgb, var(--paper) 95%, var(--ink)); }
.gpw-reader-index, .gpw-review-verdict, .gpw-product-sidebar,
.gpw-product-info, .gpw-editorial-form, .gpw-editorial-empty {
  background: color-mix(in srgb, var(--paper) 93%, var(--teal));
}
.gpw-review-balance > div { background: var(--paper); }
.gpw-editorial-cover, .gpw-article-pictures img, .gpw-product-thumb,
.gpw-gallery-cover { background: color-mix(in srgb, var(--paper) 87%, var(--teal)); }
.gpw-review-image, .gpw-news-thumb, .gpw-gallery-mini img,
.gpw-gallery-mini-placeholder, .gpw-image-missing:before {
  background: color-mix(in srgb, var(--paper) 90%, var(--ink));
}
.gpw-editorial-placeholder { color: var(--paper); }
.gpw-gallery-page { --gallery-line: color-mix(in srgb, var(--ink) 20%, transparent); }
.gpw-gallery-collection, .gpw-gallery-picture-nav a {
  background: color-mix(in srgb, var(--surface) 65%, var(--paper));
}
.gpw-gallery-picture-nav a:hover { background: var(--gold); }
.gpw-gallery-image, .gpw-gallery-detail-image { background: var(--ink); }
.gpw-gallery-placeholder {
  background: repeating-linear-gradient(135deg, transparent, transparent 12px,
    color-mix(in srgb, var(--ink) 6%, transparent) 12px,
    color-mix(in srgb, var(--ink) 6%, transparent) 13px);
}
.gpw-editorial-tabs > a, .gpw-editorial-filter,
.gpw-editorial-card, .gpw-reader-pages, .gpw-reader-footer,
.gpw-editorial-facts > div, .gpw-product-row, .gpw-editorial-links > li,
.gpw-editorial-form, .gpw-editorial-form fieldset, .gpw-archive-months > a {
  border-color: var(--line);
}
.gpw-editorial-tabs > a:hover { background: color-mix(in srgb, var(--paper) 90%, var(--teal)); }
.gpw-editorial-tabs > a[aria-current=page]:hover { background: var(--teal); }
.gpw-editorial-facts .gpw-review-score { border-top-color: var(--ink); }

input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=image]),
textarea, select, .gpw-editorial-form input[type=search],
.gpw-editorial-form input[type=number], .gpw-editorial-form select {
  border-color: color-mix(in srgb, var(--ink) 50%, var(--paper));
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
}
.gpw-editorial-form input[type=checkbox], .gpw-editorial-form input[type=radio] { accent-color: var(--teal); }
.gpw-editorial-form button, .gpw-editorial-action { color: var(--surface); }
.gpw-editorial-tabs > a, .gpw-editorial-cover, .gpw-review-image,
.gpw-editorial-form button, .gpw-editorial-action { border-radius: var(--radius); }
.gpw-label, .gpw-editorial-label, .gpw-reader-pages a,
.gpw-archive-months > a { border-radius: max(0px, calc(var(--radius) - 1px)); }
.gpw-reader a:focus-visible, .gpw-reader-pages a:focus-visible,
.gpw-editorial-form :focus-visible, .gpw-picture-page :focus-visible,
.gpw-editorial-tabs :focus-visible { outline-color: var(--red); }
.gpw-cover-copy p, .gpw-footer p, .gpw-footerbase a {
  color: color-mix(in srgb, var(--paper) 87%, var(--ink));
}
.gpw-footerbase { border-color: color-mix(in srgb, var(--ink) 75%, var(--paper)); }
.error { background: color-mix(in srgb, var(--paper) 90%, var(--red)); }

/* Scale rhythm at component boundaries, preserving minimum touch targets. */
.gpw-home-columns, .gpw-product-layout { gap: calc(2rem * var(--gpw-spacing)); }
.gpw-news-layout { gap: calc(1.5rem * var(--gpw-spacing)); }
.gpw-reading-layout { gap: calc(2.5rem * var(--gpw-spacing)); }
.gpw-editorial-heading { margin-bottom: calc(2rem * var(--gpw-spacing)); padding-bottom: calc(1.5rem * var(--gpw-spacing)); }
.gpw-news-card { padding-block: calc(1.35rem * var(--gpw-spacing)); }
.gpw-editorial-card { padding-block: calc(1.5rem * var(--gpw-spacing)); }
.gpw-ticker li { padding-block: calc(1rem * var(--gpw-spacing)); }
.gpw-editorial-form { padding: calc(clamp(1rem, 3vw, 2rem) * var(--gpw-spacing)); }
.gpw-review-verdict { padding: calc(clamp(1rem, 4vw, 2.5rem) * var(--gpw-spacing)); }
.gpw-cover-copy { padding: calc(1.35rem * var(--gpw-spacing)); }
.gpw-gallery-grid { row-gap: calc(1.5rem * var(--gpw-spacing)); }
.gpw-reader .gpw-prose p { margin-bottom: calc(1.25em * var(--gpw-spacing)); }
.gpw-prose p { margin-bottom: calc(1.3em * var(--gpw-spacing)); }

@media screen {
  .gpw-wrap { width: min(var(--gpw-max-width), calc(100% - 32px)); }
  .gpw-picture-page main { max-width: calc(var(--gpw-max-width) - 80px); }
}
@media screen and (max-width:599px) {
  .gpw-prose { font-size: calc(var(--gpw-text-size) * .941176); }
}
@media screen and (min-width:600px) {
  .gpw-wrap { width: min(var(--gpw-max-width), calc(100% - 64px)); }
}
@media (min-width:600px) {
  .gpw-product-row h2 { font-size: calc(1.5rem * var(--gpw-heading-scale)); }
  .gpw-cover-copy { padding: calc(2rem * var(--gpw-spacing)); }
}
@media (min-width:1000px) {
  .gpw-home-columns, .gpw-product-layout { gap: calc(3rem * var(--gpw-spacing)); }
  .gpw-news-layout { gap: calc(2.5rem * var(--gpw-spacing)); }
  .gpw-cover-copy { padding: calc(2.5rem * var(--gpw-spacing)); }
}
@media (max-width:479px) {
  .gpw-gallery-grid { row-gap: calc(1rem * var(--gpw-spacing)); }
}
@media print {
  body, .gpw-picture-page { background: #fff; color: #000; }
}
