/*
 * status.mytravia.app in the Travia "Field Journal" v1 identity (screens W3-W6
 * of docs/SCREENS.md). Tokens and components are ported from the Flutter
 * repo's design/v1/assets/travia.css. Dark mode is the same journal at night.
 */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url(/fonts/figtree-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url(/fonts/figtree-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/bricolage-grotesque-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #2b2118; --ink2: #55473a; --muted: #6f5f50; --line: #e6d9c4; --line2: #d6c6ac;
  --paper: #fbf6ec; --card: #fffdf8; --cream: #f5eddd;
  --sage: #8fa77a; --sage-d: #47643a; --sage-l: #e4ecda;
  --car: #c98a4b; --car-d: #8e521c; --car-l: #f6e6d2;
  --sun: #f2d46b; --sun-l: #fbf1c9; --sun-t: #7a5b00;
  --sky: #356686; --sky-l: #dde9f0;
  --red: #b23a26; --red-l: #f7e0d9;
  --shadow: #2b2118;
  --ban-info: #1f4359; --ban-warn: #5c4500; --ban-warn-line: #c9a227; --ban-err: #6e2012; --ban-ok: #2f4724;
  --r: 16px; --sh: 3px 3px 0 var(--shadow);
  --fd: 'Bricolage Grotesque', system-ui, sans-serif;
  --fb: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22220%22%20height%3D%22220%22%3E%3Cfilter%20id%3D%22n%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%22.85%22%20numOctaves%3D%223%22%20stitchTiles%3D%22stitch%22%2F%3E%3CfeColorMatrix%20values%3D%220%200%200%200%20.35%20%200%200%200%200%20.25%20%200%200%200%200%20.15%20%200%200%200%20.07%200%22%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20filter%3D%22url%28%23n%29%22%2F%3E%3C%2Fsvg%3E");
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3ead8; --ink2: #ddd0bb; --muted: #b5a48f; --line: #463a2f; --line2: #5c4c3e;
    --paper: #1d1712; --card: #2b2118; --cream: #251d16;
    --sage-l: #2f3d27; --car-l: #3d2a19; --sun-l: #3b3216; --sun-t: #f2d46b; --sky-l: #1c2d38; --red-l: #3e1d16;
    --shadow: #0b0806;
    --ban-info: #c9dce8; --ban-warn: #f2e2a6; --ban-err: #f2c7bd; --ban-ok: #cfdec2;
    --grain: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
  font: 14px/1.5 var(--fb);
}
a { color: var(--sage-d); font-weight: 600; text-underline-offset: 3px; }
@media (prefers-color-scheme: dark) { a { color: #a9c294; } }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--fd); color: var(--ink); letter-spacing: -0.02em; margin: 0; }
[hidden] { display: none !important; }

/* helpers */
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.end { text-align: end; }
.p { font-size: 15px; line-height: 1.5; color: var(--ink2); margin: 0; }
.small { font-size: 13px; line-height: 1.4; color: var(--muted); margin: 0; }
.tiny { font-size: 11.5px; line-height: 1.3; color: var(--muted); letter-spacing: 0.02em; }
[dir='rtl'] .flip { transform: scaleX(-1); }

/* icons (stroke icons from design/v1/source/icons.py) */
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.s { width: 18px; height: 18px; } .ic.xs { width: 15px; height: 15px; } .ic.l { width: 28px; height: 28px; }
.lic { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--cream); color: var(--ink); }
.lic.sage { background: var(--sage-l); color: var(--sage-d); } .lic.car { background: var(--car-l); color: var(--car-d); }
.lic.sun { background: var(--sun-l); color: var(--sun-t); } .lic.sky { background: var(--sky-l); color: var(--sky); }
.lic.red { background: var(--red-l); color: var(--red); }
.lic.big { width: 48px; height: 48px; border-radius: 14px; }
@media (prefers-color-scheme: dark) {
  .lic.sage { color: #cfdec2; } .lic.sky { color: #c9dce8; } .lic.red { color: #f2c7bd; } .lic.car { color: #e0a96f; }
}

/* top bar (.dtop) */
.dtop {
  min-height: 58px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 20px; border-bottom: 1.5px solid var(--ink); background: var(--card);
}
@media (prefers-color-scheme: dark) { .dtop { border-bottom-color: var(--shadow); } }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--fd); font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; }
.top-links { display: flex; align-items: center; gap: 14px; }
.top-links a, .linkish {
  color: var(--ink2); text-decoration: none; font: inherit; font-weight: 600; font-size: 13.5px;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.top-links a:hover, .linkish:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--car); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line2); background: var(--card); font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.chip select { font: inherit; color: inherit; background: transparent; border: 0; padding: 0; cursor: pointer; }
.chip select option { background: var(--card); color: var(--ink); }
@media (max-width: 640px) {
  .top-links { order: 3; width: 100%; }
}

/* page (.dmain) */
.dmain { max-width: 1120px; margin: 0 auto; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 18px; }
.dmain > section, #detail { display: flex; flex-direction: column; gap: 18px; }
.dhead { display: flex; flex-direction: column; gap: 4px; }
.dhead h1 { font-size: 28px; font-weight: 800; }
.dhead .sub { font-size: 14px; }
.panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 14px; align-items: start; }
.panels:empty { display: none; }

/* panels (.dpanel) */
.dpanel {
  background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh);
  padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
@media (prefers-color-scheme: dark) { .dpanel { border-color: var(--shadow); } }
.dpanel h2, .dpanel h3 { font-size: 17px; font-weight: 700; }
.dpanel h3 a { color: var(--ink); }
.dpanel ul, .dpanel ol { margin: 0; padding-inline-start: 20px; color: var(--ink2); }
.line { padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.line.top { align-items: flex-start; }
.line .body { margin: 0 0 2px; color: var(--ink2); }
.component { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.component strong { font-size: 13.5px; font-weight: 700; }

/* tags (.tag) */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--cream); color: var(--ink2); }
.tag.sage { background: var(--sage-l); color: var(--sage-d); } .tag.sun { background: var(--sun-l); color: var(--sun-t); }
.tag.sky { background: var(--sky-l); color: var(--sky); } .tag.red { background: var(--red-l); color: var(--red); }
@media (prefers-color-scheme: dark) {
  .tag.sage { color: #cfdec2; } .tag.sky { color: #c9dce8; } .tag.red { color: #f2c7bd; }
}

/* banners (.ban) and the status hero */
.ban { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; border: 1.5px solid; margin: 0; }
.ban.info { background: var(--sky-l); border-color: var(--sky); color: var(--ban-info); }
.ban.warn { background: var(--sun-l); border-color: var(--ban-warn-line); color: var(--ban-warn); }
.ban.err { background: var(--red-l); border-color: var(--red); color: var(--ban-err); }
.ban.ok { background: var(--sage-l); border-color: var(--sage); color: var(--ban-ok); }
.ban.hero {
  align-items: center; padding: 20px 22px; border-width: 2px; border-radius: 18px;
  font-family: var(--fd); font-size: 18px; font-weight: 800; letter-spacing: -0.01em;
  min-height: 72px;
  animation: pop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.ban.hero:not(.ok, .warn, .err, .info) { background: var(--card); border-color: var(--line2); }
.ban.hero .btn { font-family: var(--fd); }

/* buttons (.btn) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: 16px; font-family: var(--fd); font-weight: 700; font-size: 16px; text-decoration: none;
  border: 2px solid var(--shadow); cursor: pointer; white-space: nowrap; transition: transform 0.12s, box-shadow 0.12s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.primary { background: var(--sage-d); color: #fff; box-shadow: var(--sh); }
.btn.secondary { background: var(--card); color: var(--ink); box-shadow: var(--sh); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sage-d); min-height: 44px; }
.btn.sm { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; border-width: 1.5px; box-shadow: 2px 2px 0 var(--shadow); }
.btn.sm.ghost { box-shadow: none; padding-inline: 4px; }
.btn.full { width: 100%; }
.back { align-self: flex-start; }
@media (prefers-color-scheme: dark) { .btn.ghost { color: #a9c294; } }
.ib { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--card); border: 1.5px solid var(--line2); color: var(--ink); cursor: pointer; }
.ib:disabled { opacity: 0.4; cursor: default; }
.pager { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }

/* uptime bars (.upt) */
.upt { display: flex; gap: 2px; height: 30px; direction: ltr; }
.upt i { flex: 1; border-radius: 2px; background: var(--sage); display: block; }
.upt i.degraded { background: var(--sun); }
.upt i.partial_outage { background: var(--car); }
.upt i.major_outage { background: var(--red); }
.upt i.maintenance { background: var(--sky); }
.upt i.nodata { background: var(--line); }
.legend { gap: 8px; }
@media (max-width: 560px) {
  .upt i:nth-child(-n + 45) { display: none; }
}

/* segmented control (.seg) for ranges and email/webhook */
.seg { display: flex; padding: 4px; border-radius: 14px; background: var(--cream); border: 1.5px solid var(--line); }
.seg > button, .seg > label {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: 10px; font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--muted); background: transparent; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg > button[aria-selected='true'], .seg > label:has(input:checked) { background: var(--card); color: var(--ink); box-shadow: 0 1px 0 var(--line2), 0 0 0 1.5px var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg > label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

/* response time charts */
.charts { display: grid; gap: 14px; }
.chart { display: flex; flex-direction: column; gap: 4px; }
.chart-head strong { font-size: 13.5px; }
.chart svg { width: 100%; height: 110px; display: block; background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px; }
.chart .p50 { stroke: var(--sage-d); fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart .p95 { stroke: var(--car); fill: none; stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
@media (prefers-color-scheme: dark) { .chart .p50 { stroke: var(--sage); } }

/* empty states with the capybara */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; text-align: center; }
.mascot { display: flex; flex-direction: column; align-items: center; }
.mascot img { display: block; animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.ground { width: 60%; height: 12px; margin: -6px auto 0; border-radius: 50%; background: rgba(43, 33, 24, 0.09); }

/* postmortem timeline (.tl) */
.tl { position: relative; list-style: none; padding-inline-start: 26px !important; display: flex; flex-direction: column; gap: 14px; }
.tl::before { content: ''; position: absolute; inset-inline-start: 8px; top: 6px; bottom: 6px; border-inline-start: 2px dashed var(--line2); }
.tl .ti { position: relative; display: flex; flex-direction: column; gap: 2px; color: var(--ink2); }
.tl .ti::before { content: ''; position: absolute; inset-inline-start: -24px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--sage); border: 2px solid var(--ink); }

/* W6 result card (.authcard) */
.authcard {
  width: 100%; max-width: 440px; margin: 40px auto; background: var(--card); border: 2px solid var(--ink); border-radius: 24px;
  box-shadow: 5px 5px 0 var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.authcard .app-row { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1.5px solid var(--line); }
.authcard h1 { font-size: 24px; font-weight: 800; margin-top: 4px; }

/* W5 subscribe dialog (.dlg) */
dialog.dlg {
  width: 560px; max-width: calc(100% - 32px); padding: 22px 20px 16px; color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: 24px; box-shadow: 5px 5px 0 var(--shadow);
}
dialog.dlg[open] { animation: dlg 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
dialog.dlg::backdrop { background: rgba(43, 33, 24, 0.42); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h2 { font-size: 22px; font-weight: 800; }
.inp {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--card);
  border: 1.5px solid var(--line2); font: inherit; font-size: 15px; color: var(--ink);
}
.inp:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--sun-l); }
.inp::placeholder { color: #9a8b7a; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 13px; font-weight: 700; color: var(--ink2); padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow: auto; padding: 2px; }
.checks .chip { height: 34px; cursor: pointer; font-size: 13px; }
.checks .chip input { position: absolute; opacity: 0; pointer-events: none; }
.checks .chip:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.checks .chip:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
#subscribe-result:empty { display: none; }
.dialog-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.feeds { margin-inline-end: auto; }

/* motion */
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dlg { from { transform: translateY(6%) scale(0.86); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
