@import url('./pages.css');
@import url('./growth.css');

/* ============================================================
   ResetHand — Signal Bureau visual system
   Bone paper / deep-forest ink / signal green accent.
   Sharper geometry, hairline rules, instrument typography.
   ============================================================ */

:root {
  --ink: #141b13;
  --muted: #5c6659;
  --line: #d8d8c7;
  --line-strong: #b9bba6;
  --paper: #f2f1e8;
  --card: #fbfaf4;
  --accent: #c8f76a;
  --accent-ink: #1c2a10;
  --dark: #0d1710;
  --focus: #4c7a10;
  --display: 'Space Grotesk', 'PingFang SC', sans-serif;
  --body: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 27, 19, .05), 0 14px 34px -20px rgba(20, 27, 19, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; opacity: .55; }
svg { flex-shrink: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.25; }
h1 {
  font-family: var(--display);
  font-size: clamp(2.3rem, 4.1vw, 4.3rem);
  letter-spacing: -.05em;
  font-weight: 600;
}
h2 { font-size: 1.4rem; letter-spacing: -.022em; }
h3 { font-size: 1.05rem; }
small, .meta { font-size: .8rem; color: var(--muted); }
.mono { font-family: var(--mono); }

.shell { max-width: 1240px; margin: 0 auto; padding: 0 40px; }

/* ---------- header ---------- */
.site-header {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}
.brand {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.05em;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand-mark { width: 35px; height: 35px; display: block; flex-shrink: 0; }
.brand-mark img { display: block; width: 100%; height: 100%; }
.site-nav { display: flex; align-items: center; gap: 28px; font-size: .9rem; }
.site-nav a {
  color: var(--muted);
  padding: 4px 0;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1.5px no-repeat;
  transition: color .18s ease, background-size .22s ease;
}
.site-nav a:hover { color: var(--ink); background-size: 100% 1.5px; }
.brand-light { font-weight: 400; }
.site-nav a[aria-current=page] {
  color: var(--ink);
  font-weight: 700;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 100% 3px no-repeat;
}
.header-end { font-size: .8rem; display: flex; gap: 8px; align-items: center; color: var(--muted); }

/* ---------- primitives ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  padding: 5px 12px;
  border-radius: 50px;
  font-size: .8rem;
}
.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: .9rem;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.button:hover {
  transform: translateY(-1px);
  background: var(--dark);
  box-shadow: 0 8px 18px -10px rgba(13, 23, 16, .55);
}
.button:active { transform: translateY(0); }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button.secondary:hover { background: #ecebe0; box-shadow: none; }
.button.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.accent:hover { background: #d4ff85; box-shadow: 0 8px 18px -10px rgba(120, 160, 40, .5); }
.icon { width: 19px; height: 19px; vertical-align: middle; }
.text-link {
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }

/* ---------- section headings ---------- */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 34px 0 18px;
}
.section-title h2 { margin: 0; }

/* ---------- footer / toast ---------- */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 24px 0 105px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: .8rem;
  color: var(--muted);
}
.toast {
  position: fixed;
  bottom: 95px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--dark);
  color: #fff;
  border: 1px solid #2c3a2e;
  border-left: 3px solid var(--accent);
  padding: 12px 22px;
  border-radius: 10px;
  z-index: 60;
  box-shadow: 0 12px 34px rgba(7, 18, 12, .35);
  text-align: center;
}
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; background: var(--accent); padding: 10px; }
.skip-link:focus { top: 8px; }
.empty-state {
  border: 1px dashed var(--line-strong);
  padding: 32px;
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
}

/* ---------- dialog ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  width: min(500px, calc(100% - 32px));
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(10, 18, 12, .55); backdrop-filter: blur(4px); }
.dialog-top { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.close-button { background: transparent; border: 0; padding: 2px; color: inherit; border-radius: 6px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; margin: 18px 0; }
.field label { font-size: .875rem; font-weight: 600; }
.field input, .field select {
  width: 100%;
  min-width: 0;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
  transition: border-color .16s ease;
}
.field input:focus, .field select:focus { border-color: var(--focus); }
.form-error { color: #b13428; font-size: .875rem; min-height: 1.4em; }

@media (max-width: 850px) {
  .shell { padding: 0 24px; }
  .site-nav { gap: 18px; }
  .header-end { display: none; }
  .site-header { height: 80px; }
}

@media (max-width: 600px) {
  .shell { padding: 0 20px; }
  .site-header { height: 74px; gap: 10px; }
  .brand { font-size: 1.13rem; }
  .brand-mark { width: 30px; height: 30px; }
  .site-nav { font-size: .8rem; gap: 14px; }
  .site-nav a:nth-child(n+3) { display: none; }
  .section-title { align-items: start; flex-direction: column; }
  .footer { flex-direction: column; gap: 8px; }
  .toast { font-size: .875rem; bottom: 84px; }
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* `.reveal-in` is added by revealOnVisible() only when the page can animate.
   Without JS, or in a hidden tab, content renders in its natural state. */
.reveal-in { animation: rise .4s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
.site-header { flex-wrap: wrap; height: auto; min-height: 88px; padding: 20px 0; }
.site-nav { gap: 20px; }
.footer { padding-bottom: 32px; }
.toast { bottom: 24px; }
.site-nav a, .header-end, .eyebrow, .footer { font-size: .875rem; }

@media (max-width: 700px) {
  .site-header { gap: 14px; }
  .site-nav {
    order: 3;
    flex-basis: 100%;
    gap: 20px;
    font-size: .875rem;
    overflow-x: auto;
    padding: 4px 0;
  }
  .site-nav a:nth-child(n) { display: block; white-space: nowrap; }
  .language-switcher { margin-left: auto; }
  .header-end { display: none; }
}

/* ---------- clock & guide: light page, dark instrument panel ---------- */
body[data-page=clock], body[data-page=guide] {
  --paper: #f2f1e8;
  --card: #fbfaf4;
  --ink: #141b13;
  --muted: #5c6659;
  --line: #d8d8c7;
  --accent: #c8f76a;
  --dark: #0d1710;
  color-scheme: light;
}

body[data-page=clock] .clock-face { background: #0d1710; color: #eef5ec; }
body[data-page=clock] .clock-face .pill { color: #e3efdf; border-color: #3d4c38; }
body[data-page=clock] .clock-face .clock-face-caption,
body[data-page=clock] .clock-face .target-label,
body[data-page=clock] .clock-face .clock-face-bottom { color: #a9b8a6; }
body[data-page=clock] .clock-progress { background: #2b3a2b; }
body[data-page=clock] .clock-digits span { color: #f0f8e2; }
body[data-page=clock] .clock-digits small { color: #9bad97; }
body[data-page=clock] .clock-digits b { color: #55684f; }
body[data-page=clock] .time-mode button[aria-pressed=true] { background: #e6efdb; color: #141b13; }
body[data-page=clock] .timer-row.selected { border-color: #5d8a2e; background: #eef4e2; }
body[data-page=clock] .timer-provider-icon { background: #e6efdb; }
body[data-page=clock] .button.accent { color: var(--accent-ink); }
body[data-page=clock] button:focus-visible,
body[data-page=clock] a:focus-visible,
body[data-page=clock] input:focus-visible,
body[data-page=clock] select:focus-visible { outline-color: var(--focus); }

body[data-page=clock] .clock-heading .eyebrow { color: var(--muted); }
