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

:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e5e4;
  --text: #1c1917;
  --text-muted: #78716c;
  --text-faint: #a8a29e;

  --green-dark:  #15803d;
  --green:       #22c55e;
  --green-bg:    #f0fdf4;
  --yellow:      #ca8a04;
  --yellow-bg:   #fefce8;
  --orange:      #c2410c;
  --orange-bg:   #fff7ed;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --gray:        #d6d3d1;
  --gray-bg:     #f5f5f4;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.how-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 2px;
}

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

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

.brand h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.brand h1 .tld { color: var(--text-muted); font-weight: 400; }

.tagline {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Main */
main { flex: 1; padding: 40px 0; }

/* Legend + search row */
.legend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-sq {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.search {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  width: 180px;
  outline: none;
}

.search:focus { border-color: var(--text-muted); }
.search::placeholder { color: var(--text-faint); }

/* Grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

/* Skeleton */
.skeleton-card {
  height: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.service-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-name img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.favicon-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.service-name h2 {
  font-size: 1.05rem;
  font-weight: 600;
}


/* Open incident notice */
.open-incident {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--yellow-bg);
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #78350f;
  margin-bottom: 16px;
}


.open-incident-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d97706;
  margin-top: 4px;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Exception marker - asterisk indicating incidents excluded from SLA calculation */
.exc-marker {
  font-size: 0.55em;
  font-weight: 700;
  vertical-align: super;
  color: var(--text-muted);
  margin-left: 1px;
}

/* Uptime hero */
.uptime-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.uptime-pct {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
}

.uptime-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.uptime-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Uptime color classes */
.color-excellent { color: var(--green-dark); }
.color-good      { color: #16a34a; }
.color-fair      { color: var(--yellow); }
.color-poor      { color: var(--orange); }
.color-critical  { color: var(--red); }

/* Monthly section */
.monthly-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}

.month-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.month-sq {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: default;
  position: relative;
}

/* Square colors */
.sq-excellent  { background: #16a34a; }
.sq-good       { background: #4ade80; }
.sq-fair       { background: #fbbf24; }
.sq-poor       { background: #f97316; }
.sq-critical   { background: #ef4444; }
.sq-no-data    { background: var(--gray); }

.month-name {
  font-size: 0.58rem;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
}

/* Tooltip via title - native, good enough for v1 */

/* Meta */
.meta {
  margin-top: 28px;
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: center;
}

/* Methodology page */
.prose-container { padding-top: 40px; padding-bottom: 60px; }
.exc-heading-marker { font-style: normal; }
.prose { max-width: 680px; }
.prose h2 { font-size: 1.2rem; font-weight: 700; margin: 36px 0 12px; }
.prose h3 { font-size: 0.95rem; font-weight: 600; margin: 24px 0 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.prose p  { line-height: 1.7; color: var(--text); margin-bottom: 12px; font-size: 0.95rem; }
.prose p + p { margin-top: 0; }
.prose a  { color: var(--text); }
.prose h2 a, .prose h3 a {
  color: inherit;
  text-decoration: none;
}
.prose h2 a:hover::before, .prose h3 a:hover::before {
  content: '# ';
  color: var(--text-faint);
  font-weight: 400;
}

.callout {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.timeline { margin: 20px 0; font-size: 0.82rem; }
.tl-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.tl-label {
  width: 160px;
  flex-shrink: 0;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-bar-wrap {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 20px;
  position: relative;
}
.tl-bar { position: absolute; top: 0; height: 100%; border-radius: 3px; opacity: 0.85; }
.tl-bar.red    { background: #ef4444; }
.tl-bar.orange { background: #f97316; }
.tl-bar.green  { background: #22c55e; }
.tl-bar.merged { background: #6366f1; }
.tl-duration { width: 56px; flex-shrink: 0; color: var(--text-muted); text-align: right; }
.tl-full        { left: 0;      width: 100%; }
.tl-copilot-agent    { left: 10.9%; width: 10.6%; }
.tl-copilot-sessions { left: 21.7%; width: 10.2%; }
.tl-section-gap { margin-top: 18px; }

.tl-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 18px 0 8px;
}

.results { display: flex; gap: 12px; margin: 20px 0; flex-wrap: wrap; }
.result-box {
  flex: 1;
  min-width: 140px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.result-box .rb-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 4px; }
.result-box .rb-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }
.result-box.wrong .rb-value { color: var(--red); }
.result-box.right .rb-value { color: var(--green-dark); }

/* Footer */
footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

footer p {
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.6;
}

.made-by {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.made-by a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.made-by a:hover { color: var(--text); }

.disclaimer {
  font-size: 0.72rem !important;
  color: var(--text-faint);
  line-height: 1.6;
}

/* Error */
.error {
  color: var(--red);
  padding: 20px;
  background: var(--red-bg);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

@media (max-width: 500px) {
  .services-grid { grid-template-columns: 1fr; }
  .uptime-pct { font-size: 1.9rem; }
  .month-name { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --surface: #292524;
    --border: #44403c;
    --text: #e7e5e4;
    --text-muted: #a8a29e;
    --text-faint: #78716c;
    --gray: #57534e;
    --gray-bg: #1c1917;
    --green-bg: #052e16;
    --yellow-bg: #1c1400;
    --orange-bg: #1a0d00;
    --red-bg: #1a0000;
  }

  .brand-title svg rect { fill: #292524; }
}
