/* portsmonitor.com — one stylesheet for index.html and docs.html. Light and dark follow the system. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1120px;
  --gutter: 24px;
  --radius: 16px;
  --radius-sm: 10px;

  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --line: rgba(15, 23, 42, .09);
  --line-2: rgba(15, 23, 42, .16);
  --text: #0b1220;
  --text-2: #475467;
  --text-3: #7b8798;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-ink: #ffffff;
  --accent-soft: rgba(2, 132, 199, .09);
  --glow: rgba(56, 189, 248, .28);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 18px 44px -26px rgba(15, 23, 42, .32);
  --code-bg: #0d141e;
  --code-text: #dbe4ee;
  --code-key: #7dd3fc;
  --code-str: #86efac;
  --code-num: #fda4af;
  --code-op: #c4b5fd;
  /* Row colors used by PortsMonitor itself */
  --state-new: #22c55e;
  --state-changed: #eab308;
  --state-closed: #ef4444;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b10;
    --surface: #0f141b;
    --surface-2: #151c26;
    --line: rgba(255, 255, 255, .08);
    --line-2: rgba(255, 255, 255, .16);
    --text: #edf1f6;
    --text-2: #a6b0bd;
    --text-3: #6e7987;
    --accent: #38bdf8;
    --accent-strong: #7dd3fc;
    --accent-ink: #04131d;
    --accent-soft: rgba(56, 189, 248, .11);
    --glow: rgba(56, 189, 248, .22);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 30px 70px -30px rgba(0, 0, 0, .85);
    --code-bg: #0b1118;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top__in { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.05rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: 22px; margin-right: auto; }
.nav a { color: var(--text-2); font-size: .94rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 999px;
  font-weight: 600; font-size: .98rem; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-2);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { color: var(--accent-ink); background: var(--accent); border-color: transparent; box-shadow: 0 10px 28px -12px var(--accent); }
.btn--primary:hover { box-shadow: 0 14px 34px -12px var(--accent); }
.btn--sm { height: 36px; padding: 0 16px; font-size: .9rem; }
.btn small { font-weight: 500; opacity: .75; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 72px 0 0; text-align: center; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 70%; z-index: -1;
  background: radial-gradient(60% 55% at 50% 60%, var(--glow), transparent 70%);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; color: var(--accent-strong);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.hero h1 { margin: 22px auto 0; font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 750; letter-spacing: -.035em; }
.lead { max-width: 640px; margin: 20px auto 0; font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--text-2); }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.meta { margin-top: 16px; font-size: .88rem; color: var(--text-3); }
.hero__shot { margin: 40px auto 0; max-width: 1100px; }
.hero__shot img { margin-bottom: -4%; }

/* ---------- sections ---------- */
.section { padding: 96px 0; }
.section--tight { padding: 24px 0 0; }
.section__head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.section__head h2 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); font-weight: 700; }
.section__head p { margin-top: 14px; color: var(--text-2); font-size: 1.08rem; }

.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.point { padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.point__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--accent); background: var(--accent-soft);
}
.point__icon svg { width: 22px; height: 22px; }
.point h3 { margin-top: 18px; font-size: 1.15rem; font-weight: 650; }
.point p { margin-top: 8px; color: var(--text-2); font-size: .97rem; }

.feature { display: grid; grid-template-columns: 1fr 1.15fr; gap: 64px; align-items: center; }
.feature + .feature { margin-top: 96px; }
.feature--flip { grid-template-columns: 1.15fr 1fr; }
.feature--flip .feature__text { order: 2; }
.feature__kicker { font-size: .85rem; font-weight: 650; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.feature h3 { margin-top: 10px; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
.feature__text > p { margin-top: 14px; color: var(--text-2); font-size: 1.04rem; }
.feature__text code { color: var(--text); background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.feature__more { display: inline-block; margin-top: 18px; font-weight: 600; }

.shot {
  margin: 0; overflow: hidden; border-radius: var(--radius);
  background: #eceff3; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.shot img { width: 100%; }

.legend { display: grid; gap: 10px; margin: 20px 0 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.legend i { width: 28px; height: 14px; border-radius: 4px; flex: none; }
.legend b { color: var(--text); font-weight: 600; }

.wide-shot { max-width: 980px; margin: 0 auto; }

/* ---------- call to action ---------- */
.band {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center;
  padding: 40px 44px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.band::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(50% 120% at 0% 50%, var(--accent-soft), transparent 70%);
}
.band > * { position: relative; }
.band img { width: 72px; height: 72px; }
.band h2 { font-size: 1.7rem; font-weight: 700; }
.band p { margin-top: 6px; color: var(--text-2); }
.band .cta { margin-top: 0; justify-content: flex-end; }

/* ---------- footer ---------- */
.foot { margin-top: 96px; padding: 32px 0 40px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--text-3); }
.foot__in { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { color: var(--text-2); }

/* ---------- documentation ---------- */
.docs { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 56px; padding-top: 48px; }
.toc { position: sticky; top: 92px; align-self: start; font-size: .92rem; }
.toc p { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; color: var(--text-2); border-left: 1px solid transparent; }
.toc a:hover { color: var(--text); border-left-color: var(--accent); text-decoration: none; }

.prose { max-width: 760px; }
.prose > h1 { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 750; }
.prose > .lead { margin: 14px 0 0; max-width: none; text-align: left; }
.prose section { padding-top: 56px; }
.prose h2 { font-size: 1.6rem; font-weight: 700; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.prose h3 { margin-top: 32px; font-size: 1.15rem; font-weight: 650; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose figure { margin: 16px 0 0; }
.prose p, .prose li { color: var(--text-2); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose :not(pre) > code { color: var(--text); background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .86em; }
.prose .ui { color: var(--text); font-weight: 600; }
.prose figure.shot { max-width: 620px; }

.table-wrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.prose table { width: 100%; margin: 0; border-collapse: collapse; font-size: .94rem; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose tr:last-child td { border-bottom: 0; }
.prose th { font-weight: 600; color: var(--text); background: var(--surface-2); white-space: nowrap; }
.prose td:first-child { white-space: nowrap; color: var(--text); }

.prose pre {
  overflow-x: auto; padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--code-bg); color: var(--code-text); line-height: 1.55;
}
.prose pre .k { color: var(--code-key); }
.prose pre .s { color: var(--code-str); }
.prose pre .n { color: var(--code-num); }
.prose pre .o { color: var(--code-op); }
.example + .example { margin-top: 20px; }
.example p { margin-top: 0; }
.example pre { margin-top: 8px; }

.releases { list-style: none; padding: 0 !important; }
.releases > li { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); margin: 0 !important; }
.releases > li:first-child { border-top: 0; }
.releases h3 { margin: 0; font-size: 1rem; }
.releases time { display: block; font-size: .85rem; color: var(--text-3); }
.releases ul { margin: 0; padding-left: 18px; }
.note {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .points { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; gap: 28px; }
  .feature--flip .feature__text { order: 0; }
  .feature + .feature { margin-top: 72px; }
  .band { grid-template-columns: 1fr; text-align: center; padding: 32px 24px; }
  .band img { margin: 0 auto; }
  .band .cta { justify-content: center; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 32px; }
  .toc { position: static; margin-bottom: 8px; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 6px; border-left: 0; }
  .toc a { padding: 4px 12px; margin: 0; border: 1px solid var(--line); border-radius: 999px; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .top__in { gap: 16px; }
  .nav { display: none; }
  .brand { margin-right: auto; }
  .hero { padding-top: 48px; }
  .section { padding: 72px 0; }
  .section--tight { padding: 16px 0 0; }
  .cta .btn { width: 100%; }
  .releases > li { grid-template-columns: 1fr; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover { transform: none; }
}
