/* ==========================================================================
   TheSingularity.watch — observatory dark theme
   Inspired by Linear's dark-native system: near-black canvas, luminance
   stepping, one chromatic accent, whisper-thin translucent borders.
   ========================================================================== */

:root {
  --bg:            #08090a;   /* marketing black canvas */
  --panel:         #0f1011;   /* header / footer */
  --surface:       rgba(255,255,255,0.02);
  --surface-2:     rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.06);

  --text:      #f7f8f8;
  --text-2:    #d0d6e0;
  --muted:     #8a8f98;
  --muted-2:   #62666d;

  --accent:        #7170ff;   /* electric indigo — the only chromatic color */
  --accent-bg:     #5e6ad2;
  --accent-hover:  #828fff;

  --border:        rgba(255,255,255,0.08);
  --border-subtle: rgba(255,255,255,0.05);

  --score-high: #10b981;
  --score-mid:  #eab308;
  --score-low:  #8a8f98;

  --radius:    8px;
  --radius-lg: 14px;
  --maxw:      1180px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-feature-settings: "cv01", "ss03";
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }

.muted { color: var(--muted); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent-bg); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8,9,10,0.82);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  display: flex; align-items: center; gap: 24px;
  height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.brand-mark { color: var(--accent); font-size: 18px; }
.brand-text { font-size: 16px; }
.site-nav { display: flex; gap: 18px; margin-left: 8px; flex: 1; flex-wrap: wrap; }
.site-nav a { color: var(--text-2); font-size: 14px; font-weight: 500; }
.site-nav a:hover { color: var(--text); }
.nav-search input {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 8px 12px; width: 200px; font-size: 14px;
  font-family: var(--sans);
}
.nav-search input::placeholder { color: var(--muted-2); }
.nav-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(113,112,255,0.15); }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 28px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 36px; }
.hero h1 {
  font-size: clamp(34px, 6vw, 60px); line-height: 1.02; letter-spacing: -0.035em;
  font-weight: 600; margin: 0 0 16px; max-width: 16ch;
}
.hero h1 .accent { color: var(--accent); }
.hero p { font-size: 18px; color: var(--muted); max-width: 60ch; margin: 0 0 20px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--accent-bg); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

/* ---------- Section heading ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 18px; }
.section-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.section-head a { font-size: 13px; color: var(--accent); }
.eyebrow {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--muted-2); display: block; margin-bottom: 10px;
}

/* ---------- Card grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.card:hover { background: var(--surface-2); border-color: rgba(255,255,255,0.14); transform: translateY(-2px); }
.card-link { display: block; padding: 18px; height: 100%; }
.card-top { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; line-height: 1.3; }
.card:hover .card-title { color: var(--text); }
.card-summary { color: var(--muted); font-size: 14px; margin: 0 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* "Why it matters" hook on cards — small label + slightly brighter, tighter text */
.why-tag {
  display: inline-block; font-family: var(--mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent);
  margin: 0 0 7px;
}
.card-summary.card-why { color: var(--text-2); font-size: 14px; -webkit-line-clamp: 3; margin-bottom: 16px; }
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500; border: 1px solid var(--border);
}
.chip-cat { color: var(--text-2); background: var(--surface-2); }
.chip-role { font-family: var(--mono); letter-spacing: 0.02em; }
.role-discovered { color: #34d399; border-color: rgba(52,211,153,0.3); }
.role-designed   { color: #818cf8; border-color: rgba(129,140,248,0.3); }
.role-assisted   { color: #38bdf8; border-color: rgba(56,189,248,0.3); }
.role-validated  { color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.role-screened   { color: #f472b6; border-color: rgba(244,114,182,0.3); }

/* ---------- Score badge ---------- */
.score {
  font-family: var(--mono); font-weight: 500; font-size: 12px;
  width: 30px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid var(--border);
}
.score-high { color: var(--score-high); border-color: rgba(16,185,129,0.35); }
.score-mid  { color: var(--score-mid);  border-color: rgba(234,179,8,0.35); }
.score-low  { color: var(--score-low); }

/* ---------- Article page ---------- */
.article { max-width: 760px; margin: 0 auto; padding: 8px 0 40px; }
.article .top { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.article h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 14px; }
.article .lead { font-size: 19px; color: var(--text-2); margin: 0 0 24px; }
.article .body { font-size: 16px; color: var(--text-2); line-height: 1.7; }
.article .body p { margin: 0 0 18px; }
.meta-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; padding: 14px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); margin-bottom: 28px; }

.scorecard { display: flex; gap: 12px; margin: 26px 0; flex-wrap: wrap; }
.scorebox { flex: 1; min-width: 150px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.scorebox .n { font-family: var(--mono); font-size: 26px; font-weight: 500; }
.scorebox .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.sources { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin: 28px 0; }
.sources h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.source-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.source-item:first-of-type { border-top: none; }
.source-host { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.source-title { font-size: 14px; color: var(--text-2); }

/* ---------- Empty / notices ---------- */
.notice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-subtle); margin-top: 60px; background: var(--panel); padding: 36px 0 28px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.footer-nav a { color: var(--text-2); font-size: 14px; }
.footer-fine { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-subtle); font-size: 13px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 900px; margin: 30px auto; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; }
.admin-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.admin-actions form { display: inline; }
label.field { display: block; margin: 10px 0; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input.inp, textarea.inp, select.inp {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-family: var(--sans); font-size: 14px;
}
textarea.inp { min-height: 90px; resize: vertical; }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: center; gap: 10px; margin: 36px 0; }
.pager a, .pager span { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; }
.pager .current { background: var(--surface-2); }

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 12px; }
  .nav-search { width: 100%; }
  .nav-search input { width: 100%; }
  .footer-fine { flex-direction: column; }
}

/* ---------- Plain-English layer ---------- */
.why-matters {
  background: linear-gradient(135deg, rgba(113,112,255,0.12), rgba(113,112,255,0.04));
  border: 1px solid rgba(113,112,255,0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin: 22px 0;
}
.why-matters .why-label {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); display: block; margin-bottom: 6px; font-weight: 500;
}
.why-matters p { margin: 0; font-size: 16px; color: var(--text); }

/* Collapsible technical version on article page */
details.technical {
  margin: 28px 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0;
}
details.technical summary {
  cursor: pointer; padding: 14px 18px; font-size: 14px; font-weight: 500; color: var(--muted);
  user-select: none; list-style: none;
}
details.technical summary::-webkit-details-marker { display: none; }
details.technical summary:hover { color: var(--text-2); }
details.technical[open] summary { border-bottom: 1px solid var(--border-subtle); }
details.technical .tech-title { font-size: 16px; color: var(--text-2); margin: 14px 18px 8px; line-height: 1.4; }
details.technical .tech-abstract { font-size: 14px; color: var(--muted); margin: 0 18px 16px; line-height: 1.6; }

/* Technical source preview inside the admin queue */
.tech-source {
  background: var(--bg); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px;
}
.tech-source-title { font-size: 14px; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.tech-source-summary { font-size: 12px; line-height: 1.5; }

/* ---------- Newsletter band (above footer) ---------- */
.newsletter-band {
  border-top: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, rgba(94,106,210,0.10), rgba(113,112,255,0.03));
  margin-top: 60px;
}
.newsletter-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 34px 24px; flex-wrap: wrap;
}
.newsletter-copy h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.newsletter-copy p { margin: 0; color: var(--muted); font-size: 15px; }
.newsletter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.newsletter-form .inp { width: auto; }
.newsletter-form input[type=email] { min-width: 220px; }
.newsletter-form select { min-width: 150px; }
.newsletter-form .btn { white-space: nowrap; }

/* ---------- Subscribe page card ---------- */
.sub-card {
  max-width: 460px; margin: 0 auto 44px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px;
}
.sub-card .field { margin: 0 0 14px; }
.sub-card h2 { letter-spacing: -0.02em; }

@media (max-width: 640px) {
  .newsletter-inner { flex-direction: column; align-items: stretch; text-align: center; }
  .newsletter-form { justify-content: center; }
  .newsletter-form .inp, .newsletter-form .btn { width: 100%; }
}
