/* style.css — one file for the whole site
   ------------------------------------------------------------------
   Read top to bottom: text, column, menu, hero, cards, machine.
   ------------------------------------------------------------------ */

:root {
  --paper: #fffdf9;
  --card: #ffffff;
  --ink: #1c1917;
  --ink-2: #44403c;
  --muted: #78716c;
  --line: #e7e0d6;
  --accent: #0369a1;
  --accent-warm: #c2410c;
  --good: #15803d;
  --bad: #b91c1c;
  --col: 60rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); }
a:hover { color: var(--accent-warm); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 2.25rem; margin: 2rem 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 0.75rem; }
p { margin: 0.7rem 0; }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.35rem 0; }

/* ---------- the column ---------- */
main {
  max-width: var(--col);
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}

/* ---------- the menu (inserted by nav.js) ---------- */
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: var(--col);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
}
.site-nav__logo {
  font-weight: 800;
  color: var(--accent-warm);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav__links {
  display: flex;
  gap: 1.4rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}
.site-nav a { color: var(--ink-2); text-decoration: none; }
.site-nav a:hover { color: var(--accent-warm); }
.site-nav a[aria-current="page"] { color: var(--accent-warm); font-weight: 600; }
.site-nav__action {
  border: 1.5px solid var(--accent);
  border-radius: 99px;
  padding: 0.3em 1em;
  color: var(--accent) !important;
  white-space: nowrap;
}
.site-nav__action:hover { background: var(--accent); color: #fff !important; }

/* ---------- hero ---------- */
.hero { margin-top: 0.5rem; }
.hero img {
  width: 100%;
  height: 22rem;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

/* the quote of the moment, on quotes.html */
.random-quote {
  margin: 1.25rem 0 2rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-warm);
  border-radius: 12px;
  background: var(--card);
}
.random-quote p { margin: 0; font-size: 1.15rem; }
.random-quote footer { margin-top: 0.5rem; color: var(--muted); font-size: 0.9rem; }

/* ---------- quote cards ---------- */
.quote {
  margin: 0 0 1.25rem;
  padding: 1.1em 1.3em;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-warm);
  border-radius: 10px;
}
.quote blockquote { margin: 0; }
.quote blockquote p { margin: 0 0 0.4em; }
.quote blockquote p:last-child { margin-bottom: 0; }
.quote footer { font-size: 0.9rem; color: var(--muted); }
.quote cite { font-style: normal; font-weight: 600; color: var(--ink-2); }
.quote[hidden] { display: none; }

/* filter field */
.filter { margin: 1rem 0 1.5rem; }
.filter label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.filter input {
  font: inherit;
  width: 100%;
  max-width: 22rem;
  padding: 0.55em 0.8em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.filter input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter .count { font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; }
.filter .count.none { color: var(--bad); }

/* ---------- the machine ---------- */
.machine {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-align: center;
}
.machine__box {
  position: relative;
  width: 14rem;
  height: 10rem;
  margin: 0 auto 1.25rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #f5f1e8, #e9e2d5);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.machine__switch {
  width: 4.5rem;
  height: 2.2rem;
  padding: 0.25rem;
  border: 0;
  border-radius: 99px;
  background: #d6cec1;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s ease;
}
.machine__switch::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
}
.machine__switch[aria-pressed="true"] { background: var(--good); }
.machine__switch[aria-pressed="true"]::after { transform: translateX(2.3rem); }
.machine__hand {
  position: absolute;
  right: -6rem;
  top: 50%;
  width: 6rem;
  height: 1.1rem;
  border-radius: 99px;
  background: #c2410c;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.machine__box.is-working .machine__hand { transform: translateX(-9rem); }
.machine__status { color: var(--muted); font-size: 0.95rem; min-height: 1.5em; }

/* ---------- the reaction game ---------- */
.game { margin: 1.5rem 0; }
.game__pad {
  width: 100%;
  min-height: 10rem;
  display: grid;
  place-items: center;
  gap: 0.4rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #efe9df;
  color: var(--ink-2);
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.game__pad strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.game__pad.is-ready { background: #fef3c7; }
.game__pad.is-go { background: var(--good); color: #fff; }
.game__pad.is-early { background: #fee2e2; color: var(--bad); }
.game__result { margin-top: 0.9rem; color: var(--muted); font-size: 0.95rem; }
.game__result b { color: var(--ink); }

/* ---------- footer ---------- */
.site-footer {
  max-width: var(--col);
  margin: 0 auto;
  padding: 1rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent-warm); }

/* ---------- phone ---------- */
@media (max-width: 640px) {
  h1 { font-size: 1.75rem; }
  .hero img { height: 14rem; }
  .site-nav { padding: 0.9rem 1.25rem; }
  .site-nav__links { gap: 1rem; font-size: 0.95rem; }
  main { padding: 0.5rem 1.25rem 3rem; }
  .machine__box { width: 100%; }
}

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