/* Cinema Storage Field Guides (v0.4) — jmforu dark-green editorial.
   Tokens: #111914 / #1b2820 / #f2eee1 / #d4ff88; light paper #f3efe6.
   Internal stylesheet name is historical (folio.css). No purple gradients. */

:root,
html[data-theme="dark"] {
  --bg: #111914;
  --surface: #1b2820;
  --ink: #f2eee1;
  --accent: #d4ff88;
  --ink-soft: #c6c1b2;
  --rule: #2c3c33;
  --danger: #f0c7a4;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Times New Roman", Georgia, serif;
  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --measure: 40rem;
  --page: 72rem;
  --size: 1.0625rem;
  --leading: 1.62;
  --nav-h: 48px;
  --shelf-tools-h: 44px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f3efe6;
  --surface: #e7e1d3;
  --ink: #171512;
  --accent: #1b2820;
  --ink-soft: #4a453c;
  --rule: #c9c2b0;
  --danger: #8a3d16;
  color-scheme: light;
}

html[data-font="sans"] body.is-reader .article,
html[data-font="sans"] body.is-reader .article-head h1,
html[data-font="sans"] body.is-reader .subhead {
  font-family: var(--font-sans);
}

html[data-size="s"] { --size: 0.9375rem; }
html[data-size="m"] { --size: 1.0625rem; }
html[data-size="l"] { --size: 1.25rem; }

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
}

img, svg { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
html[data-theme="light"] a { color: #21543c; }
a:hover { opacity: 0.85; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3.5rem;
  background: var(--accent);
  color: #111914;
  padding: 0.3rem 0.6rem;
  z-index: 30;
  text-decoration: none;
  font-size: 0.85rem;
}
.skip-link:focus { top: 0.4rem; }

.site-header,
.shelf-toolbar,
.toolbar-inner,
.page-reader,
.page-legal,
.page-missing,
.page-reserved,
.site-footer {
  width: min(var(--page), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--ink); opacity: 1; }
.folio-mark { color: var(--accent); flex: 0 0 auto; }

.brand-full, .brand-short { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-short { display: none; }
.brand-note { display: none; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 0 1 auto;
  min-width: 0;
}

.theme-toggle {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  height: 28px;
  padding: 0 0.55rem;
  cursor: pointer;
  white-space: nowrap;
}
.theme-toggle:hover { color: var(--ink); }

.lang-switch {
  font-size: 0.75rem;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.28rem;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}
.lang-switch a,
.lang-switch span.lang-reserved {
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.lang-switch a:hover,
.lang-switch a[aria-current="page"] { color: var(--ink); }
.lang-switch a[aria-current="page"] { box-shadow: inset 0 -1px 0 var(--accent); }
.lang-sep { color: var(--rule); }
.lang-reserved {
  opacity: 0.55;
  cursor: pointer;
}
.lang-reserved:hover { opacity: 0.9; color: var(--ink); }
.lang-reserved[aria-disabled="true"] { cursor: default; }

/* Shelf: grid visible within ~100px at 1440 (48px nav + 44px tools) */
.page-shelf { padding: 0 0 3rem; }
.shelf-toolbar {
  height: var(--shelf-tools-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--rule);
}
.shelf-toolbar h1 {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
  max-width: none;
  line-height: 1;
  white-space: nowrap;
}
.sample-inline {
  color: var(--danger);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.shelf-filters {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}
.shelf-filters legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.filter-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.15rem 0.5rem;
  height: 28px;
  cursor: pointer;
}
.filter-btn.is-active,
.filter-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #111914;
  border-color: var(--accent);
}
html[data-theme="light"] .filter-btn.is-active,
html[data-theme="light"] .filter-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #f3efe6;
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem 1rem;
  padding-top: 1rem;
  width: min(var(--page), calc(100% - 2rem));
  margin-inline: auto;
}

.shelf-card { min-width: 0; }
.shelf-link { color: inherit; text-decoration: none; display: block; }
.shelf-link:hover { color: inherit; opacity: 1; }
.shelf-link:hover h2 { color: var(--accent); }
html[data-theme="light"] .shelf-link:hover h2 { color: #21543c; }

.cover-frame {
  aspect-ratio: 3 / 4;
  background: var(--surface);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.cover-print { width: 100%; height: 100%; }

.shelf-card h2 {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.3;
  font-weight: 600;
  margin: 0.55rem 0 0.15rem;
  max-width: none;
}
.card-sub { margin: 0; font-size: 0.8rem; color: var(--ink-soft); }
.card-meta {
  margin: 0.3rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.sample-flag { color: var(--danger); }

/* Reader */
.is-reader { padding-bottom: 2rem; }

.reader-toolbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 8;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.progress { display: block; height: 2px; width: 100%; background: transparent; }
.progress-bar { display: block; height: 2px; width: 0%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .progress-bar { transition: width 80ms linear; }
}

.toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.3rem 0;
  min-height: 36px;
}
.back-link { font-size: 0.78rem; color: var(--ink-soft); text-decoration: none; }
.back-link:hover { color: var(--ink); }

.reader-controls { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; }
.reader-controls fieldset {
  border: 0; margin: 0; padding: 0;
  display: flex; gap: 0.15rem; align-items: center;
}
.reader-controls legend {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0;
  margin-right: 0.3rem;
}
.reader-controls button {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  padding: 0.12rem 0.4rem;
  cursor: pointer;
}
.reader-controls button[aria-pressed="true"] {
  border-color: var(--rule);
  color: var(--accent);
}
html[data-theme="light"] .reader-controls button[aria-pressed="true"] { color: #21543c; }

.page-reader { padding-top: 1.5rem; }
.article-head { margin-bottom: 1.25rem; max-width: var(--measure); }
.article-head h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.2;
  margin: 0;
  max-width: 22ch;
}
.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.45rem;
}
html[data-theme="light"] .kicker { color: #21543c; }
.subhead { font-size: 1rem; color: var(--ink-soft); margin: 0.5rem 0 0; max-width: 32rem; }
.demo-badge { font-size: 0.75rem; color: var(--danger); margin: 0.5rem 0 0; }
.article-meta { font-size: 0.78rem; color: var(--ink-soft); margin: 0.7rem 0 0; }
.disclaimer {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0.75rem 0 0;
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--rule);
  max-width: 40rem;
}
.unlock-live-test {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--accent);
  color: #111914 !important;
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 0.55rem 0.9rem;
}
html[data-theme="light"] .unlock-live-test {
  background: var(--accent);
  color: #f3efe6 !important;
}
.unlock-live-note {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0.45rem 0 0.35rem;
}

.related-tool {
  max-width: var(--measure);
  margin: 0 0 1.4rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.related-tool p { margin: 0; }
.related-tool a { font-weight: 600; }

.toc {
  max-width: var(--measure);
  margin: 0 0 1.5rem;
  padding-block: 0.85rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.toc-title {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  margin: 0 0 0.4rem;
  color: var(--ink-soft);
}
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li { margin: 0.15rem 0; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); }
html[data-theme="light"] .toc a:hover { color: #21543c; }
.toc-d3 { padding-left: 1rem; font-size: 0.95em; }
.toc-note { font-size: 0.75rem; color: var(--ink-soft); margin: 0.55rem 0 0; }

.article {
  max-width: var(--measure);
  font-family: var(--font-serif);
  font-size: var(--size);
  line-height: var(--leading);
}
.article h2 {
  font-size: 1.2em;
  line-height: 1.3;
  margin: 1.7em 0 0.6em;
  font-weight: 600;
  max-width: none;
}
.article h3 { font-size: 1.05em; margin: 1.4em 0 0.45em; font-weight: 600; }
.article p { margin: 0 0 0.9em; }
.article p:last-child { margin-bottom: 0; }

.table-scroll {
  overflow-x: auto;
  margin: 1em 0 1.2em;
  border: 1px solid var(--rule);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.article table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.86em;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.article th,
.article td {
  padding: 0.38em 0.7em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.article th { font-weight: 600; color: var(--ink-soft); font-size: 0.78em; letter-spacing: 0.04em; text-transform: uppercase; }
.article tr:last-child th,
.article tr:last-child td { border-bottom: 0; }
.article td.num,
.article th.num {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}

.checklist {
  list-style: none;
  margin: 0.8em 0 1.2em;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--surface);
}
.checklist li {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.92em;
}
.checklist li:last-child { border-bottom: 0; }
.check-input {
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.article-free { position: relative; }
.paywall { position: relative; margin-top: 0.5rem; }
.preview-fade {
  height: 7rem;
  margin-top: -7rem;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.unlock-card {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.4rem 0 1.3rem;
  background: var(--bg);
}
.unlock-card h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
  max-width: 18ch;
}
.unlock-card p { margin: 0 0 0.7rem; color: var(--ink-soft); font-family: var(--font-sans); font-size: 0.92rem; }
.price-label { color: var(--ink); font-size: 1rem; }
.price-note { font-size: 0.8rem; color: var(--ink-soft); }

.unlock-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem; margin: 0.9rem 0 0.4rem; }
.unlock-form button,
.unlock-form-link button {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  background: var(--accent);
  color: #111914;
  border: 1px solid var(--accent);
  padding: 0.48rem 0.85rem;
  cursor: pointer;
}
html[data-theme="light"] .unlock-form button,
html[data-theme="light"] .unlock-form-link button {
  background: var(--accent);
  color: #f3efe6;
  border-color: var(--accent);
}
.unlock-form-link button { background: transparent; color: var(--ink); border-color: var(--rule); }
html[data-theme="light"] .unlock-form-link button { color: var(--ink); background: transparent; }
.unlock-form button:hover, .unlock-form-link button:hover { opacity: 0.9; }
.unlock-note { font-size: 0.76rem; margin-top: 0.7rem; }
.alipay-pending { font-size: 0.76rem; color: var(--ink-soft); margin: 0.35rem 0 0; }

.article-paid[hidden] { display: none; }
.article-paid { margin-top: 1.4rem; }
.article.is-unlocked .paywall { display: none; }

.page-legal, .page-missing, .page-reserved { padding: 1.75rem 0 3rem; max-width: var(--measure); margin-left: auto; margin-right: auto; }
.page-legal h1, .page-missing h1, .page-reserved h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.2;
  margin: 0 0 0.9rem;
  max-width: 18ch;
}
.page-legal h2 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; }
.page-legal p, .page-missing p, .page-reserved p { color: var(--ink); }
.page-legal p + p { margin-top: 0.8rem; }
.legal-meta { color: var(--ink-soft); font-size: 0.82rem; }

.site-footer {
  margin-top: 3rem;
  padding: 1.1rem 0 2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.65rem;
}
.footer-nav a { color: var(--ink-soft); text-decoration: none; }
.footer-nav a:hover { color: var(--ink); }
.site-footer p { margin: 0 0 0.35rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 72rem) {
  .shelf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 52rem) {
  .site-header,
  .shelf-toolbar,
  .toolbar-inner,
  .page-reader,
  .page-legal,
  .page-missing,
  .page-reserved,
  .site-footer,
  .shelf-grid {
    width: min(var(--page), calc(100% - 1.25rem));
  }
  .brand-full { display: none; }
  .brand-short { display: inline; }
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader-controls legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

@media (max-width: 28rem) {
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 0.7rem; }
  .theme-toggle .theme-long { display: none; }
  .lang-switch { font-size: 0.68rem; gap: 0.2rem; }
  .shelf-toolbar h1 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .progress-bar { transition: none; }
}

@media print {
  .site-header, .reader-toolbar, .paywall, .lang-switch, .skip-link, .theme-toggle { display: none !important; }
  body { background: white; color: black; }
  .article { max-width: none; }
}
