/* Date calculator styles. Light and dark follow the system setting. */
:root {
  color-scheme: light dark;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1d2126;
  --muted: #5b636e;
  --line: #dcd9d0;
  --accent: #0d6b5e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f1ed;
  --warn: #8a4b00;
  --focus: #e0a100;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #1b2128;
    --text: #e8eaed;
    --muted: #a3acb8;
    --line: #2f3843;
    --accent: #4fc3ae;
    --accent-ink: #0b1a17;
    --accent-soft: #19332e;
    --warn: #f0b35a;
    --shadow: none;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; top: .5rem; }
.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 1.1rem; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; padding-top: .7rem; padding-bottom: .7rem; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; margin-right: auto; }
.brand svg { flex: none; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin: 0; padding: 0; font-size: .93rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: .2rem 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"] { font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

main { flex: 1; padding: 1.6rem 0 2.5rem; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.15rem); line-height: 1.2; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
.lede { color: var(--muted); margin: 0 0 1.4rem; font-size: 1.05rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }

form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem 1rem; align-items: end; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, .field .label { font-weight: 600; font-size: .92rem; }
.hint { color: var(--muted); font-size: .85rem; }
input, select, button { font: inherit; color: inherit; }
input[type="date"], input[type="time"], input[type="number"], input[type="text"], select {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); min-height: 2.6rem;
}
input:focus-visible, select:focus-visible { border-color: var(--accent); }
.check { display: flex; align-items: center; gap: .5rem; margin-top: .9rem; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: .3rem; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg); flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; padding: .35rem .9rem; border-radius: 999px; cursor: pointer; font-size: .93rem; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer; min-height: 2.5rem; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.07); }

.result { margin-top: 1.2rem; }
.result[hidden] { display: none; }
.big { font-size: clamp(1.7rem, 6vw, 2.4rem); font-weight: 700; line-height: 1.15; margin: 0; font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); margin: .25rem 0 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.stats li { background: var(--accent-soft); border-radius: 10px; padding: .7rem .85rem; }
.stats .k { display: block; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stats .v { display: block; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.error { color: var(--warn); font-weight: 600; margin: .8rem 0 0; }
.error:empty { display: none; }
.note { font-size: .9rem; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: var(--accent-soft); color: var(--text); margin-left: .3rem; white-space: nowrap; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .8rem 0 0; text-align: center; }
.countdown div { background: var(--accent-soft); border-radius: 10px; padding: .8rem .3rem; }
.countdown .n { display: block; font-size: clamp(1.6rem, 7vw, 2.6rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.countdown .u { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.tools a { display: block; height: 100%; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); transition: border-color .15s; }
.tools a:hover { border-color: var(--accent); }
.tools strong { display: block; font-size: 1.05rem; margin-bottom: .25rem; color: var(--accent); }
.tools span { color: var(--muted); font-size: .94rem; }

.prose { max-width: 70ch; }
.prose li { margin: .3rem 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--accent-soft); padding: .05rem .3rem; border-radius: 4px; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.1rem 0; font-size: .95rem; text-align: center; }
.site-footer p { margin: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .site-header, .site-footer, .actions { display: none; } }
