/* Inter font */
/* Copied from https://fonts.googleapis.com/css2?family=Inter:wght@300..700&display=swap
Also see: https://fonts.google.com/specimen/Inter?query=inter
Note: Weight values have been removed since variable fonts do not require specifying them */

/* cyrillic-ext */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7SUc.woff2')
    format('woff2');
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7SUc.woff2')
    format('woff2');
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* greek-ext */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7SUc.woff2')
    format('woff2');
  font-display: swap;
  unicode-range: U+1F00-1FFF;
}

/* greek */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7SUc.woff2')
    format('woff2');
  font-display: swap;
  unicode-range: U+0370-03FF;
}

/* vietnamese */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7SUc.woff2')
    format('woff2');
  font-display: swap;
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0,
    U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* latin-ext */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7SUc.woff2')
    format('woff2');
  font-display: swap;
  unicode-range:
    U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-style: normal;
  font-family: 'MarleeInter';
  src: url('https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2')
    format('woff2');
  font-display: swap;
  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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
    U+FFFD;
}

:root {
  --bg: rgb(250, 248, 245);
  --surface: #ffffff;
  --text: #3d3d4e;
  --text-muted: #7a7a8c;
  --nav-text: rgb(3, 7, 18);
  --border: #e6e7eb;
  --brand: #0c0c30;
  --up: #4cbb17;
  --up-soft: #e5f6dc;
  --partial: #f0a020;
  --partial-soft: #fdf0d8;
  --full: #e5484d;
  --full-soft: #fde4e4;
  --none: #c9cbd3;
  --none-soft: #eceef2;
  --focus: #2563eb;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121218;
    --surface: #1c1c25;
    --text: #e6e6ee;
    --text-muted: #9a9aae;
    --nav-text: var(--text-muted);
    --border: #2c2c38;
    --up-soft: #1f3317;
    --partial-soft: #3a2c12;
    --full-soft: #3d1b1d;
    --none: #4a4c58;
    --none-soft: #2a2b34;
    --focus: #7aa2ff;
    color-scheme: dark;
  }
  .brand img {
    filter: invert(1) hue-rotate(180deg);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    'MarleeInter',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Header ---- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand a {
  display: flex;
  text-decoration: none;
}

.brand img {
  height: 26px;
  width: auto;
}

.brand-suffix {
  color: var(--nav-text);
  font-size: 1.05rem;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

a.brand-suffix:hover {
  text-decoration: underline;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--nav-text);
}

.header-links svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-links a:hover {
  color: var(--text);
}

/* ---- Status icons ---- */

.status-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
}

.status-icon svg {
  width: 60%;
  height: 60%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-up {
  background: var(--up);
}
.status-partial {
  background: var(--partial);
}
.status-full {
  background: var(--full);
}
.status-none {
  background: var(--none);
}

.text-up {
  color: var(--up);
}
.text-partial {
  color: var(--partial);
}
.text-full {
  color: var(--full);
}
.text-none {
  color: var(--text-muted);
}

/* ---- Hero ---- */

.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 48px 0 32px;
  text-align: left;
}

.hero .status-icon {
  width: 64px;
  height: 64px;
  box-shadow: 0 0 0 6px var(--up-soft);
}
.hero .status-partial {
  box-shadow: 0 0 0 6px var(--partial-soft);
}
.hero .status-full {
  box-shadow: 0 0 0 6px var(--full-soft);
}
.hero .status-none {
  box-shadow: 0 0 0 6px var(--none-soft);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 600;
}

/* ---- Sections ---- */

.section-heading {
  margin: 32px 0 10px 4px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.empty {
  padding: 20px;
  color: var(--text-muted);
}

.loading {
  padding: 64px 0;
  text-align: center;
  color: var(--text-muted);
}

/* ---- Services ---- */

.services {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.service {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  padding: 16px 16px 16px 20px;
  border-left: 6px solid var(--up);
}

.service + .service {
  border-top: 1px solid var(--border);
}

.service-partial {
  border-left-color: var(--partial);
}
.service-full {
  border-left-color: var(--full);
}
.service-none {
  border-left-color: var(--none);
}

.service-name h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.service-stats {
  display: flex;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 92px;
  padding: 0 14px;
}

.stat + .stat {
  border-left: 1px solid var(--border);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-left: 1px;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 32px);
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.day {
  height: 64px;
  overflow: hidden;
  border-radius: 4px;
}

/* Midnight at the bottom, the following midnight at the top */
.day-chart {
  display: block;
  width: 100%;
  height: 100%;
}
.day-segment-up {
  fill: var(--up);
}
.day-segment-partial {
  fill: var(--partial);
}
.day-segment-full {
  fill: var(--full);
}
.day-segment-none {
  fill: var(--none);
}

@media (max-width: 760px) {
  .service {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px 16px;
  }
  .service-stats,
  .days {
    grid-column: 1 / -1;
  }
  .service-stats .stat:first-child {
    padding-left: 0;
    align-items: flex-start;
  }
  .days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .day {
    height: 36px;
  }
}

/* ---- Incidents ---- */

.incidents {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident {
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 6px solid var(--partial);
  padding: 16px 20px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.incident-full {
  border-left-color: var(--full);
}

.incident-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.incident-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.incident-time {
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.badge {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-open {
  background: var(--full-soft);
  color: var(--full);
}

.badge-resolved {
  background: var(--up-soft);
  color: var(--up);
}

.notes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes li {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.notes time,
.note-author {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.notes p {
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.site-footer {
  padding-top: 24px;
  padding-bottom: 48px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- Linked incidents ---- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.day-link {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.day-link:hover {
  outline: 2px solid rgb(0 0 0 / 0.25);
  outline-offset: -2px;
}

.incident-item {
  scroll-margin-top: 16px;
}

.incident-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s;
}

.incident-link:hover {
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
}

.incident-link:hover h3 {
  text-decoration: underline;
}

.incident-item:target .incident {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Incident page ---- */

.back-link {
  display: inline-block;
  margin: 24px 0 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.incident-header h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  display: grid;
  gap: 2px;
  padding: 14px 20px;
  border-left: 6px solid var(--none);
}

.timeline-start-partial {
  border-left-color: var(--partial);
}

.timeline-start-full {
  border-left-color: var(--full);
}

.timeline-resolved {
  border-left-color: var(--up);
}

.timeline-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.timeline-item time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-item p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- Admin ---- */

.form {
  display: grid;
  gap: 14px;
  margin-top: 32px;
  padding: 20px;
}

.form h1,
.form h2 {
  margin: 0;
  font-size: 1.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.login {
  max-width: 380px;
  margin: 64px auto;
}

label {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
}

label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

input,
select,
textarea {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  min-width: 0;
}

input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--up);
}

textarea {
  resize: vertical;
}

.button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.button:hover {
  border-color: var(--text-muted);
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button-primary {
  justify-self: start;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button-primary:hover {
  border-color: var(--brand);
  opacity: 0.9;
}

.button-danger {
  color: var(--full);
}

.button-link {
  border: none;
  background: none;
  padding: 4px 6px;
  color: var(--text-muted);
  text-decoration: underline;
}

.username {
  font-size: 0.9rem;
}

.error {
  color: var(--full);
  margin: 0;
}

.error.banner {
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--full-soft);
  border-radius: var(--radius);
}

.hint {
  margin: 0 0 10px 4px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.merge-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
}

.incident-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.note-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
}

.note-form textarea {
  flex: 1;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 24px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 8px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.tab:hover {
  color: var(--text);
}

.tab-active {
  border-bottom-color: var(--brand);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  .tab-active {
    border-bottom-color: var(--text);
  }
}

.field-hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.service-admin {
  padding: 16px 20px;
}

.service-id {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.region-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.region-result {
  padding: 2px 8px;
  border-radius: 999px;
}
.region-result span {
  font-weight: 600;
}
.region-result-up {
  background: var(--up-soft);
}
.region-result-full {
  background: var(--full-soft);
}
.region-result-none {
  background: var(--none-soft);
  color: var(--text-muted);
}

.service-edit {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 32px 0 10px;
}

.section-bar .section-heading {
  margin: 0 0 0 4px;
}

.section-bar .button {
  text-decoration: none;
}

.table-scroll {
  overflow-x: auto;
}

.subscriptions {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.subscriptions th,
.subscriptions td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.subscriptions tbody tr:last-child > * {
  border-bottom: none;
}

.subscriptions thead th {
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

/* Names stay in view while scrolling across many services */
.subscriptions th:first-child {
  position: sticky;
  left: 0;
  text-align: left;
  background: var(--surface);
}

.subscriptions tbody th a {
  font-weight: 600;
}

.subscriber-channels {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.subscriptions td {
  text-align: center;
}

.subscriptions td input {
  vertical-align: middle;
}

.subscriber-form .field-hint {
  margin: 0;
}
