/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #6366f1;
  --primary-10:   #6366f11a;
  --success:      #22c55e;
  --success-10:   #22c55e1a;
  --destructive:  #ef4444;
  --destr-10:     #ef44441a;
  --amber:        #d97706;
  --amber-10:     #d977061a;
  --bg:           #f8fafc;
  --card:         #ffffff;
  --border:       #e2e8f0;
  --fg:           #0f172a;
  --muted-fg:     #64748b;
  --font:         'Inter', system-ui, sans-serif;
  --radius:       0.75rem;
}

body { font-family: var(--font); background: var(--bg); color: var(--fg); min-height: 100dvh; display: flex; flex-direction: column; line-height: 1.6; }
main { flex: 1; display: flex; flex-direction: column; }

/* ── Layout ────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 480px) { .container { padding: 0 1.5rem; } }
.narrow { max-width: 780px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted-fg); }

/* ── Header ────────────────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.125rem; text-decoration: none; color: var(--fg); }
.logo svg { color: var(--primary); }
nav { display: flex; gap: 1.5rem; }
nav a { text-decoration: none; color: var(--muted-fg); font-size: .875rem; font-weight: 500; transition: color .15s; }
nav a:hover { color: var(--fg); }

/* ── Hero ──────────────────────────────────────────────────── */
.hero { background: var(--card); border-bottom: 1px solid var(--border); padding: 2.5rem 0 3rem; position: relative; overflow: hidden; }
@media (min-width: 640px) { .hero { padding: 4rem 0 5rem; } }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at top right, rgba(99,102,241,.06) 0%, transparent 70%); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
@media (min-width: 640px) { .hero-inner { gap: 1.25rem; } }
.hero-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .9rem; border-radius: 9999px; background: var(--primary-10); color: var(--primary); font-size: .8rem; font-weight: 500; }
.hero h1 { font-size: clamp(1.75rem, 7vw, 3.75rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.hero-sub { font-size: .975rem; color: var(--muted-fg); max-width: 600px; }
@media (min-width: 640px) { .hero-sub { font-size: 1.125rem; } }

/* ── Check Form ────────────────────────────────────────────── */
.check-form { display: flex; flex-direction: column; gap: .75rem; width: 100%; max-width: 640px; margin-top: .5rem; }
@media (min-width: 560px) { .check-form { flex-direction: row; } }
.input-wrap { position: relative; flex: 1; }
.input-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted-fg); pointer-events: none; }
.input-wrap input { width: 100%; height: 3.5rem; padding: 0 1rem 0 2.75rem; border: 2px solid var(--border); border-radius: var(--radius); font-size: 1rem; font-family: var(--font); background: var(--card); color: var(--fg); outline: none; transition: border-color .15s; }
.input-wrap input:focus { border-color: var(--primary); }
.input-wrap input::placeholder { color: var(--muted-fg); }
button[type=submit], .btn-primary { height: 3.5rem; padding: 0 2rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 600; font-family: var(--font); cursor: pointer; transition: opacity .15s, transform .1s; white-space: nowrap; }
button[type=submit]:hover { opacity: .9; }
button[type=submit]:active { transform: scale(.98); }
button[type=submit]:disabled { opacity: .6; cursor: not-allowed; }

/* ── Loading ───────────────────────────────────────────────── */
.skeleton-wrap { padding: 3rem 0; border-bottom: 1px solid var(--border); }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; max-width: 900px; margin: 1.5rem auto 0; }
.skeleton-card { height: 120px; background: var(--border); border-radius: var(--radius); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.loading-state { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3rem 0; color: var(--muted-fg); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin-sm { width: 20px; height: 20px; border-width: 2px; display: inline-block; vertical-align: middle; margin-right: .4rem; }

/* ── Results ───────────────────────────────────────────────── */
.results-section { padding: 2rem 0; background: var(--card); border-bottom: 1px solid var(--border); }
@media (min-width: 640px) { .results-section { padding: 3rem 0; } }
.results-title { text-align: center; font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }
@media (min-width: 640px) { .results-title { font-size: 1.5rem; margin-bottom: 1.5rem; } }
.results-title .target-name { color: var(--primary); word-break: break-all; }
.status-badge-wrap { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-bottom: 1.5rem; }
.status-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.1rem; border-radius: 1rem; border: 2px solid; font-size: 1rem; font-weight: 700; }
@media (min-width: 480px) { .status-badge { gap: .75rem; padding: .75rem 1.5rem; font-size: 1.25rem; } }
.status-badge.up    { background: var(--success-10); border-color: #86efac; color: var(--success); }
.status-badge.down  { background: var(--destr-10);   border-color: #fca5a5; color: var(--destructive); }
.status-badge.partial { background: var(--amber-10); border-color: #fcd34d; color: var(--amber); }
.avg-badge { display: inline-flex; align-items: center; gap: .75rem; padding: .6rem 1.1rem; border-radius: 1rem; border: 2px solid var(--border); background: var(--bg); }
@media (min-width: 480px) { .avg-badge { padding: .75rem 1.5rem; } }
.avg-badge .label { font-size: .75rem; color: var(--muted-fg); display: block; }
.avg-badge .val { font-weight: 600; }

/* ── Location cards ─────────────────────────────────────────── */
.loc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; max-width: 900px; margin: 0 auto; }
@media (max-width: 479px) { .loc-grid { grid-template-columns: 1fr 1fr; gap: .5rem; } }
.loc-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; transition: box-shadow .15s; }
@media (min-width: 640px) { .loc-card { padding: 1.25rem; gap: .75rem; } }
.loc-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.loc-name { font-size: .75rem; font-weight: 500; color: var(--muted-fg); }
.loc-status { font-size: 1.25rem; font-weight: 800; }
@media (min-width: 480px) { .loc-status { font-size: 1.5rem; } }
.loc-status.loc-up   { color: var(--success); }
.loc-status.loc-down { color: var(--destructive); }
.loc-details { width: 100%; border-top: 1px solid var(--border); padding-top: .5rem; }
.loc-detail { display: flex; justify-content: space-between; font-size: .75rem; }
.loc-detail span:first-child { color: var(--muted-fg); }
.loc-detail span:last-child  { font-weight: 500; }

/* ── Result banner (status page) ───────────────────────────── */
.result-banner { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; border-radius: 1rem; border: 2px solid; margin-bottom: 1.5rem; }
@media (min-width: 480px) { .result-banner { padding: 1.75rem; } }
@media (min-width: 640px) { .result-banner { flex-direction: row; align-items: center; justify-content: space-between; padding: 2rem; } }
.result-banner.status-up      { background: var(--success-10); border-color: #86efac; }
.result-banner.status-down    { background: var(--destr-10);   border-color: #fca5a5; }
.result-banner.status-partial { background: var(--amber-10);   border-color: #fcd34d; }
.result-banner-left { display: flex; align-items: center; gap: 1rem; }
.result-icon-wrap { padding: .75rem; border-radius: 50%; background: rgba(255,255,255,.6); flex-shrink: 0; }
.result-label { font-size: clamp(1.25rem, 5vw, 1.75rem); font-weight: 700; }
.status-up    .result-label { color: var(--success); }
.status-down  .result-label { color: var(--destructive); }
.status-partial .result-label { color: var(--amber); }
.result-time { color: var(--muted-fg); font-size: .875rem; margin-top: .25rem; }
.result-banner-right { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.stat-chip { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; padding: .5rem 1rem; }
.stat-label { font-size: .7rem; color: var(--muted-fg); font-weight: 500; display: block; }
.stat-val { font-weight: 700; font-size: 1.1rem; }
.btn-outline { padding: .6rem 1.25rem; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--card); font-size: .9rem; font-weight: 500; font-family: var(--font); cursor: pointer; transition: border-color .15s; min-height: 44px; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ── Recent checks ──────────────────────────────────────────── */
.recent-section { padding: 2.5rem 0; background: var(--bg); }
@media (min-width: 640px) { .recent-section { padding: 4rem 0; } }
.section-title { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; font-weight: 700; margin-bottom: 1.25rem; }
@media (min-width: 640px) { .section-title { font-size: 1.4rem; margin-bottom: 2rem; } }
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); }

/* Table header */
.table-head { display: flex; justify-content: space-between; padding: .6rem 1rem; background: var(--bg); border-bottom: 1px solid var(--border); font-size: .72rem; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .05em; }
.table-head .th-site   { flex: 1; }
.table-head .th-status { width: 60px; text-align: right; }

/* Card-style rows — work at any width */
.table-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); transition: background .1s; }
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--bg); }

/* Left: domain + meta line */
.col-main   { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.col-target { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.col-target svg { flex-shrink: 0; color: var(--muted-fg); }
.col-target span { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-meta   { display: flex; gap: .75rem; }
.col-response { font-size: .75rem; color: var(--muted-fg); }
.col-time   { font-size: .75rem; color: var(--muted-fg); }

/* Right: badge */
.col-status { flex-shrink: 0; }
.badge { display: inline-block; padding: .25rem .65rem; border-radius: 9999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.badge-up   { background: var(--success-10); color: var(--success); }
.badge-down { background: var(--destr-10);   color: var(--destructive); }
.table-empty { padding: 2rem; text-align: center; color: var(--muted-fg); font-size: .9rem; }

/* ── Popular sites ──────────────────────────────────────────── */
.popular-section { padding: 3rem 0; background: var(--bg); border-top: 1px solid var(--border); }
.popular-inner { text-align: center; }
.popular-inner h3 { color: var(--muted-fg); font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; }
.popular-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.popular-link { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem 1rem; border: 1px solid var(--border); border-radius: 9999px; font-size: .875rem; font-weight: 500; text-decoration: none; color: var(--fg); background: var(--card); transition: border-color .15s, color .15s; }
.popular-link:hover { border-color: var(--primary); color: var(--primary); }
.popular-link svg { opacity: .5; }

/* ── Status page ────────────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: .35rem; font-size: .875rem; font-weight: 500; color: var(--muted-fg); text-decoration: none; margin-bottom: 1.25rem; transition: color .15s; min-height: 44px; }
.back-link:hover { color: var(--fg); }
.status-page-hero { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1.5rem; }
@media (min-width: 640px) { .status-page-hero { gap: 1rem; margin-bottom: 2rem; } }
.status-page-hero h1 { font-size: clamp(1.4rem, 5vw, 2.75rem); font-weight: 800; word-break: break-word; }
.status-page-hero p { color: var(--muted-fg); margin-top: .35rem; font-size: .9rem; }
.error-msg { text-align: center; padding: 2rem 1rem; color: var(--destructive); }

/* ── Pages ──────────────────────────────────────────────────── */
.page-content { padding: 2rem 0; flex: 1; }
@media (min-width: 640px) { .page-content { padding: 4rem 0; } }
.page-hero { margin-bottom: 2rem; }
@media (min-width: 640px) { .page-hero { margin-bottom: 3rem; } }
.page-hero h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); font-weight: 800; margin: .75rem 0 .5rem; }
.page-hero p { font-size: 1rem; color: var(--muted-fg); }
@media (min-width: 640px) { .page-hero p { font-size: 1.125rem; } }
.page-icon { display: inline-flex; align-items: center; justify-content: center; padding: .75rem; background: var(--primary-10); border-radius: 1rem; color: var(--primary); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.25rem; box-shadow: 0 1px 4px rgba(0,0,0,.04); margin-bottom: 1.25rem; }
@media (min-width: 640px) { .card { padding: 2rem; margin-bottom: 1.5rem; } }
.card h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .85rem; display: flex; align-items: center; gap: .5rem; color: var(--fg); }
@media (min-width: 640px) { .card h2 { font-size: 1.25rem; margin-bottom: 1rem; } }
.card h3 { font-size: 1rem; font-weight: 700; margin: .75rem 0 .4rem; }
.card p  { color: var(--muted-fg); line-height: 1.7; }
.card > svg { color: var(--primary); margin-bottom: .75rem; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media (min-width: 600px) { .card-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; } }
.location-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.location-list li { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 500; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--primary); display: inline-block; flex-shrink: 0; }
.contact-block { padding: 1.5rem 0; border-top: 1px solid var(--border); margin-top: 1rem; }
@media (min-width: 640px) { .contact-block { padding: 2rem 0; } }
.contact-block h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: .5rem; }
.contact-link { display: inline-block; margin-top: 1rem; color: var(--primary); font-weight: 500; text-decoration: none; }
.contact-link:hover { text-decoration: underline; }

/* ── Prose ──────────────────────────────────────────────────── */
.prose { color: var(--muted-fg); line-height: 1.75; }
.prose h2 { font-size: 1.25rem; font-weight: 700; color: var(--fg); margin-top: 2rem; margin-bottom: .75rem; }
.prose ul { padding-left: 1.5rem; }
.prose li { margin-bottom: .4rem; }
.prose strong { color: var(--fg); }
.prose a { color: var(--primary); }

/* ── FAQ Accordion ──────────────────────────────────────────── */
.accordion { padding: .5rem; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-trigger { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 1.25rem 1rem; background: none; border: none; text-align: left; font-size: 1.05rem; font-weight: 600; font-family: var(--font); color: var(--fg); cursor: pointer; gap: 1rem; transition: color .15s; }
.accordion-trigger:hover { color: var(--primary); }
.accordion-trigger .chevron { flex-shrink: 0; transition: transform .25s; }
.accordion-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.accordion-trigger[aria-expanded="true"] + .accordion-content { max-height: 300px; }
.accordion-content p { padding: 0 1rem 1.25rem; color: var(--muted-fg); line-height: 1.7; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); background: var(--card); margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 1fr; gap: 1.75rem; padding: 2rem 1rem 1.5rem; }
@media (min-width: 480px) { .footer-inner { padding: 2.5rem 1.5rem 2rem; } }
@media (min-width: 640px) { .footer-inner { grid-template-columns: 2fr 1fr; gap: 2rem; padding: 3rem 1.5rem 2rem; } }
.footer-brand p { font-size: .875rem; color: var(--muted-fg); margin-top: .75rem; max-width: 320px; line-height: 1.6; }
.footer-links { display: flex; gap: 2rem; flex-wrap: wrap; }
@media (min-width: 480px) { .footer-links { gap: 3rem; } }
.footer-links h4 { font-weight: 600; font-size: .9rem; margin-bottom: .75rem; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: .5rem; }
.footer-links a { font-size: .875rem; color: var(--muted-fg); text-decoration: none; transition: color .15s; }
.footer-links a:hover { color: var(--fg); }
.footer-copy { border-top: 1px solid var(--border); padding: 1.25rem 1rem; text-align: center; font-size: .8rem; color: var(--muted-fg); }
