:root {
  /* Cinema / darkroom base -- near-black with a warm, wet-ink undertone
     (developing tray, not a construction site). No hue-shift into green. */
  --void: #0A0906;
  --void-800: #14100A;
  --void-700: #1B160E;
  --void-600: #241D12;
  --void-500: #362B18;
  --hairline: rgba(224, 204, 150, 0.09);

  /* Film-yellow: a desaturated, aged brass/amber -- the colour of light
     caught on old stock, not a hazard sticker. Used sparingly. */
  --film: #B78A3A;
  --film-dim: #6E551F;
  --film-light: #D8B463;

  /* Safelight: the muted red of a darkroom safelamp -- reserved for the
     ラインゲージ threshold and error states, distinct from film-yellow. */
  --safelight: #9A4430;

  --paper: #E5DCC3;
  --paper-dim: #A99C7E;
  --ink: #0A0906;
  --shadow: 0 20px 46px rgba(0, 0, 0, 0.6);
  --display: "Shippori Antique B1", "Hiragino Sans", sans-serif;
  --body-font: "Noto Sans JP", "Hiragino Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 3px;
}

* { box-sizing: border-box; }
html { background: var(--void); color: var(--paper); }
body {
  margin: 0;
  font-family: var(--body-font);
  line-height: 1.85;
  background: var(--void);
  color: var(--paper);
  font-size: 16px;
  position: relative;
}
a { color: inherit; }
img { max-width: 100%; display: block; }

/* Film-grain overlay: a quiet, site-wide cinema texture. Fixed + low-opacity
   so it reads as room ambience, never as noise on top of content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 140px 140px;
}

/* PR bar -- 景表法対応。全ページの firstview に固定表示。
   Restrained: dark ground, thin brass rule, not a flat yellow block. */
.pr-bar {
  background: var(--void-800);
  color: var(--film-light);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--film-dim);
}

.site-header, .site-footer {
  background: var(--void);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 5vw, 56px);
}
.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--film-dim); }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.5rem; text-decoration: none; letter-spacing: 0.01em; }
.brand .brand-dot { color: var(--film); }
nav { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--display); font-weight: 500; font-size: 0.92rem; }
nav a, .site-footer a { text-underline-offset: 0.28em; text-decoration-color: var(--film-dim); }
nav a:hover { color: var(--film-light); }

main { min-height: 70vh; }
.hero, .page-hero, .result-hero, .quiz-shell, .catalog-shell, .content-page, .notfound {
  padding: clamp(34px, 7vw, 86px) clamp(18px, 5vw, 56px);
}

/* ---------- Hero: darkroom instrument panel ---------- */
.hero {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(183, 138, 58, 0.035) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(183, 138, 58, 0.035) 0 1px, transparent 1px 28px),
    linear-gradient(175deg, rgba(27, 22, 14, 0.94), rgba(10, 9, 6, 0.98) 72%), url('/images/hero-texture.jpg') center / cover no-repeat;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.5rem, 6.8vw, 4.7rem); line-height: 1.14; margin: 0 0 18px; }
.hero h1 .tagline { display: block; font-family: var(--body-font); font-weight: 400; font-size: clamp(0.98rem, 2vw, 1.18rem); color: var(--film-light); margin-top: 12px; }
.hero p { max-width: 600px; font-size: 1.03rem; color: var(--paper-dim); }
.eyebrow, .q-kicker, .section-head p { margin: 0 0 8px; font-family: var(--mono); color: var(--film); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------- Signature: 手ブレ許容ラインゲージ (multi-zone, hero) ---------- */
.gauge-panel {
  background: var(--void-800);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
}
.gauge-panel .gauge-caption { font-family: var(--mono); color: var(--paper-dim); font-size: 0.72rem; letter-spacing: 0.04em; margin: 0 0 10px; text-transform: uppercase; }
.gauge-multi { width: 100%; height: auto; display: block; }
.gauge-wave { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.gauge-wave-echo { fill: none; stroke: var(--film); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; opacity: 0.22; }
.gauge-threshold { stroke: var(--safelight); stroke-width: 1.3; stroke-dasharray: 5 4; opacity: 0.8; }
.gauge-divider { stroke: var(--hairline); stroke-width: 1; }
.gauge-zone-labels { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 10px; }
.gauge-zone-labels span { font-family: var(--mono); font-size: 0.66rem; color: var(--paper-dim); text-align: center; letter-spacing: 0.02em; }
.gauge-panel .gauge-legend { display: flex; gap: 18px; margin-top: 14px; font-family: var(--mono); font-size: 0.68rem; color: var(--paper-dim); flex-wrap: wrap; }
.gauge-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gauge-legend .swatch { width: 14px; height: 3px; display: inline-block; background: var(--film); }
.gauge-legend .swatch.line { background: var(--safelight); }

/* ---------- Single gauge (quiz / result / 404) with Loading/Empty/Error states ---------- */
.gauge-single { width: 100%; height: auto; display: block; }
.gauge-single.is-empty .gauge-wave { opacity: 0.35; }
.gauge-single.is-error .gauge-wave { animation: gauge-jitter 0.32s steps(2) infinite; }
.gauge-single.is-error .gauge-threshold { stroke: var(--paper-dim); }
.gauge-single.is-settling .gauge-wave { animation: gauge-settle 0.64s ease-out; }
@keyframes gauge-settle {
  0% { transform: scaleY(1.5) translateY(-14px); opacity: 0.5; }
  60% { transform: scaleY(1.1) translateY(-4px); opacity: 0.9; }
  100% { transform: scaleY(1) translateY(0); opacity: 1; }
}
@keyframes gauge-jitter {
  0% { transform: translateX(0); }
  50% { transform: translateX(2px); }
  100% { transform: translateX(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .gauge-single.is-settling .gauge-wave, .gauge-single.is-error .gauge-wave { animation: none; }
}

.cta-row, .buy-links, .quiz-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.button, .buy-links a, .quiz-actions button {
  border: 1px solid var(--film-dim);
  background: var(--film);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 13px 22px;
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.96rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.button.secondary, .quiz-actions button.secondary { background: transparent; color: var(--paper); border-color: var(--hairline); }
.button:hover, .buy-links a:hover, .quiz-actions button:hover:not(:disabled) { background: var(--film-light); border-color: var(--film-light); }
.button:focus-visible, .buy-links a:focus-visible, .quiz-actions button:focus-visible, .q-option:focus-visible, nav a:focus-visible {
  outline: 3px solid var(--film-light);
  outline-offset: 3px;
}
.quiz-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.quiz-actions [hidden], [hidden] { display: none !important; }
.buy-links a small { font-family: var(--mono); font-size: 0.6rem; border: 1px solid currentColor; border-radius: 2px; padding: 1px 4px; opacity: 0.75; }

.section-head h2, .content-page h2, .catalog-group h2, .packing-group h2 {
  margin: 0 0 20px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.55rem, 4vw, 2.55rem);
  line-height: 1.28;
  color: var(--paper);
}
.catalog-shell, .packing-group { border-top: 1px solid var(--hairline); }

/* ---------- Category strip (6 icons) ---------- */
.category-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline); }
.category-strip div { padding: 16px 12px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: var(--void-800); }
.category-strip strong { display: block; font-family: var(--display); font-weight: 700; font-size: 0.98rem; color: var(--paper); }
.category-strip span { color: var(--paper-dim); font-size: 0.82rem; }
.category-strip img { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; border: 1px solid var(--film-dim); margin-bottom: 10px; }

/* ---------- Product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card {
  background: var(--void-800);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-card.is-locked { border-color: var(--film-dim); }
.lock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: var(--void-800);
  color: var(--film-light);
  border: 1px solid var(--film-dim);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  border-radius: 2px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.lock-badge-icon { width: 6px; height: 6px; border-radius: 50%; background: var(--film); display: inline-block; }
.product-image { height: 190px; background: linear-gradient(135deg, var(--paper), var(--paper-dim)); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: contain; min-width: 0; min-height: 0; mix-blend-mode: multiply; }
.product-copy { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.product-meta, .spec-list { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); }
.product-meta span, .spec-list span {
  border: 1px solid var(--hairline);
  background: var(--void-700);
  color: var(--paper-dim);
  border-radius: 2px;
  padding: 3px 9px;
  font-size: 0.74rem;
}
.product-card h3 { font-family: var(--body-font); font-weight: 700; font-size: 1.0rem; line-height: 1.55; margin: 0; color: var(--paper); }
.product-card p { margin: 0; color: var(--paper-dim); }
.buy-links { margin-top: auto; }
.buy-links a { flex: 1; text-align: center; justify-content: center; padding: 9px 10px; }

/* ---------- Quiz ---------- */
.quiz-shell { max-width: 920px; margin: 0 auto; }
.tick-band { display: flex; gap: 9px; margin: 20px 0 26px; padding: 10px 14px; background: var(--void-800); border: 1px solid var(--hairline); border-radius: 20px; width: fit-content; }
.tick-mark { width: 13px; height: 13px; border-radius: 50%; background: var(--void); border: 2px solid var(--film-dim); transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.tick-mark.is-current { border-color: var(--film-light); transform: scale(1.15); }
.tick-mark.is-set { background: var(--film); border-color: var(--film); }
@media (prefers-reduced-motion: reduce) { .tick-mark { transition: none; } }

.quiz-gauge-panel { margin-bottom: 18px; }
.quiz-gauge-panel .gauge-caption { font-family: var(--mono); color: var(--paper-dim); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
#gauge-visual { max-width: 300px; }

.q-card { background: var(--void-800); border: 1px solid var(--hairline); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); box-shadow: var(--shadow); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 4.6vw, 2.4rem); line-height: 1.3; margin-bottom: 10px; color: var(--paper); }
.q-card p { color: var(--paper-dim); }
.q-helper { font-size: 0.86rem; color: var(--film-light); }
.q-options { display: grid; gap: 12px; margin-top: 22px; }
.q-option {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--hairline);
  background: var(--void-700);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  font-family: var(--body-font);
}
.q-option:hover { border-color: var(--film-dim); }
.q-option:active { transform: translateY(1px); }
.q-option.is-selected { background: var(--void-500); border-color: var(--film); }
.option-mark { width: 16px; height: 16px; border: 2px solid var(--film-dim); border-radius: 50%; margin-top: 5px; }
.q-option.is-selected .option-mark { background: var(--film); border-color: var(--film); }
.q-option small { display: block; margin-top: 4px; color: var(--paper-dim); font-family: var(--body-font); font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.result-hero .maker-note, .result-gauge-panel .maker-note { display: block; margin-top: 12px; color: var(--paper-dim); font-family: var(--mono); font-size: 0.8rem; }
.result-gauge-panel { background: var(--void-800); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 20px; margin: 22px 0; max-width: 460px; }
.content-page { max-width: 860px; }
.content-page p, .content-page li { font-size: 1.02rem; color: var(--paper-dim); }
.content-page h2 { margin-top: 40px; }
.notfound { min-height: 72vh; background: repeating-linear-gradient(135deg, var(--void-800) 0 24px, var(--void) 24px 48px); color: var(--paper); display: grid; place-items: center; }
.notfound-panel { max-width: 720px; background: var(--void-800); border: 1px solid var(--film-dim); border-radius: var(--radius); padding: clamp(24px, 5vw, 48px); text-align: center; }
.notfound-image { width: 180px; margin: 0 auto 18px; border-radius: var(--radius); }
.notfound .gauge-single { max-width: 280px; margin: 0 auto 18px; }
.site-footer { align-items: flex-start; border-top: 1px solid var(--hairline); }
.site-footer p { margin: 0; color: var(--paper-dim); font-size: 0.88rem; }

.editor-figure { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--hairline); margin: 24px 0; }

/* ---------- Field-log entries (editorial voice device) ---------- */
.log-entry { font-family: var(--mono); font-size: 0.76rem; color: var(--film-light); letter-spacing: 0.02em; margin-bottom: 6px; text-transform: none; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .site-header, .site-footer { display: block; }
  nav { margin-top: 12px; }
  .product-grid { grid-template-columns: 1fr; }
  .category-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauge-zone-labels span { font-size: 0.56rem; }
}
