:root {
  --bg: #fbfbfa;
  --fg: #1a1a19;
  --muted: #6f6f6a;
  --faint: #c9c9c4;
  --line: #ebebe7;
  --hover: #f3f3f0;
  --accent: #b5552e;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  color-scheme: light;
}

/* The explicit setting wins over the operating system preference. */
:root[data-theme="dark"] {
  --bg: #111110;
  --fg: #ededea;
  --muted: #94948e;
  --faint: #4a4a47;
  --line: #232321;
  --hover: #1a1a19;
  --accent: #e0805a;
  color-scheme: dark;
}

/* Preserve the system theme when JavaScript is unavailable. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111110;
    --fg: #ededea;
    --muted: #94948e;
    --faint: #4a4a47;
    --line: #232321;
    --hover: #1a1a19;
    --accent: #e0805a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--faint) var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 14.5px/1.6 var(--sans);
  letter-spacing: -0.006em;
}

::selection { background: var(--fg); color: var(--bg); }

a, .link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s var(--ease), color 0.2s var(--ease);
}
a:hover, .link:hover { text-decoration-color: currentColor; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 11px; }

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 96px 24px 120px;
}

/* header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.id p { margin: 0; }
h1 {
  margin: 0;
  font: 400 26px/1.1 var(--serif);
  letter-spacing: -0.01em;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  transition: transform 0.4s var(--ease);
}
.avatar:hover { transform: rotate(-6deg) scale(1.06); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.header-tools { display: flex; align-items: center; gap: 16px; flex: none; }
.theme-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--fg); background: var(--hover); border-color: var(--faint); }
.theme-sun, :root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }

.places { color: var(--muted); flex: none; }
.place-list { list-style: none; margin: 0; padding: 0; display: grid; row-gap: 4px; }
.place-row { display: grid; grid-template-columns: 4ch 8ch 62px; column-gap: 10px; align-items: center; white-space: nowrap; }
.place-name { text-decoration: none; }
.place-time { text-align: right; }
.place-weather { display: flex; align-items: center; justify-content: flex-end; gap: 6px; text-decoration: none; }
.place-weather:hover { color: var(--fg); }
.weather-icon { display: block; flex: none; }
.place-weather [data-temperature] { min-width: 5ch; text-align: right; }

/* sections */
.block {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.label {
  margin: 0;
  padding-top: 3px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
}
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin: 0; }
.lede { margin: 0 0 12px; }

/* rows */
.rows { list-style: none; margin: -6px 0 0; padding: 0; }
.rows > li { border-radius: 8px; transition: opacity 0.25s var(--ease), background 0.2s var(--ease); }
.rows summary, .row-static {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 10px;
  margin: 0 -10px;
}
.rows summary { cursor: pointer; list-style: none; border-radius: 8px; }
.rows summary::-webkit-details-marker { display: none; }
.rows summary:hover { background: var(--hover); }
.row-main { display: flex; gap: 10px; align-items: baseline; min-width: 0; flex-wrap: wrap; }
.row-title { font-weight: 500; white-space: nowrap; }
.row-sub { color: var(--muted); }
.row-meta { color: var(--muted); white-space: nowrap; flex: none; }
.rows details > p {
  margin: 0;
  padding: 2px 0 12px;
  color: var(--muted);
  max-width: 46ch;
  animation: drop 0.35s var(--ease);
}
.rows details[open] summary .row-sub { color: var(--fg); }
@keyframes drop { from { transform: translateY(-4px); } to { transform: none; } }
.invest .row-title { color: var(--fg); }

/* watches */
.watches {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 16px;
}
.watch { display: flex; flex-direction: column; gap: 10px; }
.watch-winder { display: block; width: 100%; border-radius: 50%; }
.watch-winder:focus-visible { border-radius: 50%; }
.watch svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  transition: transform 0.5s var(--ease);
}
.watch:hover svg { transform: rotate(-4deg) scale(1.04); }
.watch.is-winding .case { stroke: var(--accent); }
.watch-cap { display: flex; flex-direction: column; line-height: 1.35; }
.watch-cap b { font-weight: 500; }
.watch-cap span { color: var(--muted); font-size: 12.5px; }
.hand { transform-origin: 50px 50px; }

/* flight log */
.flight-map-frame { position: relative; }
.flight-map {
  display: block;
  width: 100%;
  height: auto;
  font: 24px var(--mono);
}
.flight-map-land { fill: var(--hover); stroke: var(--faint); stroke-width: 2.8; }
.flight-map-borders { fill: none; stroke: color-mix(in srgb, var(--faint) 75%, var(--bg)); stroke-width: 1.8; }
.flight-map-routes { fill: none; stroke: var(--accent); stroke-width: 3.7; stroke-linejoin: round; }
.flight-map-history { stroke-opacity: 0.48; stroke-width: 2.8; }
.flight-map-pins { fill: var(--bg); stroke: var(--accent); stroke-width: 3.7; }
.flight-map-airports { fill: var(--fg); }
.flight-city-controls { position: absolute; inset: 0; pointer-events: none; }
.flight-city {
  position: absolute;
  left: var(--city-x);
  top: var(--city-y);
  translate: -50% -50%;
  width: 52px;
  height: 36px;
  pointer-events: auto;
}
.flight-map-enabled .flight-map-airports text {
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 4px;
}
.flight-map-has-city .flight-map-routes path { stroke-opacity: 0.24; }
.flight-map-has-city .flight-map-routes .is-city-highlighted { stroke-opacity: 1; stroke-width: 4.4; }
.flight-map-pins .is-city-highlighted { fill: var(--accent); }
.flight-map-airports .is-city-highlighted { fill: var(--accent); text-decoration-color: currentColor; }
.flight-city-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.flight-city-note p { margin: 0; }
.flight-city-name { font-weight: 500; }
.flight-city-note p + p { margin-top: 3px; }
.case { fill: var(--bg); stroke: var(--fg); }
.ink { fill: var(--fg); }
.ink-s { stroke: var(--fg); }
.mute-s { stroke: var(--muted); }
.mute { fill: var(--muted); }
.acc { fill: var(--accent); }
.acc-s { stroke: var(--accent); }

/* tags */
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.tags li:hover { border-color: var(--faint); background: var(--hover); }
.tags li span { color: var(--muted); }
.tags li span::before { content: "· "; }
.tags li.has-squash-game { padding: 0; }
.squash-trigger { display: block; padding: 3px 10px; border-radius: 999px; }
.squash-trigger:focus-visible { border-radius: 999px; }
.watch-winder, .squash-trigger, .squash-close, .squash-play { -webkit-tap-highlight-color: transparent; }

/* A court tucked behind the squash interest. */
.squash-dialog {
  width: min(456px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--faint);
  border-radius: 14px;
  color: var(--fg);
  background: var(--bg);
  overscroll-behavior: contain;
}
.squash-dialog::backdrop { background: color-mix(in srgb, var(--bg) 85%, transparent); }
.squash-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.squash-heading h2 { margin: 0; font: 400 30px/1.1 var(--serif); letter-spacing: -0.01em; }
.squash-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.squash-close:hover { border-color: var(--faint); background: var(--hover); }
.squash-message { margin: 4px 0 24px; font-size: 13px; min-height: 1.6em; }
.squash-scoreboard { display: flex; justify-content: space-between; color: var(--muted); }
.squash-scoreboard b { margin-left: 8px; color: var(--fg); font-weight: 500; }
.squash-court { width: 100%; margin: 8px 0 16px; touch-action: none; }
.squash-court svg { display: block; width: 100%; height: auto; }
.court-floor { fill: var(--hover); stroke: var(--muted); stroke-width: 1; }
.court-lines { fill: none; stroke: var(--faint); stroke-width: 1; }
.court-front { stroke: var(--accent); stroke-width: 3; }
.court-label { fill: var(--muted); font: 10px var(--mono); }
.squash-racket { fill: var(--fg); }
.squash-ball { fill: var(--accent); }
.squash-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.squash-controls p { margin: 0; font-size: 11.5px; line-height: 1.6; }
.squash-play {
  min-width: 92px;
  min-height: 44px;
  padding: 10px 16px;
  flex: none;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.squash-play:hover { background: var(--bg); color: var(--fg); }
@media (max-width: 480px) {
  .court-label { font-size: 16px; }
}
@media (max-width: 380px) {
  .squash-dialog { padding: 16px; }
  .squash-heading h2 { font-size: 26px; }
  .squash-controls { gap: 8px; }
  .squash-play { min-width: 80px; padding-inline: 12px; }
}

/* footer */
.links { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot p { margin: 0; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  width: max-content;
  max-width: calc(100vw - 40px);
  text-align: center;
  overflow-wrap: anywhere;
  transform: translate(-50%, 16px);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* portrait */
.portrait {
  padding: 0;
  border: 0;
  background: none;
  width: min(360px, 80vw, calc(80vh * 3 / 4));
  border-radius: 14px;
  overflow: hidden;
}
.portrait img { display: block; width: 100%; height: auto; }
.portrait-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--fg);
  background: var(--bg);
}
.portrait-close:hover { background: var(--hover); }
.portrait::backdrop { background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(8px); }
.portrait[open] { animation: pop 0.4s var(--ease); }
@keyframes pop { from { transform: scale(0.96) translateY(8px); } }

/* entrance: transform only so content is visible without JS */
.rise { animation: rise 0.9s var(--ease) both; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise { from { transform: translateY(10px); } }

@media (max-width: 640px) {
  .page { padding: 56px 20px 96px; }
  .top { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin-bottom: 24px; gap: 16px; }
  .header-tools { display: contents; }
  .theme-toggle { grid-column: 2; grid-row: 1; }
  .places { grid-column: 1 / -1; grid-row: 2; width: fit-content; }
  .block { grid-template-columns: 1fr; gap: 12px; padding: 24px 0; }
  .watches { grid-template-columns: repeat(2, 1fr); gap: 24px 20px; }
  .flight-map { font-size: 34px; }
  .flight-city { height: 24px; }
  .row-main { flex-direction: column; gap: 0; }
  .row-title { white-space: normal; }
}

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

.stack .row-main { flex-direction: column; gap: 0; }
.stack .row-title { white-space: normal; }
.watch-cap span + span { color: var(--muted); }
