/* Aidin ส่วนตัว — reading room + life ledger. One memorable element: the date timeline. */
:root {
  --paper: #f3f6f2;
  --surface: #fbfcfa;
  --ink: #14302d;
  --muted: #587069;
  --line: #d3dcd6;
  --teal: #1b6b63;
  --teal-strong: #0e4a44;
  --teal-wash: #e0eee9;
  --marigold: #d99a0b;
  --marigold-ink: #8a5d00;
  --marigold-wash: #fbebbd;
  --brick: #b1402c;
  --brick-wash: #f7dcd5;
  --font: "Sarabun", "Noto Sans Thai", "Thonburi", "Sukhumvit Set", "Leelawadee UI", "Tahoma", system-ui, sans-serif;
  --radius: 10px;
  --nav-h: 3.6rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1816;
    --surface: #15221f;
    --ink: #e4eeea;
    --muted: #93aaa3;
    --line: #28403b;
    --teal: #5fb8ae;
    --teal-strong: #8bd3ca;
    --teal-wash: #173733;
    --marigold: #f2b93b;
    --marigold-ink: #f2c561;
    --marigold-wash: #3a2f10;
    --brick: #e88a76;
    --brick-wash: #3d1f19;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 1.0625rem/1.75 var(--font); padding-bottom: calc(var(--nav-h) + 1rem);
}
a { color: var(--teal-strong); text-underline-offset: 0.2em; }
a:hover { color: var(--teal); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: .5rem; top: .5rem; }
h1, h2, h3 { line-height: 1.4; margin: 0; font-weight: 700; }
h1 { font-size: 1.6rem; margin-bottom: .25rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1.05rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.lead { color: var(--muted); margin: 0 0 1.25rem; }

/* shell + navigation */
.shell { max-width: 56rem; margin: 0 auto; }
main { padding: 1.25rem 1rem 2rem; min-width: 0; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); z-index: 10;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 600; border-top: 3px solid transparent;
}
.nav a[aria-current="page"] { color: var(--teal-strong); border-top-color: var(--teal); background: var(--teal-wash); }
@media (min-width: 920px) {
  body { padding-bottom: 0; }
  .shell { display: grid; grid-template-columns: 12rem minmax(0, 1fr); max-width: 70rem; gap: 1rem; }
  .nav {
    position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; gap: .25rem;
    padding: 2rem .75rem; border-top: 0; border-right: 1px solid var(--line); background: transparent;
  }
  .nav a { flex: none; justify-content: flex-start; padding: .6rem .9rem; border-top: 0; border-left: 3px solid transparent; border-radius: 0 var(--radius) var(--radius) 0; font-size: 1rem; }
  .nav a[aria-current="page"] { border-left-color: var(--teal); }
  main { padding: 2rem 1.5rem 3rem; }
}

/* rows (quiet lists instead of cards) */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows a.title { font-weight: 600; text-decoration: none; }
.rows a.title:hover { text-decoration: underline; }
.row-meta { color: var(--muted); font-size: .92rem; margin: .1rem 0 0; }
.chip {
  display: inline-block; padding: 0 .55rem; border-radius: 999px; font-size: .82rem; line-height: 1.6;
  background: var(--teal-wash); color: var(--teal-strong); white-space: nowrap;
}
.chip.warn { background: var(--marigold-wash); color: var(--marigold-ink); }
.chip.bad { background: var(--brick-wash); color: var(--brick); }

/* the timeline: the one distinctive element */
.timeline { list-style: none; margin: .5rem 0 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--line); }
.timeline > li { position: relative; padding: .15rem 0 1.15rem 1rem; }
.timeline > li::before {
  content: ""; position: absolute; left: -1.25rem; top: .55rem; width: .8rem; height: .8rem; margin-left: -.4rem;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--muted);
}
.timeline > li.soon::before { background: var(--marigold); border-color: var(--marigold); }
.timeline > li.overdue::before { background: var(--brick); border-color: var(--brick); }
.timeline .when { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; font-size: .95rem; }
.timeline .when time { color: var(--muted); }
.timeline .when strong { font-size: 1.05rem; }
.timeline .soon .when strong { color: var(--marigold-ink); }
.timeline .overdue .when strong { color: var(--brick); }
.timeline .what { margin: 0; font-weight: 600; }
.timeline .what a { text-decoration: none; }
.timeline .what a:hover { text-decoration: underline; }
.timeline .detail { margin: 0; color: var(--muted); font-size: .92rem; }
.timeline > li.month { padding: 1rem 0 .25rem 1rem; }
.timeline > li.month::before { display: none; }
.timeline > li.month h3 { font-size: .95rem; color: var(--muted); font-weight: 600; }

/* forms + buttons */
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  padding: .55rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--teal); background: var(--teal); color: var(--paper);
}
.btn:hover { background: var(--teal-strong); color: var(--paper); }
.btn.quiet { background: transparent; color: var(--teal-strong); }
.btn.quiet:hover { background: var(--teal-wash); color: var(--teal-strong); }
label { display: block; font-weight: 600; margin: 1rem 0 .25rem; }
input[type=text], input[type=password], input[type=search], input[type=number] {
  width: 100%; font: inherit; padding: .6rem .75rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.search { display: flex; gap: .5rem; margin: .75rem 0 1rem; }
.search input { flex: 1; }
.error { background: var(--brick-wash); color: var(--brick); padding: .6rem .8rem; border-radius: var(--radius); margin: 1rem 0; }
.notice { background: var(--marigold-wash); color: var(--marigold-ink); padding: .6rem .8rem; border-radius: var(--radius); margin: 1rem 0; }
.empty { color: var(--muted); padding: .75rem 0; }
.solo { max-width: 24rem; margin: 0 auto; padding-top: 14vh; }
body.auth { padding-bottom: 0; }

/* wiki reading */
.crumbs { color: var(--muted); font-size: .92rem; margin-bottom: .5rem; }
.prose { max-width: 40rem; font-size: 1.125rem; line-height: 1.9; overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { margin: 1.8rem 0 .4rem; }
.prose h1 { font-size: 1.4rem; } .prose h2 { font-size: 1.2rem; } .prose h3 { font-size: 1.08rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: .25rem 0; }
.prose blockquote { margin: 1rem 0; padding: .1rem 1rem; border-left: 3px solid var(--teal); color: var(--muted); }
.prose code { font-size: .92em; background: var(--teal-wash); padding: .05rem .3rem; border-radius: 4px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); padding: .75rem; overflow-x: auto; border-radius: var(--radius); }
.prose a.dead { color: var(--muted); text-decoration: none; pointer-events: none; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.prose table { border-collapse: collapse; min-width: 100%; font-size: .98rem; line-height: 1.6; }
.prose th, .prose td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.prose th { background: var(--teal-wash); }
.read-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1rem 0; }
.transcript { white-space: pre-wrap; font-size: .95rem; line-height: 1.7; color: var(--muted); max-width: 40rem; overflow-wrap: anywhere; }
details > summary { cursor: pointer; font-weight: 600; margin: 1rem 0 .5rem; }

/* facts (car, renewals) */
.facts { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: .15rem 1rem; margin: .5rem 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.block { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }

/* charts + graph */
.chart { width: 100%; max-width: 28rem; height: auto; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-line { stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--marigold); stroke: var(--paper); stroke-width: 2; }
.chart-label { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.graph-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; touch-action: manipulation; }
.graph-box svg { display: block; width: 100%; height: auto; }
.graph-edge { stroke: var(--line); stroke-width: 1.2; }
.graph-node { fill: var(--teal); stroke: var(--paper); stroke-width: 2; }
.graph-node-label { fill: var(--ink); font-size: 11px; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.graph-box a:focus-visible .graph-node, .graph-box a:hover .graph-node { fill: var(--marigold); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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