/*
 * The status page, in Rosa's colors and type.
 *
 * Served as a file, so it is cached and costs the Worker nothing. Light by
 * default, dark when the visitor's device is dark, the same tokens as
 * rosarealism.com.
 */

:root {
  color-scheme: light;
  --bg: #f5ede5;
  --wash: #efe2d4;
  --surface: #f9f4ee;
  --raised: #fbf7f2;
  --sunken: #efe6dc;
  --line: rgba(92, 61, 46, 0.14);
  --edge: rgba(92, 61, 46, 0.26);
  --ink: #3b2a1f;
  --muted: #6b584b;
  --faint: #8a776a;
  --forest: #4a5c3d;
  --accent: #556232;
  --on-accent: #f5ede5;
  --shadow: 0 1px 2px -1px rgb(92 61 46 / 0.18), 0 6px 18px -10px rgb(92 61 46 / 0.35);

  --operational: #4f8a4b;
  --degraded: #c2703f;
  --down: #b54848;
  --maintenance: #3d6976;
  --unmonitored: #9a8f84;
  --empty: rgba(92, 61, 46, 0.14);

  --display: 'Fraunces', ui-serif, Georgia, serif;
  --sans: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #191410;
    --wash: #211a15;
    --surface: #1f1914;
    --raised: #241d17;
    --sunken: #16110d;
    --line: rgba(230, 219, 205, 0.1);
    --edge: rgba(230, 219, 205, 0.2);
    --ink: #e6dbcd;
    --muted: #b8aa9b;
    --faint: #8f8375;
    --forest: #a9c08c;
    --accent: #a8bd7f;
    --on-accent: #191410;
    --shadow: 0 1px 2px -1px rgb(0 0 0 / 0.4), 0 8px 22px -12px rgb(0 0 0 / 0.6);

    --operational: #7fb873;
    --degraded: #e3a06d;
    --down: #e58b8b;
    --maintenance: #7fb8c9;
    --unmonitored: #7b7167;
    --empty: rgba(230, 219, 205, 0.1);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(60rem 30rem at 50% -10rem, var(--wash), transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute; left: -999px; top: 12px; z-index: 10;
  background: var(--forest); color: var(--on-accent); padding: 10px 16px; border-radius: 999px;
}
.skip:focus { left: 16px; }

.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* ------------------------------------------------------------- header */

.top { padding: 22px 0 0; }
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--forest); text-decoration: none; min-width: 0; }
.brand img { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.brand-name { font: 500 1.3rem/1.1 var(--display); letter-spacing: -0.01em; }
.brand-sub { display: block; font: 500 0.72rem/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin-top: 5px; }
.actions { display: flex; gap: 8px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  font: 500 0.92rem/1 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid var(--edge); background: transparent; color: var(--ink);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.button:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.button.primary { background: var(--forest); border-color: var(--forest); color: var(--on-accent); box-shadow: var(--shadow); }
.button.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.tabs { display: flex; gap: 8px; margin-top: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 44px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem;
}
.tabs a:hover { color: var(--ink); border-color: var(--edge); }
.tabs a[aria-current='page'] { background: var(--raised); color: var(--ink); border-color: var(--edge); box-shadow: var(--shadow); }

main { padding: 28px 0 56px; }

h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -0.01em; color: var(--forest); margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); line-height: 1.15; }
h2 { font-size: 1.35rem; line-height: 1.2; }
h3 { font-size: 1.08rem; line-height: 1.3; }
p { margin: 0; }
.lead { color: var(--muted); margin-top: 8px; max-width: 46rem; }
.small { font-size: 0.86rem; }
.faint { color: var(--faint); }
.muted { color: var(--muted); }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.card { background: var(--raised); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.pad { padding: 20px; }
@media (min-width: 640px) { .pad { padding: 22px 26px; } }

/* ------------------------------------------------------------- states */

.s-operational { --state: var(--operational); }
.s-degraded { --state: var(--degraded); }
.s-down { --state: var(--down); }
.s-maintenance { --state: var(--maintenance); }
.s-unmonitored { --state: var(--unmonitored); }

.state-icon { color: var(--state); display: inline-flex; flex: none; }
.state-word { color: var(--state); font-weight: 500; font-size: 0.9rem; white-space: nowrap; }

/* ------------------------------------------------------------- banner */

.banner { border-radius: 20px; border: 1px solid color-mix(in srgb, var(--state) 40%, transparent);
  background: color-mix(in srgb, var(--state) 12%, var(--raised)); box-shadow: var(--shadow); }
.banner > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 20px 22px; }
.banner > summary::-webkit-details-marker { display: none; }
.banner .big-icon { color: var(--state); display: inline-flex; }
.banner h1 { color: var(--ink); font-size: clamp(1.4rem, 3.4vw, 1.85rem); }
.banner .checked { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.banner .chev { margin-left: auto; color: var(--faint); transition: transform 0.2s; display: inline-flex; }
.banner[open] .chev { transform: rotate(180deg); }
.banner .about { margin: 0 22px 20px; padding-left: 14px; border-left: 3px solid var(--state); color: var(--muted); max-width: 46rem; }

/* ------------------------------------------------------------- notes and incidents */

.event { border-left: 4px solid var(--state); }
.event + .event { margin-top: 12px; }
.event-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 500;
  color: var(--state, var(--muted)); background: color-mix(in srgb, var(--state, var(--muted)) 14%, transparent); white-space: nowrap; }
.body-text { white-space: pre-wrap; color: var(--ink); margin-top: 10px; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: 0.86rem; color: var(--muted); }
.facts b { font-weight: 500; color: var(--ink); }
.timeline { list-style: none; margin: 16px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding-bottom: 14px; }
.timeline li::before { content: ''; position: absolute; left: -22px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--state, var(--faint)); box-shadow: 0 0 0 3px var(--raised); }
.timeline .when { font-size: 0.82rem; color: var(--faint); }

/* ------------------------------------------------------------- components */

.group + .group { margin-top: 30px; }
.group-head { margin-bottom: 12px; }
.group-head p { color: var(--faint); font-size: 0.86rem; margin-top: 2px; }

.component { overflow: hidden; }
.component + .component { margin-top: 10px; }
.component > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px; padding: 16px 18px; min-height: 64px; }
.component > summary::-webkit-details-marker { display: none; }
.component > summary:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.component .name { font-weight: 500; color: var(--ink); }
.component .about { color: var(--faint); font-size: 0.84rem; }
.component .right { display: flex; align-items: center; gap: 12px; }
.component .uptime { color: var(--muted); font-size: 0.86rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.component .chev { color: var(--faint); display: inline-flex; transition: transform 0.2s; }
.component[open] .chev { transform: rotate(180deg); }
@media (max-width: 560px) {
  .component > summary { grid-template-columns: auto 1fr auto; }
  .component .uptime { display: none; }
}
.component-body { border-top: 1px solid var(--line); padding: 8px 18px 18px; }

.parts { list-style: none; margin: 0; padding: 0; }
.parts li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.parts li:last-child { border-bottom: 0; }
.parts .part-name { font-size: 0.94rem; }
.parts .part-about { font-size: 0.8rem; color: var(--faint); }
.parts .grow { flex: 1; min-width: 0; }

.months { margin-top: 14px; display: grid; gap: 16px; }
.month-head { display: flex; justify-content: space-between; font-size: 0.86rem; color: var(--muted); margin-bottom: 7px; font-variant-numeric: tabular-nums; }

.bar { display: flex; align-items: center; gap: 4px; min-height: 14px; }
.run { height: 6px; border-radius: 999px; background: var(--state, var(--empty)); min-width: 6px; }
.run.none { background: var(--empty); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--state); flex: none; cursor: help; position: relative; }
.dot:focus-visible { outline-offset: 2px; }

/* The hover note on a day. Text, not color: it says the date and the minutes. */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 15rem; white-space: pre-line; z-index: 5;
  background: var(--ink); color: var(--bg); font-size: 0.78rem; line-height: 1.4; padding: 7px 10px; border-radius: 10px; pointer-events: none;
}

.strip { display: flex; gap: 2px; align-items: flex-end; height: 34px; }
.strip span { flex: 1; border-radius: 3px; background: var(--state, var(--operational)); min-height: 4px; }
.strip span.none { background: var(--empty); }

.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 30px; font-size: 0.86rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

/* ------------------------------------------------------------- tiles */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { padding: 16px 18px; }
.tile .label { font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 500; }
.tile .value { font: 500 1.9rem/1.1 var(--display); margin-top: 6px; color: var(--state, var(--ink)); font-variant-numeric: tabular-nums; }

.where { display: flex; align-items: center; gap: 14px; }
.where .pin { color: var(--accent); display: inline-flex; }

.latency { display: grid; gap: 10px; }
.latency .row { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 16px 18px; }
@media (min-width: 720px) { .latency .row { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; align-items: center; } }
.latency .numbers { display: flex; gap: 16px; font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.latency .numbers b { color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------- history */

.years { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.years a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.years a[aria-current='page'] { background: var(--raised); color: var(--ink); border-color: var(--edge); box-shadow: var(--shadow); }

.month { overflow: hidden; }
.month + .month { margin-top: 10px; }
.month > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-height: 60px; }
.month > summary::-webkit-details-marker { display: none; }
.month .chev { color: var(--faint); display: inline-flex; transition: transform 0.2s; }
.month[open] .chev { transform: rotate(180deg); }
.month .month-name { font: 500 1.1rem/1.2 var(--display); color: var(--ink); }
.month .month-up { margin-left: auto; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.month-body { padding: 0 18px 18px; }
.day-list { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 3px solid var(--line); }
.day-list > li { padding: 10px 0 14px; }
.day-list .day { font-size: 0.9rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.day-list .day span { color: var(--faint); margin-left: 6px; }
.entry { margin-top: 10px; padding-left: 14px; border-left: 3px solid var(--state, var(--edge)); }
.entry .body-text { color: var(--muted); }

/* ------------------------------------------------------------- forms */

.form { display: grid; gap: 14px; max-width: 40rem; }
label.field { display: grid; gap: 6px; font-weight: 500; font-size: 0.94rem; }
.hint { font-weight: 400; font-size: 0.84rem; color: var(--faint); }
input[type='url'], input[type='text'] {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--edge);
  background: var(--surface); color: var(--ink); font: 400 0.95rem var(--sans);
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.notice { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.notice.good { border-color: color-mix(in srgb, var(--operational) 45%, transparent); background: color-mix(in srgb, var(--operational) 10%, var(--surface)); }
.notice.bad { border-color: color-mix(in srgb, var(--down) 45%, transparent); background: color-mix(in srgb, var(--down) 10%, var(--surface)); }
ol.steps { margin: 10px 0 0; padding-left: 20px; color: var(--muted); }
ol.steps li { margin: 4px 0; }

.pager { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

footer.foot { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--faint); font-size: 0.86rem; }
footer.foot .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; }

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

/* Days still to come this month: there, but quieter than a day with no data. */
.run.future { background: var(--empty); opacity: 0.45; }

/* On a phone the three tabs share the width, so none is cut off. */
@media (max-width: 480px) {
  .tabs a { flex: 1 1 0; justify-content: center; padding: 0 8px; gap: 6px; font-size: 0.88rem; }
}
