:root {
  --bg: #f3fcff;
  --bg-soft: #e6f7ff;
  --surface: #ffffff;
  --surface-soft: #f8fdff;
  --brand: #00314c;
  --brand-dark: #001722;
  --text: #072238;
  --muted: #527187;
  --border: #ccecf8;
  --accent: #ff7029;
  --accent-strong: #3242d7;
  --ok: #087f5b;
  --bad: #c92a2a;
  --warn: #b35c00;
  --unknown: #596579;
  --mountain: #b7e8f8;
  --shadow: 0 18px 45px rgba(0, 49, 76, 0.1);
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    url("/static/mountain.svg") center bottom / cover no-repeat fixed,
    linear-gradient(135deg, var(--bg) 0%, var(--bg-soft) 42%, var(--surface) 100%);
}

body::before {
  content: none;
}

.topbar,
.shell,
.skip-link {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-140%);
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  padding: 0.65rem 0.85rem;
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  backdrop-filter: blur(14px);
}

.brand,
.metric-head,
.metric-facts,
.toolbar,
.summary-grid {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.8rem;
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
  box-shadow: var(--shadow);
}

/* Language switcher */

.language-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.language-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 1.65rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  padding: 0.15rem;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(0, 49, 76, 0.06);
}

.language-link:hover {
  border-color: var(--accent);
}

.language-link[aria-current="true"] {
  display: none;
}

.language-code {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.flag {
  display: block;
  overflow: hidden;
  border: 1px solid rgba(0, 49, 76, 0.22);
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* Swiss flag.
   Kept as .flag-de so the existing HTML does not need to change.
   Construction:
   - square red field
   - white free-standing cross
   - 32-unit grid
   - cross total extent: 20/32
   - cross arm width: 6/32
   - outer arm length: 7/32
   - margin around cross: 6/32
*/

.flag-de {
  position: relative;
  width: 1.18rem;
  height: 1.18rem;
  background: #ff0000;
}

.flag-de::before,
.flag-de::after {
  content: "";
  position: absolute;
  background: #ffffff;
}

.flag-de::before {
  left: 18.75%;
  top: 40.625%;
  width: 62.5%;
  height: 18.75%;
}

.flag-de::after {
  left: 40.625%;
  top: 18.75%;
  width: 18.75%;
  height: 62.5%;
}

.flag-gb {
  width: 1.75rem;
  height: 1.12rem;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 60 36' xmlns='http://www.w3.org/2000/svg'%3E%3CclipPath id='c'%3E%3Cpath d='M0 0h60v36H0z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23c)'%3E%3Cpath fill='%23012169' d='M0 0h60v36H0z'/%3E%3Cpath stroke='%23fff' stroke-width='7.2' d='m0 0 60 36m0-36L0 36'/%3E%3Cpath stroke='%23C8102E' stroke-width='4.4' d='m0 0 60 36m0-36L0 36'/%3E%3Cpath stroke='%23fff' stroke-width='12' d='M30 0v36M0 18h60'/%3E%3Cpath stroke='%23C8102E' stroke-width='7.2' d='M30 0v36M0 18h60'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.metric-card:focus-within,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) 0 3rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 0.48fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--brand);
  padding: clamp(1.4rem, 4vw, 3rem);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.section-label {
  margin: 0 0 0.9rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 14ch;
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4.7rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.94;
}

.hero-copy {
  max-width: 42rem;
  margin: 1.2rem 0 0;
  color: #d7f3ff;
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.summary-grid {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.summary-grid div {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
}

.summary-grid dt,
.metric-facts dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-grid dt {
  color: #bcecff;
}

.summary-grid dd {
  margin: 0.35rem 0 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1;
}

.toolbar {
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 0;
}

.toolbar span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.messages {
  margin-top: 1rem;
}

.messages h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.message-list {
  display: grid;
  gap: 0.65rem;
}

.notice {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-left: 0.42rem solid var(--accent-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.notice span {
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.notice strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice-maintenance,
.notice-warning {
  border-left-color: var(--warn);
}

.notice-critical {
  margin-top: 1rem;
  border-left-color: var(--bad);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card,
.empty-state {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.metric-head {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.2;
}

.metric-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.metric-online .status-pill,
.point-online {
  color: var(--ok);
}

.metric-offline .status-pill,
.point-offline {
  color: var(--bad);
}

.metric-unknown .status-pill,
.point-unknown {
  color: var(--unknown);
}

.metric-facts {
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
}

.metric-facts div {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0.7rem;
}

.metric-facts dd {
  margin: 0.3rem 0 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.metric-facts div:last-child {
  grid-column: 1 / -1;
}

.history {
  display: grid;
  grid-template-columns: repeat(48, minmax(2px, 1fr));
  gap: 3px;
  height: 2.25rem;
  margin-top: 1rem;
}

.history-point {
  min-width: 2px;
  border-radius: 999px;
  background: currentColor;
}

.history-empty {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 0.5rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: 12ch;
  }
}

@media (max-width: 680px) {
  .topbar,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .language-nav {
    align-self: flex-start;
  }

  .summary-grid,
  .metric-facts {
    grid-template-columns: 1fr;
  }

  .history {
    grid-template-columns: repeat(32, minmax(2px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}