/* エアロプレス抽出帳 — 野帳 (フィールドノート) の紙面。
   お湯 = 炭火の橙、水 = 沢の青、緑茶 = 葉の緑 を意味の色として使い、飾りには使わない。
   夜のキャンプで眩しくないよう、暗い場所では焚き火の暗さに落とす。 */
:root {
  --paper: oklch(95.5% 0.018 85);
  --paper-2: oklch(92% 0.024 82);
  --card: oklch(98% 0.01 85);
  --ink: oklch(24% 0.025 60);
  --ink-2: oklch(42% 0.025 60);
  --rule: oklch(82% 0.025 75);
  --hot: oklch(62% 0.17 42);
  --hot-soft: oklch(90% 0.06 55);
  --cold: oklch(56% 0.11 235);
  --cold-soft: oklch(91% 0.04 230);
  --leaf: oklch(55% 0.11 140);
  --shadow: 0 1px 0 oklch(80% 0.03 70), 0 8px 24px -12px oklch(40% 0.05 60 / 0.35);

  --f-head: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --f-body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --f-num: "SF Pro Rounded", "Hiragino Sans", ui-rounded, system-ui, sans-serif;

  --t-hero: clamp(2rem, 1.4rem + 3vw, 3rem);
  --r: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: oklch(19% 0.012 60);
    --paper-2: oklch(23% 0.015 60);
    --card: oklch(24% 0.014 60);
    --ink: oklch(90% 0.02 80);
    --ink-2: oklch(72% 0.02 75);
    --rule: oklch(34% 0.02 60);
    --hot: oklch(72% 0.16 50);
    --hot-soft: oklch(33% 0.06 45);
    --cold: oklch(72% 0.1 230);
    --cold-soft: oklch(30% 0.04 235);
    --leaf: oklch(72% 0.11 140);
    --shadow: 0 1px 0 oklch(14% 0.01 60), 0 10px 26px -14px oklch(0% 0 0 / 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: oklch(19% 0.012 60); --paper-2: oklch(23% 0.015 60); --card: oklch(24% 0.014 60);
  --ink: oklch(90% 0.02 80); --ink-2: oklch(72% 0.02 75); --rule: oklch(34% 0.02 60);
  --hot: oklch(72% 0.16 50); --hot-soft: oklch(33% 0.06 45);
  --cold: oklch(72% 0.1 230); --cold-soft: oklch(30% 0.04 235); --leaf: oklch(72% 0.11 140);
  --shadow: 0 1px 0 oklch(14% 0.01 60), 0 10px 26px -14px oklch(0% 0 0 / 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-body); line-height: 1.6;
  /* 方眼の野帳 */
  background-image:
    linear-gradient(var(--paper-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-2) 1px, transparent 1px);
  background-size: 24px 24px;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--hot); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 120px; }
.hidden { display: none !important; }

/* ───── ヘッダ ───── */
.mast { padding: 28px 0 8px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.mast h1 { font-family: var(--f-head); font-size: clamp(1.8rem, 1.2rem + 3vw, 3rem); white-space: nowrap; line-height: 1.1; margin: 0; letter-spacing: 0.02em; }
.mast h1 small { display: block; font-family: var(--f-body); font-size: 0.72rem; letter-spacing: 0.3em; color: var(--ink-2); margin-bottom: 6px; }
.toggles { display: flex; gap: 6px; }
.icon-btn { border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 0.85rem; white-space: nowrap; }
.icon-btn[aria-pressed="false"] { opacity: 0.55; text-decoration: line-through; }

/* ───── 絞り込み ───── */
.filters { position: sticky; top: 0; z-index: 5; padding: 10px 0 8px; background: color-mix(in oklch, var(--paper) 92%, transparent); backdrop-filter: blur(6px); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--paper-2); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 8px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 9px 4px; font-size: 0.9rem; font-weight: 600; color: var(--ink-2); transition: background var(--dur, 150ms), color 150ms; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg.water button[data-v="hot"][aria-pressed="true"] { color: var(--hot); }
.seg.water button[data-v="cold"][aria-pressed="true"] { color: var(--cold); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 5px 12px; font-size: 0.82rem; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ───── 一覧 ───── */
.group h2 { font-family: var(--f-head); font-size: 1.25rem; margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.group h2 span { font-family: var(--f-body); font-size: 0.75rem; color: var(--ink-2); font-weight: 400; }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.card {
  position: relative; display: block; text-align: left; width: 100%; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 14px 14px 12px 20px; box-shadow: var(--shadow);
  transition: transform 200ms var(--ease), box-shadow 200ms;
}
.card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 5px; border-radius: 0 4px 4px 0; background: var(--hot); }
.card.cold::before { background: var(--cold); }
.card:hover { transform: translateY(-2px); }
.card:active { transform: translateY(0) scale(0.99); }
.card h3 { margin: 0 0 2px; font-size: 1.02rem; font-family: var(--f-head); }
.card p { margin: 0 0 10px; font-size: 0.84rem; color: var(--ink-2); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.82rem; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.facts b { font-size: 1rem; }
.badge { font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: var(--hot-soft); color: var(--hot); font-weight: 700; }
.cold .badge, .badge.cold { background: var(--cold-soft); color: var(--cold); }
.empty { padding: 40px 0; text-align: center; color: var(--ink-2); }

.tips { margin-top: 36px; border-top: 2px dashed var(--rule); padding-top: 18px; }
.tips h2 { font-family: var(--f-head); font-size: 1.1rem; margin: 0 0 8px; }
.tips dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 14px; font-size: 0.88rem; }
.tips dt { font-weight: 700; }
.tips dd { margin: 0; color: var(--ink-2); }

/* ───── 詳細 ───── */
.back { margin: 18px 0 6px; border: 0; background: none; padding: 6px 0; color: var(--ink-2); font-size: 0.9rem; }
.detail h2 { font-family: var(--f-head); font-size: clamp(1.6rem, 1.2rem + 2vw, 2.2rem); line-height: 1.25; margin: 4px 0 6px; }
.detail .lead { color: var(--ink-2); margin: 0 0 16px; }
.spec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.spec > div { background: var(--card); padding: 12px 12px 10px; min-width: 0; }
.spec dt { font-size: 0.72rem; color: var(--ink-2); letter-spacing: 0.08em; }
.spec dd { margin: 0; font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: clamp(1.4rem, 1rem + 2vw, 2rem); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.spec dd small { font-size: 0.8rem; font-weight: 600; }
.spec .wide { grid-column: span 3; }
.spec .wide dd, .spec .sub dd { font-size: 1rem; font-weight: 600; font-family: var(--f-body); }
.spec .hot dd { color: var(--hot); }
.spec .cold dd { color: var(--cold); }
@media (max-width: 420px) { .spec { grid-template-columns: repeat(2, 1fr); } .spec .wide { grid-column: span 2; } }

.section-h { font-family: var(--f-head); font-size: 1.1rem; margin: 26px 0 8px; }
.prep { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.prep label { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; font-size: 0.92rem; }
.prep input { width: 20px; height: 20px; accent-color: var(--hot); flex: none; margin-top: 1px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); margin-left: 8px; }
.timeline li { position: relative; padding: 4px 0 12px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--hot); }
.cold-mode .timeline li::before { border-color: var(--cold); }
.timeline .at { font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: 0.78rem; color: var(--ink-2); }
.timeline .t { font-weight: 700; }
.timeline .d { font-size: 0.84rem; color: var(--ink-2); }
.timeline .dur { font-family: var(--f-num); font-size: 0.8rem; margin-left: 6px; color: var(--hot); font-weight: 700; }
.cold-mode .timeline .dur { color: var(--cold); }
.finish { margin-top: 12px; }
.basis { display: block; }
.source { font-size: 0.8rem; color: var(--ink-2); margin-top: 18px; }

.start-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--paper) 30%); z-index: 6; }
.start {
  display: block; width: 100%; max-width: 728px; margin: 0 auto; border: 0; border-radius: 18px;
  padding: 18px; font-size: 1.25rem; font-weight: 800; letter-spacing: 0.1em;
  background: var(--hot); color: oklch(99% 0.01 80);
  box-shadow: 0 10px 24px -10px var(--hot);
  transition: transform 150ms var(--ease);
}
.cold-mode .start { background: var(--cold); box-shadow: 0 10px 24px -10px var(--cold); }
.start:active { transform: scale(0.98); }
.start small { display: block; font-size: 0.78rem; font-weight: 500; letter-spacing: 0; opacity: 0.9; }

/* ───── 抽出中 ───── */
.brew { position: fixed; inset: 0; z-index: 20; background: var(--paper); display: flex; flex-direction: column; overflow-y: auto; }
.brew-in { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); flex: 1; display: flex; flex-direction: column; }
.brew-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-2); }
.brew-top .name { font-family: var(--f-head); color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { display: flex; gap: 3px; margin: 10px 0 0; }
.track i { height: 6px; border-radius: 3px; background: var(--paper-2); flex: 1; overflow: hidden; position: relative; }
.track i b { position: absolute; inset: 0; background: var(--hot); transform-origin: left; transform: scaleX(0); }
.cold-mode .track i b { background: var(--cold); }
.stepno { margin-top: 18px; font-size: 0.85rem; color: var(--ink-2); letter-spacing: 0.1em; }
.action { display: inline-block; font-size: 0.8rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--hot-soft); color: var(--hot); margin-right: 6px; }
.cold-mode .action { background: var(--cold-soft); color: var(--cold); }
.brew h2 { font-family: var(--f-head); font-size: clamp(1.8rem, 1.2rem + 3.5vw, 2.6rem); line-height: 1.2; margin: 6px 0 4px; }
.brew .say { color: var(--ink-2); margin: 0; min-height: 3.2em; }
.ring { position: relative; width: min(72vw, 300px, 42dvh); aspect-ratio: 1; margin: 14px auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--paper-2); }
.ring .fg { stroke: var(--hot); stroke-linecap: round; transition: stroke-dashoffset 250ms linear; }
.cold-mode .ring .fg { stroke: var(--cold); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .num b { font-family: var(--f-num); font-variant-numeric: tabular-nums; font-size: clamp(3rem, 2rem + 8vw, 4.6rem); line-height: 1; }
.ring .num b.long { font-size: clamp(1.7rem, 1.1rem + 4vw, 2.3rem); }
.ring .num small { display: block; font-size: 0.8rem; color: var(--ink-2); margin-top: 4px; }
.ring.paused .fg { opacity: 0.4; }
.ring.final b { color: var(--hot); animation: pulse 1s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.next { border: 1px dashed var(--rule); border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; color: var(--ink-2); }
.next b { color: var(--ink); }
.longnote { margin: 10px 0 8px; font-size: 0.85rem; background: var(--cold-soft); border-radius: 10px; padding: 10px 12px; }
.controls { margin-top: auto; padding-top: 14px; display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.controls button { border: 1px solid var(--rule); background: var(--card); border-radius: 14px; padding: 14px 6px; font-weight: 700; }
.controls .main { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.done-view { text-align: center; padding-top: 10dvh; }
.done-view .big { font-size: 4rem; line-height: 1; }
.done-view h2 { margin-top: 12px; }
.done-view p { color: var(--ink-2); text-align: left; }
.done-view .controls { grid-template-columns: 1fr 1fr; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}
