/* Koshu portal. Colours from the Koshu grape: the lilac skin, the pale gold wine, the vine leaf,
   on a cool morning-mist ground. Type: Shippori Mincho for headings, Zen Kaku Gothic New for text. */

@font-face { font-family: "Shippori Mincho"; font-weight: 500; font-display: swap;
  src: url("fonts/shippori-mincho-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Shippori Mincho"; font-weight: 700; font-display: swap;
  src: url("fonts/shippori-mincho-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 400; font-display: swap;
  src: url("fonts/zen-kaku-gothic-new-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 500; font-display: swap;
  src: url("fonts/zen-kaku-gothic-new-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Zen Kaku Gothic New"; font-weight: 700; font-display: swap;
  src: url("fonts/zen-kaku-gothic-new-latin-700-normal.woff2") format("woff2"); }

:root {
  --mist: #eceee8;
  --paper: #f8f9f5;
  --ink: #2a2430;
  --ink-soft: #5d5664;
  --skin: #7f5f78;
  --skin-faint: #e6dde4;
  --gold: #d6bf72;
  --gold-faint: #f3ecd2;
  --vine: #4f6343;
  --amber: #9a6a17;
  --rust: #8f3d2c;
  --rule: #d3d6cd;
  --focus: #7f5f78;
  --serif: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --mist: #1d1a20;
    --paper: #262229;
    --ink: #ece8ee;
    --ink-soft: #b7afbb;
    --skin: #c4a3bd;
    --skin-faint: #3a3039;
    --gold: #c9b066;
    --gold-faint: #3a3424;
    --vine: #9db58d;
    --amber: #d9a64a;
    --rust: #e08a75;
    --rule: #3d3841;
    --focus: #c4a3bd;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--mist); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
}
a { color: var(--skin); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 10; }

/* ---------- top bar */
.top { background: var(--paper); border-bottom: 1px solid var(--rule); }
.top-inner { max-width: 72rem; margin: 0 auto; padding: 0.9rem 1rem 0; display: flex; flex-wrap: wrap;
  align-items: baseline; gap: 0.25rem 1.5rem; }
.wordmark { font: 700 1.3rem/1.2 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }
.who { margin-left: auto; color: var(--ink-soft); font-size: 0.9rem; display: flex; gap: 1rem; align-items: center; }
.agents { display: inline-flex; align-items: center; gap: 0.45rem; }
.agents::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--rule); }
.agents.working::before { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-faint); }
nav.main { width: 100%; display: flex; gap: 0.2rem; overflow-x: auto; scrollbar-width: none; margin-top: 0.4rem; }
nav.main::-webkit-scrollbar { display: none; }
nav.main a { flex: none; padding: 0.55rem 0.8rem 0.65rem; color: var(--ink-soft); text-decoration: none;
  border-bottom: 3px solid transparent; font-weight: 500; }
nav.main a:hover { color: var(--ink); }
nav.main a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--skin); }

/* ---------- page frame */
main { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0; }
h1 { font-size: 2.1rem; }
.page-head { margin: 0.5rem 0 1.5rem; max-width: 42rem; }
.page-head p { color: var(--ink-soft); margin: 0.5rem 0 0; }
.dev-banner { background: var(--gold-faint); border: 1px solid var(--gold); padding: 0.4rem 0.8rem;
  font-size: 0.85rem; max-width: 72rem; margin: 0 auto; }

/* ---------- flash messages */
.flash { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.flash li { padding: 0.7rem 1rem; border-left: 4px solid var(--vine); background: var(--paper); margin-bottom: 0.4rem; }
.flash li.error { border-left-color: var(--rust); }

/* ---------- the week band: the overhead pergola trellis of a Koshu vineyard, seen from below */
.week-band {
  position: relative; padding: 1.75rem 1.5rem 1.5rem; margin-bottom: 2rem; background: var(--paper);
  border-top: 4px solid var(--gold);
  background-image:
    linear-gradient(var(--skin-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--skin-faint) 1px, transparent 1px);
  background-size: 34px 34px; background-position: -1px -1px;
}
.week-band > * { position: relative; }
.week-no { font: 700 clamp(3rem, 9vw, 5.25rem)/0.95 var(--serif); letter-spacing: -0.01em; margin: 0; }
.week-dates { font: 500 1.25rem/1.3 var(--serif); margin: 0.6rem 0 0; }
.season { color: var(--ink-soft); margin: 0.35rem 0 1.2rem; max-width: 40rem; }
.older { display: inline-block; background: var(--gold-faint); padding: 0.15rem 0.6rem; margin: 0 0 0.8rem; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ---------- buttons */
.btn, button { font: 500 1rem/1.2 var(--sans); cursor: pointer; display: inline-flex; align-items: center;
  gap: 0.5rem; padding: 0.7rem 1.1rem; border-radius: 4px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper); text-decoration: none; }
.btn:hover, button:hover { background: var(--skin); border-color: var(--skin); color: #fff; }
.btn.quiet, button.quiet { background: transparent; color: var(--ink); }
.btn.quiet:hover, button.quiet:hover { background: var(--skin-faint); color: var(--ink); border-color: var(--ink); }
button.link { background: none; border: 0; padding: 0; color: var(--skin); text-decoration: underline;
  text-underline-offset: 0.18em; font-weight: 400; }
button.link:hover { color: var(--ink); background: none; }

/* ---------- this week: brief + decisions */
.week-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
@media (min-width: 62rem) {
  .week-grid { grid-template-columns: minmax(0, 40rem) minmax(0, 1fr); gap: 3.5rem; }
  .decide { position: sticky; top: 1rem; align-self: start; }
}
.brief { max-width: 40rem; }
.brief h2 { font-size: 1.45rem; margin: 2.2rem 0 0.6rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.brief h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.brief h3 { font-size: 1.15rem; margin: 1.4rem 0 0.4rem; }
.brief p, .brief li { margin: 0.5rem 0; }
.brief ul, .brief ol { padding-left: 1.3rem; }
.brief table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin: 0.8rem 0; display: block; overflow-x: auto; }
.brief th, .brief td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }

.decide h2 { font-size: 1.45rem; margin-bottom: 0.35rem; }
.decide > p { color: var(--ink-soft); margin: 0 0 1.2rem; }
.rec { background: var(--paper); border-left: 5px solid var(--rule); padding: 1.1rem 1.2rem 1.2rem; margin-bottom: 1.2rem; }
.rec.Low { border-left-color: var(--vine); }
.rec.Medium { border-left-color: var(--amber); }
.rec.High { border-left-color: var(--rust); }
.rec h3 { font-size: 1.2rem; margin-bottom: 0.4rem; }
.risk { font-weight: 700; font-size: 0.95rem; margin: 0 0 0.6rem; }
.risk.Low { color: var(--vine); } .risk.Medium { color: var(--amber); } .risk.High { color: var(--rust); }
.rec dl { margin: 0.6rem 0 1rem; }
.rec dt { font-weight: 700; font-size: 0.9rem; margin-top: 0.5rem; }
.rec dd { margin: 0.1rem 0 0; }
.recorded { background: var(--gold-faint); padding: 0.6rem 0.8rem; margin-bottom: 0.9rem; font-size: 0.95rem; }

fieldset.choice { border: 0; padding: 0; margin: 0 0 0.8rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
fieldset.choice legend { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.4rem; padding: 0; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-block; padding: 0.5rem 0.95rem; border: 1.5px solid var(--rule); border-radius: 4px;
  background: var(--mist); cursor: pointer; }
.choice input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- forms */
form.stack { display: grid; gap: 1.1rem; max-width: 40rem; }
label.field { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.95rem; }
label.field small, .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.9rem; }
input[type=text], input[type=url], input[type=password], textarea, select {
  font: 400 1rem/1.5 var(--sans); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--rule); border-radius: 4px; padding: 0.6rem 0.7rem; width: 100%; }
input[type=text]:focus, input[type=url]:focus, input[type=password]:focus, textarea:focus, select:focus { border-color: var(--skin); outline: none;
  box-shadow: 0 0 0 3px var(--skin-faint); }
textarea { min-height: 7rem; resize: vertical; }
input[type=file] { font: inherit; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-weight: 400; }
.checks label { display: inline-flex; gap: 0.45rem; align-items: center; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--skin); }
.group { border: 0; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.group legend { font-weight: 700; font-size: 0.95rem; padding: 0; margin-bottom: 0.2rem; }
.switch { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; }
.switch input { margin-top: 0.3rem; }
.section { margin-top: 2.5rem; }
.section > h2 { font-size: 1.45rem; margin-bottom: 0.8rem; }

/* ---------- lists */
.statements { list-style: none; padding: 0; margin: 0 0 1rem; max-width: 46rem; }
.statements li { background: var(--paper); padding: 0.8rem 1rem; margin-bottom: 0.5rem; display: flex; gap: 1rem;
  justify-content: space-between; align-items: baseline; }
.empty { color: var(--ink-soft); font-style: normal; background: var(--paper); padding: 1rem 1.2rem; max-width: 40rem; }

.posts { display: grid; gap: 1rem; max-width: 48rem; }
.post { background: var(--paper); padding: 1rem 1.2rem; display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0 1.1rem; }
.post .day { font: 700 2rem/1 var(--serif); text-align: center; }
.post .day small { display: block; font: 500 0.85rem/1.3 var(--sans); color: var(--ink-soft); margin-top: 0.25rem; }
.post h3 { font-size: 1.15rem; }
.post .meta { color: var(--ink-soft); font-size: 0.92rem; margin: 0.15rem 0 0.5rem; }
.post details { margin-top: 0.4rem; }
.post summary { cursor: pointer; color: var(--skin); }
.post pre { white-space: pre-wrap; font: 400 0.95rem/1.55 var(--sans); background: var(--mist); padding: 0.7rem 0.8rem; margin: 0.4rem 0; }
.post form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.post select { width: auto; padding: 0.45rem 0.6rem; }
.post button { padding: 0.5rem 0.9rem; }
.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 3px; font-size: 0.85rem; background: var(--mist); }
.badge.posted { background: var(--vine); color: var(--paper); }
.badge.shot { background: var(--gold-faint); }
.badge.skipped { text-decoration: line-through; }

table.archive { border-collapse: collapse; width: 100%; max-width: 48rem; background: var(--paper); }
table.archive th, table.archive td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--rule); }
table.archive th { font-size: 0.9rem; color: var(--ink-soft); font-weight: 500; }

.check-note { max-width: 46rem; background: var(--paper); padding: 1rem 1.2rem; }
.check-note table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 0.95rem; }
.check-note th, .check-note td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }

@media (prefers-reduced-motion: no-preference) {
  .agents.working::before { animation: breathe 2.4s ease-in-out infinite; }
  @keyframes breathe { 50% { box-shadow: 0 0 0 6px var(--gold-faint); } }
}
@media (max-width: 30rem) {
  .post { grid-template-columns: 3.4rem minmax(0, 1fr); padding: 0.9rem; }
  .post .day { font-size: 1.6rem; }
  .week-band { padding: 1.25rem 1rem 1.1rem; }
}
@media print {
  .top, .decide, .actions, .flash { display: none; }
  body { background: #fff; }
  .week-band { background: none; border-top: 0; padding: 0; }
}

/* ---------- small spacing helpers (no inline styles: the CSP forbids them) */
.mt-xs { margin-top: 0.4rem; }
.mt-s { margin-top: 0.7rem; }
.form-end { margin: 0.9rem 0 0; }
.flush { margin: 0; }
@media (min-width: 62rem) { .jump { display: none; } }
form.narrow { max-width: 24rem; }
.who form { margin: 0; }
.top-inner { padding-bottom: 0.9rem; }
nav.main { margin-bottom: -0.9rem; }
