/* Karnataka Service Status, public page. Calm and plain: white, one text colour, hairlines, 8px grid.
   Colour is used only for status, and a status colour always sits next to an icon and a word. */
:root {
  --bg: #FFFFFF;
  --surface: #F8F9FA;
  --hover: #F1F3F4;
  --text: #202124;
  --muted: #5F6368;      /* 6.3:1 on white */
  --line: #DADCE0;       /* hairlines */
  --control: #80868B;    /* form control borders, 3.6:1 */
  --focus: #1967D2;
  --link: #1967D2;
  --up: #188038;
  --degraded: #B06000;
  --down: #D2042D;
  --maintenance: #1967D2;
  --unknown: #5F6368;
  --bar-up: #1E8E3E;     /* 3.9:1, a non-text mark */
  --raised: #FFFFFF;
  --strip: #202124;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%235F6368' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --sans: "Google Sans Flex", "Noto Sans Kannada", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124;
    --surface: #292A2D;
    --hover: #2F3034;
    --text: #E8EAED;
    --muted: #9AA0A6;
    --line: #3C4043;
    --control: #80868B;
    --focus: #8AB4F8;
    --link: #8AB4F8;
    --up: #81C995;
    --degraded: #FDD663;
    --down: #F28B82;
    --maintenance: #8AB4F8;
    --unknown: #9AA0A6;
    --bar-up: #81C995;
    --raised: #292A2D;
    --strip: #3C4043;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%239AA0A6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 var(--sans); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
:lang(kn) { line-height: 1.7; }
h1, h2, p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 16px; top: -100px; z-index: 30; background: var(--bg); color: var(--link); padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }

.wrap { max-width: 1024px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 599px) { .wrap { padding: 0 16px; } }

/* Demo strip: neutral and impossible to miss. */
.demo-strip { margin: 0; padding: 8px 16px; text-align: center; background: var(--strip); color: #FFFFFF; font-size: 14px; font-weight: 500; }

/* Header */
header.site { border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-size: 18px; font-weight: 500; letter-spacing: -0.005em; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark { width: 24px; height: 24px; flex: none; }
.mark rect { fill: var(--text); }
.mark path { fill: none; stroke: var(--bg); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Controls: one height, radius, border and padding for every button and select. */
.btn, .control {
  height: 40px; border: 1px solid var(--control); border-radius: 8px; background: var(--bg); color: var(--text);
  font: 500 14px/1 var(--sans); padding: 0 16px;
}
.btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.btn:has(svg) { padding-left: 12px; }
.control {
  width: 100%; min-width: 0; font-weight: 400; padding-right: 40px; cursor: pointer;
  appearance: none; -webkit-appearance: none; background: var(--bg) var(--chevron) no-repeat right 12px center / 16px 16px;
  text-overflow: ellipsis;
}
.control:hover { border-color: var(--text); }
.control:focus-visible { outline-offset: 0; border-radius: 8px; }

/* Settings popover */
.settings { position: relative; flex: none; }
.panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 280px; max-width: calc(100vw - 32px);
  background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 16px;
}
.panel h2 { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.panel fieldset { border: 0; margin: 0; padding: 0; }
.panel legend { padding: 0; margin-bottom: 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.panel legend:lang(kn) { text-transform: none; letter-spacing: 0; font-size: 14px; }
.radio { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 8px; margin: 0 -8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.radio:hover { background: var(--hover); }
.radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--text); flex: none; }

/* Intro */
main.wrap { padding-top: 40px; padding-bottom: 64px; }
.intro { margin-bottom: 32px; }
h1 { font-size: 32px; line-height: 1.25; font-weight: 500; letter-spacing: -0.01em; }
h1:lang(kn) { line-height: 1.5; }
.lede { margin-top: 8px; color: var(--muted); font-size: 16px; max-width: 80ch; }
@media (max-width: 599px) { main.wrap { padding-top: 24px; } h1 { font-size: 24px; } .intro { margin-bottom: 24px; } }

/* Notices and the overall summary */
.notice { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 0 0 16px; background: var(--surface); font-size: 14px; }
.notice p + p { margin-top: 8px; }
.overall { display: flex; align-items: flex-start; gap: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 24px; margin-bottom: 32px; }
.overall svg { width: 32px; height: 32px; display: block; }
.overall-title { font-size: 20px; line-height: 32px; font-weight: 500; }
.overall-title:lang(kn) { line-height: 1.6; }
#updated { font-size: 14px; margin-top: 4px; }
@media (max-width: 599px) { .overall { padding: 16px; gap: 12px; } .overall svg { width: 24px; height: 24px; } .overall-title { font-size: 18px; line-height: 24px; } }

/* Filters: labels above, columns on the same grid as the cards below */
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin-bottom: 8px; }
@media (max-width: 599px) { .filters { grid-template-columns: 1fr; gap: 16px; } }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; line-height: 20px; }

/* Services, grouped by category */
.category h2 { font-size: 20px; font-weight: 500; line-height: 1.4; margin: 40px 0 16px; }
.category ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.service { padding: 16px 24px 16px; border-bottom: 1px solid var(--line); }
.service:last-child { border-bottom: 0; }
@media (max-width: 599px) { .service { padding: 16px; } }
.service-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 16px; }
.service-name { font-weight: 500; overflow-wrap: anywhere; }
.service-dept { margin-top: 2px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.service-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.since { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Status pills: tinted, with a shape icon and a word. */
.pill {
  --s: var(--unknown);
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 8px; border-radius: 14px; white-space: nowrap;
  font-size: 14px; font-weight: 500; line-height: 1;
  background: color-mix(in srgb, var(--s) 12%, var(--bg)); color: color-mix(in srgb, var(--s) 70%, var(--text));
}
.pill svg { width: 16px; height: 16px; flex: none; color: var(--s); }
.s-up { --s: var(--up); }
.s-degraded { --s: var(--degraded); }
.s-down { --s: var(--down); }
.s-maintenance { --s: var(--maintenance); }
.s-unknown { --s: var(--unknown); }
.overall-icon, #overall-icon > span { color: var(--s); }

/* 90 day strip: 30 days on narrow screens */
.bars { display: flex; gap: 2px; height: 32px; margin-top: 16px; }
.bars span { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--line); }
.bars .b-up { background: var(--bar-up); }
.bars .b-degraded { background: var(--degraded); }
.bars .b-down { background: var(--down); }
/* Partial data: we were monitoring for less than half the day. Grey and hatched, never green. */
.bars .b-partial { background: repeating-linear-gradient(-45deg, var(--muted) 0 1px, var(--line) 1px 4px); }
.bars-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; line-height: 16px; color: var(--muted); }
.bars-legend > span:nth-child(2) { text-align: center; }
.bars-legend > span:last-child { text-align: right; }
.d30 { display: none; }
@media (max-width: 599px) {
  .bars span:nth-child(-n+60) { display: none; }
  .d90 { display: none; }
  .d30 { display: inline; }
}

/* "How we know": the newest check behind the status */
.how { margin-top: 8px; font-size: 14px; }
.how summary {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; cursor: pointer; list-style: none;
  color: var(--link); font-weight: 500; border-radius: 4px;
}
.how summary::-webkit-details-marker { display: none; }
.how summary::after { content: ""; width: 16px; height: 16px; background: var(--chevron) no-repeat center / 16px 16px; }
.how[open] summary::after { transform: rotate(180deg); }
.how dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 24px; margin: 8px 0 0; padding: 16px; border-radius: 8px; background: var(--surface); }
.how dt { color: var(--muted); }
.how dd { margin: 0; overflow-wrap: anywhere; }
.how p { margin-top: 8px; }
@media (max-width: 599px) { .how dl { grid-template-columns: minmax(0, 1fr); gap: 0; } .how dd + dt { margin-top: 8px; } }

.empty { padding: 24px 0; color: var(--muted); }

/* Footer */
footer.site { border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 14px; color: var(--muted); }
footer.site p + p { margin-top: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* About page */
.prose > * { max-width: 72ch; }
.prose .jump { margin-top: 8px; font-size: 14px; color: var(--muted); }
.prose h2 { font-size: 20px; font-weight: 500; margin: 40px 0 8px; }
.prose p + p { margin-top: 16px; }
.prose dl { margin: 0; }
.prose dt { margin: 24px 0 0; }
.prose dd { margin: 8px 0 0; }
.prose section + section { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); }
.back { display: inline-block; margin-bottom: 24px; font-size: 14px; }

/* Verify page */
.explain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.explain section { border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.explain h2 { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.explain p { color: var(--muted); font-size: 14px; }
@media (max-width: 599px) { .explain { grid-template-columns: 1fr; } .explain section { padding: 16px; } }
.proofs .proof { padding: 16px 24px; border-bottom: 1px solid var(--line); }
.proofs .proof:last-child { border-bottom: 0; }
@media (max-width: 599px) { .proofs .proof { padding: 16px; } }
.proof-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.proof-day { font-weight: 500; }
.hash { margin-top: 8px; font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.hash code { font-size: 12px; }
.proof-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 16px; font-size: 14px; }
.proof-actions .btn { margin-left: auto; }
@media (max-width: 599px) { .proof-actions .btn { margin-left: 0; width: 100%; justify-content: center; } }
.check-result { margin-top: 16px; font-size: 14px; }
.check-result .pill { white-space: normal; height: auto; min-height: 28px; padding-top: 4px; padding-bottom: 4px; line-height: 20px; }
.steps { margin: 0; padding-left: 24px; }
.steps li + li { margin-top: 16px; }
.code { margin: 8px 0 0; padding: 12px 16px; border-radius: 8px; background: var(--surface); overflow-x: auto; }
.file-field { margin-top: 16px; }
.file-field input { font: 400 14px/1.5 var(--sans); color: var(--text); max-width: 100%; }
.file-field input::file-selector-button {
  height: 40px; margin-right: 16px; padding: 0 16px; border: 1px solid var(--control); border-radius: 8px;
  background: var(--bg); color: var(--text); font: 500 14px/1 var(--sans); cursor: pointer;
}
.file-field input::file-selector-button:hover { background: var(--hover); }
