/* ==========================================================================
   HostMonitor — home page (index.html). Requires base.css.
   ========================================================================== */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── NAV ── */
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { font-size: .9rem; color: var(--muted); transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.btn-store {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-size: .875rem; font-weight: 600;
  transition: background .2s, transform .15s;
}
.btn-store:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-store svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Hamburger: hidden above the phone breakpoint, where the inline links show. */
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--border2); border-radius: 8px;
  background: var(--surface); color: var(--text2);
  cursor: pointer; transition: border-color .2s, background .2s;
}
.nav-toggle:hover { border-color: var(--accent); background: var(--accent-lt); color: var(--accent); }
.nav-toggle svg { width: 18px; height: 18px; display: block; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Tablet: 6 links + logo + labelled button overruns the 64px bar well
   before the 640px phone breakpoint, so tighten before hiding. */
@media (max-width: 980px) {
  .nav-links { gap: 1.15rem; font-size: .85rem; }
  .btn-store span { display: none; }
  .btn-store { padding: 8px 12px; }
}

@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; }
  .btn-store { margin-left: auto; margin-right: .6rem; }
  /* Collapsed by default; .open turns it into a panel under the bar. */
  .nav-links { display: none; }
  .nav-links.open {
    /* base rule centres items for the horizontal bar; stretch them here so
       each link is a full-width tap target */
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 28px rgba(var(--shadow-rgb),.16);
    padding: .35rem 0 .6rem;
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .nav-links.open a {
    padding: 13px clamp(1rem, 5vw, 3rem);
    font-size: .95rem; color: var(--text2);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open a:last-child { border-bottom: 0; }
  .nav-links.open a:hover, .nav-links.open a:focus-visible {
    background: var(--accent-lt); color: var(--accent);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .nav-links.open { animation: navdrop .16s ease-out; }
  @keyframes navdrop { from { opacity: 0; transform: translateY(-6px); } }
}

/* ── HERO ── */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(3rem, 6vw, 4.5rem) clamp(1rem, 5vw, 3rem) clamp(2rem, 3.5vw, 3rem);
  text-align: center;
  background: linear-gradient(180deg, var(--hero-top) 0%, var(--bg) 100%);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(var(--accent-rgb),.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 14px; border-radius: 100px;
  background: var(--accent-lt); border: 1px solid var(--accent-br2);
  font-size: .8rem; color: var(--accent); font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero-badge span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -.03em; color: var(--text);
  margin-bottom: 1.25rem;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero > p {
  max-width: 580px; margin: 0 auto 2.5rem;
  color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.15rem);
}
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.25rem; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-size: 1rem; font-weight: 700;
  transition: background .2s, transform .15s, box-shadow .2s;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(var(--accent-rgb),.3); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: var(--radius);
  background: var(--surface); color: var(--text2);
  border: 1px solid var(--border2);
  font-size: 1rem; font-weight: 600;
  transition: border-color .2s, background .2s, transform .15s;
}
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-lt); transform: translateY(-2px); }

/* ── SCREENSHOT FRAME ── */
/* Screenshots render 1:1 - never upscaled past their native pixel size.
   Sources differ in width, so width:100% would blow the small ones up and
   soften them. Only downscale when the viewport is narrower than the image. */
.screen-frame {
  position: relative; width: fit-content; max-width: 100%; margin: 0 auto;
}
.screen-frame picture, .screen-frame-sm picture { display: block; }
.screen-frame::before {
  content: '';
  position: absolute; inset: 30px -10px -30px;
  background: radial-gradient(ellipse at 50% 80%, rgba(var(--accent-rgb),.13) 0%, transparent 65%);
  pointer-events: none; z-index: 0;
}
.screen-frame img {
  width: auto; max-width: 100%; height: auto;
  display: block; position: relative; z-index: 1;
  border-radius: 8px;
  border: 1px solid var(--border2);
  box-shadow: 0 24px 64px rgba(var(--shadow-rgb),.14), 0 4px 16px rgba(var(--shadow-rgb),.07);
}

/* smaller variant used in 2-col layouts */
.screen-frame-sm img {
  width: auto; max-width: 100%; height: auto;
  display: block; margin: 0 auto;
  border-radius: 8px;
  border: 1px solid var(--border2);
  box-shadow: 0 12px 36px rgba(var(--shadow-rgb),.12), 0 2px 8px rgba(var(--shadow-rgb),.06);
}

/* ── SECTION LAYOUT ── */
section { padding: clamp(2rem, 3.5vw, 3.25rem) clamp(1rem, 5vw, 3rem); }
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 800; line-height: 1.15; letter-spacing: -.025em;
  margin-bottom: 1rem; color: var(--text);
}
.section-sub { color: var(--muted); max-width: 540px; font-size: 1rem; }
.section-header { margin-bottom: 1.75rem; }
.section-header.center { text-align: center; }
.section-header.center .section-sub { margin: 0 auto; }

/* ── FEATURES ── */
#features { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
/* 9 cards in a fixed 3x3 — auto-fit gave 4+4+1 and left an orphan row. */
.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
  max-width: 1080px; margin: 0 auto;
}
@media (max-width: 900px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .features-grid { grid-template-columns: 1fr; } }
.feature-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem; transition: border-color .2s, box-shadow .2s, transform .2s;
}
.feature-card:hover { border-color: var(--accent-br); box-shadow: 0 4px 16px rgba(var(--accent-rgb),.08); transform: translateY(-2px); }
.feature-icon {
  width: 42px; height: 42px; border-radius: 9px;
  background: var(--accent-lt); border: 1px solid var(--accent-br2);
  display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.feature-icon svg { width: 20px; height: 20px; color: var(--accent); }
.feature-icon.green { background: var(--green-lt); border-color: var(--green-br); }
.feature-icon.green svg { color: var(--green); }
.feature-icon.purple { background: var(--purple-lt); border-color: var(--purple-br); }
.feature-icon.purple svg { color: var(--purple); }
.feature-icon.yellow { background: var(--yellow-lt); border-color: var(--yellow-br); }
.feature-icon.yellow svg { color: var(--yellow); }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; color: var(--text); }
.feature-card p { font-size: .875rem; color: var(--muted); line-height: 1.65; }

/* ── GALLERY ── */
#screenshots { background: var(--bg); }
.screenshots-tabs {
  display: flex; gap: .5rem; margin-bottom: 2rem; flex-wrap: wrap; justify-content: center;
}
.stab {
  padding: 8px 18px; border-radius: 100px; font-size: .88rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; transition: all .2s;
}
.stab.active, .stab:hover { background: var(--accent-lt); border-color: var(--accent-br); color: var(--accent); }
.stab.active { border-color: var(--accent); }
.screenshots-panel { display: none; }
.screenshots-panel.active { display: block; }
.screenshot-caption {
  margin-top: 1.25rem; font-size: .9rem; color: var(--muted); text-align: center;
}
.screenshot-caption strong { color: var(--text2); }

/* ── PROTOCOLS ── */
#protocols { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.protocols-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start;
}
/* 1fr tracks default to min-width:auto, so the wide UDP table would floor the
   column and push both children past a phone viewport. */
.protocols-layout > *, .alarms-layout > * { min-width: 0; }
@media (max-width: 768px) { .protocols-layout { grid-template-columns: 1fr; } }
.protocol-list { display: flex; flex-direction: column; gap: .75rem; }
.protocol-item {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.1rem 1.25rem; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s;
}
.protocol-item:hover { border-color: var(--accent-br); box-shadow: 0 2px 10px rgba(var(--accent-rgb),.07); }
.protocol-tag {
  flex-shrink: 0; padding: 4px 10px; border-radius: 6px;
  font-size: .72rem; font-weight: 700; font-family: 'SF Mono','Fira Code',Consolas,monospace;
  min-width: 58px; text-align: center;
  background: var(--accent-lt); color: var(--accent); border: 1px solid var(--accent-br2);
}
.protocol-tag.icmp { background: var(--yellow-lt); color: var(--yellow); border-color: var(--yellow-br); }
.protocol-tag.tcp  { background: var(--green-lt);  color: var(--green);  border-color: var(--green-br); }
.protocol-tag.udp  { background: var(--red-lt);    color: var(--red);    border-color: var(--red-br); }
.protocol-tag.http { background: var(--purple-lt); color: var(--purple); border-color: var(--purple-br); }
.protocol-info h4 { font-size: .9rem; font-weight: 700; margin-bottom: .2rem; color: var(--text); }
.protocol-info p { font-size: .83rem; color: var(--muted); line-height: 1.55; }

.udp-table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; box-shadow: 0 2px 8px rgba(var(--shadow-rgb),.04);
}
.udp-table-title {
  padding: 11px 16px; font-size: .72rem; font-weight: 700; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--bg);
  letter-spacing: .07em; text-transform: uppercase;
}
.udp-table { width: 100%; min-width: 340px; border-collapse: collapse; font-size: .82rem; }
.udp-table th { padding: 7px 14px; text-align: left; color: var(--muted); font-size: .7rem; letter-spacing: .06em; background: var(--bg); text-transform: uppercase; border-bottom: 1px solid var(--border); font-weight: 600; }
.udp-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--text2); }
.udp-table tr:last-child td { border-bottom: none; }
.udp-table .port { font-family: 'SF Mono','Fira Code',Consolas,monospace; color: var(--accent); font-weight: 600; }
.udp-table .proto-name { font-weight: 600; }
.udp-table tr.generic td { color: var(--muted2); }

/* ── ALARMS ── */
#alarms { background: var(--bg); }
.alarms-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
@media (max-width: 768px) { .alarms-layout { grid-template-columns: 1fr; } }
.alarm-modes { display: flex; flex-direction: column; gap: .75rem; margin-top: 2rem; }
.alarm-mode {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1rem 1.15rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .2s;
}
.alarm-mode:hover { border-color: var(--accent-br); }
.alarm-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent-lt); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; border: 1px solid var(--accent-br2);
}
.alarm-mode h4 { font-size: .88rem; font-weight: 700; margin-bottom: .2rem; color: var(--text); }
.alarm-mode p { font-size: .82rem; color: var(--muted); }

/* ── THEMES ── */
#themes { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.themes-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
  max-width: 1080px; margin: 0 auto;
}
@media (max-width: 900px) { .themes-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .themes-grid { grid-template-columns: 1fr; } }
.theme-card {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border2); background: var(--bg);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.theme-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(var(--shadow-rgb),.12); border-color: var(--accent-br); }
/* Real 1440x600 grid captures, cropped to the populated top-left corner. */
.theme-preview { height: 132px; overflow: hidden; background: var(--surface2); }
.theme-preview picture { display: block; height: 100%; }
/* Render at 2x card width and clip, so the rows read as the theme's
   colour instead of shrinking to an unreadable smear. */
.theme-preview img {
  width: 200%; max-width: none; height: auto; display: block;
}
.theme-name {
  padding: 10px 14px; font-size: .85rem; font-weight: 600; color: var(--text2);
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.theme-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
/* The app's own theme colours — deliberately fixed, not site tokens, so they
   read the same whether the site is in light or dark mode. */
.theme-dot.blue     { background: #4696ff; }  /* BlueTheme accent */
.theme-dot.green    { background: #46dc78; }  /* GreenTheme accent */
.theme-dot.lavender { background: #7c3aed; }
.theme-dot.amber    { background: #ff9830; }  /* AmberTheme accent */
.theme-dot.slate    { background: #3f5e8a; }  /* SlateTheme accent */
.theme-dot.system   { background: #2f80ed; }  /* DefaultTheme accent */

/* ── LANGUAGES ── */
#languages { background: var(--bg); }
.lang-strip { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 2.5rem; }
.lang-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .88rem; font-weight: 600; color: var(--text2);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.lang-chip:hover { border-color: var(--accent-br); box-shadow: 0 2px 10px rgba(var(--accent-rgb),.08); transform: translateY(-2px); }
.lang-flag { font-size: 1.35rem; line-height: 1; }

/* ── DOWNLOAD ── */
#download {
  background: linear-gradient(180deg, var(--bg) 0%, var(--hero-top) 100%);
  text-align: center; position: relative; overflow: hidden;
}
#download::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 70% at 50% 100%, rgba(var(--accent-rgb),.1) 0%, transparent 70%);
  pointer-events: none;
}
.download-inner { position: relative; z-index: 1; max-width: 580px; margin: 0 auto; }
.download-inner h2 {
  font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -.03em;
  color: var(--text); margin-bottom: 1rem;
}
.download-inner p { color: var(--muted); font-size: 1.05rem; margin-bottom: 2.5rem; }
.download-inner .buy-note { margin-top: 1rem; font-size: .95rem; }
.buy-note a { color: var(--accent); font-weight: 700; }
.store-btn {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 16px 32px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-size: 1.05rem; font-weight: 700;
  transition: background .2s, transform .15s, box-shadow .2s;
}
.store-btn:hover { background: var(--accent2); transform: translateY(-2px); box-shadow: 0 10px 32px rgba(var(--accent-rgb),.35); }
.store-btn svg { width: 24px; height: 24px; }
/* Scoped so it outranks `.download-inner p` — unscoped, this rule never applied. */
.download-inner .version-badge { margin-top: 1.25rem; margin-bottom: 0; font-size: .85rem; color: var(--muted2); }

/* ── FOOTER ── */
.site-footer {
  padding: 1.75rem clamp(1rem, 5vw, 3rem);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-size: .85rem; color: var(--muted);
  background: var(--surface);
}
.footer-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.footer-logo img { width: 24px; height: 24px; }
.site-footer .footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.site-footer .footer-links a { color: var(--muted); transition: color .2s; }
.site-footer .footer-links a:hover { color: var(--accent); }

/* ── CROSS-PROMO ── */
/* The band each site uses to point at the other. In production the two are
   separate hosts (www.hostmonitor.app and pro.hostmonitor.app), so the links
   here are absolute: a relative one would resolve inside whichever site is
   serving the page, and the Pro site is its own document root. */
.cross-promo { background: var(--surface); border-top: 1px solid var(--border); }
.cross-promo-inner {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(1rem, 3vw, 2.25rem); flex-wrap: wrap;
}
.cross-promo-mark {
  flex: none; width: 56px; height: 56px; border-radius: 14px;
  border: 1px solid var(--border2); background: var(--bg);
  display: grid; place-items: center; overflow: hidden;
}
.cross-promo-mark img { width: 40px; height: 40px; display: block; }
.cross-promo-text { flex: 1 1 340px; }
.cross-promo-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .35rem;
}
.cross-promo h2 {
  font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em;
  color: var(--text); margin-bottom: .4rem;
}
.cross-promo p { color: var(--muted); font-size: .95rem; line-height: 1.6; }
.cross-promo .btn-secondary { flex: none; }

@media (max-width: 640px) {
  .cross-promo-inner { text-align: center; }
  .cross-promo-text { flex-basis: 100%; }
}

/* ── PLATFORM DOWNLOAD ── */
/* Both builds are in the markup and the one that does not match the visitor is
   hidden, so choosing costs no extra request and degrades safely: with no class
   on <html> -- JavaScript off, or a platform with no build -- the macOS button
   stays primary and Windows is offered beneath it. The class is set in the head
   of index.html, before first paint, so neither flashes. */
[data-os="win"]     { display: none; }
[data-os-alt="mac"] { display: none; }

html.is-windows [data-os="mac"]     { display: none; }
html.is-windows [data-os-alt="win"] { display: none; }
html.is-windows [data-os="win"]     { display: inline-flex; }
html.is-windows [data-os-alt="mac"] { display: block; }
