/* Andreas Dörnbrack – personal pages and arctic ECMWF viewer */

:root {
  --bg: #ffffff;
  --surface: #f5f7fa;
  --border: #dde3ea;
  --text: #1d2733;
  --muted: #5d6b7a;
  --accent: #1560bd;
  --accent-soft: #e3edfa;
  --an: #8aa4c2;        /* analysis frames in the timeline */
  --fc: #e39a3b;        /* forecast frames */
  --now: #1d2733;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --border: #2c3542;
    --text: #e3e8ee;
    --muted: #9aa7b6;
    --accent: #6aa6ef;
    --accent-soft: #1f3048;
    --an: #5f7c9e;
    --fc: #d08a2e;
    --now: #e3e8ee;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.site-header .inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 32px;
}
.site-name { font-weight: 600; font-size: 1.1rem; color: var(--text); }
.site-name:hover { text-decoration: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 4px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
}
.site-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 32px 16px 48px; }
main.narrow { max-width: 820px; }

h1 { font-size: 1.75rem; font-weight: 600; line-height: 1.25; margin-bottom: 8px; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 32px 0 12px; }
p { margin-bottom: 12px; }
.lead { color: var(--muted); margin-bottom: 24px; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.site-footer a { color: var(--muted); }

/* ---------------------------------------------------------------- home */
.profile { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.profile img {
  width: 220px;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.profile address { font-style: normal; }
.profile dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; margin-top: 16px; }
.profile dt { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 32px; }
.card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card strong { display: block; color: var(--accent); margin-bottom: 4px; }
.card span { color: var(--muted); font-size: 0.92rem; }

/* ---------------------------------------------------------------- publications */
.pub-topic { margin-top: 32px; }
.pub-list { list-style: none; }
.pub-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.pub-list .year { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }
.pub-list .journal { font-style: italic; }
.placeholder {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------------------------------------------------------------- viewer */
.viewer { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .viewer { grid-template-columns: minmax(0, 1fr); } }

.controls { display: flex; flex-direction: column; gap: 20px; }
.control-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.segmented { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented button {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.group + .group { margin-top: 8px; }
.group > button {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.group .items { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.group:not(.open) .items { display: none; }
.items button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.items button:hover { border-color: var(--accent); }
.items button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.stage { min-width: 0; }
.frame-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; min-height: 1.6em; }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
}
.badge.an { background: var(--an); }
.badge.fc { background: var(--fc); }
.frame-info .valid { font-weight: 600; font-variant-numeric: tabular-nums; }
.frame-info .meta { color: var(--muted); font-size: 0.9rem; }

.image-box {
  position: relative;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.image-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.image-box .missing {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #5d6b7a;
  background: #f5f7fa;
  font-size: 0.95rem;
}
.image-box.is-missing .missing { display: flex; }
.image-box.is-missing img { visibility: hidden; }

.loading { height: 3px; max-width: 760px; background: transparent; margin-top: 6px; border-radius: 2px; overflow: hidden; }
.loading > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.player { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 10px; max-width: 760px; }
.player button, .player select {
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.player button:hover { border-color: var(--accent); }
.player .play { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 64px; }
.player .spacer { flex: 1; }

/* timeline: one cell per 6-hourly frame */
.timeline { max-width: 760px; user-select: none; }
.cells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1px; height: 26px; cursor: pointer; }
.cells div { background: var(--an); opacity: 0.55; border-radius: 1px; }
.cells div.fc { background: var(--fc); }
.cells div.day { margin-left: 2px; }
.cells div.missing { opacity: 0.18; }
.cells div:hover { opacity: 0.85; }
.cells div.current { background: var(--now); opacity: 1; }
.days { position: relative; height: 18px; margin-top: 4px; font-size: 0.72rem; color: var(--muted); }
.days span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 0.82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.notes { margin-top: 28px; max-width: 760px; color: var(--muted); font-size: 0.9rem; }
.notes p { margin-bottom: 8px; }
kbd {
  font: 0.8rem var(--font);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

.year-index { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-bottom: 8px; }
.year-index a {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.year-index a:hover { border-color: var(--accent); text-decoration: none; }
.pub-list { font-size: 0.95rem; }
.pub-list a { overflow-wrap: anywhere; }
.pub-topic h2 { scroll-margin-top: 16px; }
