/* Port-Light landing page — layout & sections. */

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 20px; margin-left: auto; }
.nav-links a { color: var(--text-dim); font-size: .9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-family: var(--font-mono);
  transition: border-color .15s;
}
.nav-btn:hover { border-color: var(--accent); }
.btn-gh { padding: 7px 14px; font-size: .85rem; }
.stat-pill {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.stat-pill b { color: var(--text); font-weight: 600; }
a.stat-pill:hover { text-decoration: none; border-color: var(--accent); color: var(--text); }

.theme-menu[hidden] { display: none; }
.theme-menu {
  position: absolute;
  right: max(24px, calc((100% - var(--max-w)) / 2));
  top: 58px;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 2px;
  padding: 8px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
  max-height: 70vh;
  overflow-y: auto;
}
.theme-menu button {
  text-align: left;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-dim);
}
.theme-menu button:hover { background: var(--card-hover); color: var(--text); }
.theme-menu button.active { color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: 110px 0 90px; position: relative; overflow: hidden; }
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% 10%, color-mix(in srgb, var(--used) 12%, transparent), transparent 70%),
    radial-gradient(500px 380px at 5% 90%, color-mix(in srgb, var(--configured) 7%, transparent), transparent 70%);
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 18px; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- demo panel ---------- */
.hero-demo { position: relative; }
.demo-panel {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
.demo-lighthouse {
  position: absolute;
  top: 11px;
  left: 12px;
  width: 24px;
  height: 24px;
  z-index: 2;
}
.beam {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 680px;
  height: 680px;
  pointer-events: none;
  transform-origin: 0 0;
  background: conic-gradient(from 0deg at 0 0, transparent 0deg, color-mix(in srgb, var(--used) 16%, transparent) 5deg, transparent 12deg);
  animation: beamspin 12s linear infinite;
  z-index: 1;
}
@keyframes beamspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .beam { display: none; } }

.demo-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px 46px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
#demo-search {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .85rem;
}
#demo-search:focus { outline: none; border-color: var(--accent); }
#demo-search::placeholder { color: var(--text-dim); }

.demo-counts {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
  margin: 10px 12px 6px;
  position: relative;
  z-index: 2;
}
.demo-grid {
  padding: 4px 12px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
  max-height: 430px;
  overflow-y: auto;
  position: relative;
  z-index: 2;
  scrollbar-width: thin;
}
.demo-note {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text-dim);
  text-align: right;
  padding: 0 14px 10px;
  margin: 0;
  position: relative;
  z-index: 2;
}

.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--elevated);
  font-family: var(--font-mono);
  text-align: left;
  min-width: 0;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.cell:hover { border-color: var(--accent); }
.cell .num { font-size: .95rem; font-weight: 700; line-height: 1.2; }
.cell .lbl {
  font-size: .62rem;
  color: var(--text-dim);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell::after {
  content: '';
  position: absolute;
  right: 7px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--used);
}
.cell.configured { border-style: dashed; }
.cell.configured::after { background: var(--configured); }
.cell.free {
  border-color: color-mix(in srgb, var(--free) 45%, transparent);
  background: color-mix(in srgb, var(--free) 8%, transparent);
}
.cell.free .lbl { color: var(--free); }
.cell.free::after { background: var(--free); }
.cell.hit { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cell.lit { background: color-mix(in srgb, var(--used) 14%, var(--elevated)); }
.cell.flash { animation: cellflash 1.2s ease; }
.cell.conflict { animation: cellconflict 1s ease 3; }
@keyframes cellflash { 0% { box-shadow: 0 0 0 3px var(--used); } 100% { box-shadow: none; } }
@keyframes cellconflict { 50% { border-color: var(--conflict); box-shadow: 0 0 0 2px var(--conflict); } }
@media (prefers-reduced-motion: reduce) {
  .cell.flash, .cell.conflict { animation: none; }
}

.demo-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: var(--elevated);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .78rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  z-index: 3;
}

/* ---------- how it works ---------- */
.sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 44px 0 8px; }
.source-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .2s;
}
.source-card:hover { border-color: var(--accent); }
.source-card h3 { font-family: var(--font-mono); font-size: .92rem; font-weight: 600; margin-bottom: 8px; color: var(--accent); }
.source-card p { margin: 0; color: var(--text-dim); font-size: .92rem; }
.merge-arrow { text-align: center; font-size: 1.5rem; color: var(--text-dim); margin: 14px 0; }
.merge-visual { display: flex; justify-content: center; margin-bottom: 28px; }
.merge-grid {
  display: grid;
  grid-template-columns: repeat(8, 34px);
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.merge-grid i { height: 26px; border-radius: 5px; opacity: .9; }
.merge-grid .u { background: color-mix(in srgb, var(--used) 55%, var(--card)); }
.merge-grid .c { background: color-mix(in srgb, var(--configured) 55%, var(--card)); }
.merge-grid .f { background: color-mix(in srgb, var(--free) 45%, var(--card)); }
.legend { display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }

/* ---------- features ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .2s, border-color .2s;
}
.feature-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.feature-card .ico { font-size: 1.4rem; }
.feature-card h3 { font-size: 1rem; margin: 10px 0 6px; }
.feature-card p { margin: 0; font-size: .88rem; color: var(--text-dim); }

/* ---------- agents terminal ---------- */
.terminal {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 36px 0 20px;
  max-width: 820px;
}
.terminal-bar { display: flex; gap: 6px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.terminal-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.terminal pre { margin: 0; padding: 18px; font-size: .85rem; overflow-x: auto; position: relative; }
.terminal .prompt { color: var(--free); user-select: none; }
.terminal .out { color: var(--text-dim); }
.agents-link { font-size: .95rem; }

/* ---------- themes gallery ---------- */
.theme-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 40px;
}
.theme-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  background: var(--card);
}
.theme-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card .swatches { display: flex; height: 46px; }
.theme-card .swatches i { flex: 1; }
.theme-card .tname {
  display: block;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
}

/* ---------- quick start ---------- */
.two-col { display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; align-items: start; margin-top: 40px; }
.qs-side { display: grid; gap: 16px; }
.qs-open { margin: 0; font-family: var(--font-mono); font-size: .88rem; color: var(--text-dim); }
.qs-open .mono { color: var(--free); }
.qs-note { margin: 0; font-size: .85rem; color: var(--text-dim); }

/* ---------- limits ---------- */
.limits {
  background: var(--elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.limits .lead { max-width: 72ch; }
.limits-links { margin-top: 18px; font-size: .9rem; }

/* ---------- footer ---------- */
footer { padding: 48px 0 64px; color: var(--text-dim); font-size: .85rem; }
.foot-inner { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; }
.foot-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; color: var(--text); }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--text-dim); }
.foot-links a:hover { color: var(--text); }
.ph-badge { opacity: .85; transition: opacity .2s; }
.ph-badge:hover { opacity: 1; }
.foot-fine { width: 100%; margin: 0; font-size: .78rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { padding: 72px 0 64px; }
  .hero-inner, .two-col { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .sources { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .theme-menu { left: 16px; right: 16px; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .feature-grid { grid-template-columns: 1fr; }
  section { padding: 64px 0; }
  .merge-grid { grid-template-columns: repeat(8, 24px); gap: 5px; }
  .merge-grid i { height: 20px; }
  .demo-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
  .stat-pill.hide-sm { display: none; }
  .nav-inner { gap: 12px; }
  .btn-gh { padding: 7px 10px; font-size: .8rem; }
  .nav-actions { gap: 7px; }
}
