/* ============================================================
   haziq — brand tokens per ~/Studio/.claude/skills/haziq-style/
   All neutrals share hue 37 (the accent's hue) at low chroma.
   Single warm family. Accent used sparingly — one focal element per page.
   ============================================================ */

:root {
  /* Light */
  --bg: #f8f4f1;          /* warm off-white */
  --surface: #ffffff;
  --ink: #1f1612;         /* warm "black" — main text */
  --muted: #80766f;       /* secondary text, dividers */
  --border: #e3dad3;      /* surface / dividers on light */
  --border-strong: #c9bdb1;
  --accent: #ff621a;      /* used SPARINGLY — single focal element per page */
  --code-bg: #f1ebe4;

  /* Type */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --max-width: 680px;
  --max-width-wide: 920px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181310;        /* warm near-black */
    --surface: #1f1814;
    --ink: #f8f4f1;       /* warm cream */
    --muted: #80766f;
    --border: #2b2420;
    --border-strong: #3a312b;
    --code-bg: #221b17;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Base link style — overridden inside article for prose links */
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color 0.15s;
}

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

/* ============================================================
   Site header — no chrome, just type
   ============================================================ */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
}

.site-header nav {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

.site-header .logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px 48px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--ink);
}

/* ============================================================
   Type — display for impact, body for prose, mono for technical
   ============================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.hero h1,
.page-header h1,
article header h1 {
  font-size: 2.4em;
  font-weight: 800;
  margin: 0 0 12px 0;
  letter-spacing: -0.025em;
}

.page-header .subtitle,
.hero .lead {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05em;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  max-width: 540px;
}

.page-header {
  margin-bottom: 56px;
  padding-bottom: 0;
  border-bottom: 0;
}

article header {
  margin-bottom: 40px;
}

article header time,
article header span {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  margin-right: 16px;
  letter-spacing: 0.02em;
}

article h2 {
  font-size: 1.35em;
  font-weight: 700;
  margin-top: 2.4em;
  margin-bottom: 0.5em;
}

article h3 {
  font-size: 1.1em;
  font-weight: 700;
  margin-top: 1.6em;
}

article p,
article ul,
article ol {
  margin: 0 0 1.15em 0;
}

article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color 0.15s;
}

article a:hover {
  text-decoration-color: var(--ink);
}

article blockquote {
  border-left: 2px solid var(--border-strong);
  margin: 1.5em 0;
  padding: 0.1em 1.2em;
  color: var(--muted);
}

article ul, article ol { padding-left: 1.2em; }
article li { margin-bottom: 0.3em; }

code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
}

pre {
  background: var(--code-bg);
  padding: 16px 20px;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 13px;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  font-weight: 400;
}

article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.94em;
}

article th, article td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

article th {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ============================================================
   Lists — flat, no card chrome, just type and dividers
   ============================================================ */

.essay-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.essay-list li {
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.essay-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.essay-list time {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.essay-list h3 {
  margin: 0 0 6px 0;
  font-size: 1.2em;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}

.essay-list h3 a {
  color: var(--ink);
  text-decoration: none;
}

.essay-list h3 a:hover {
  color: var(--muted);
}

.essay-list .description {
  margin: 0;
  color: var(--muted);
  font-size: 0.96em;
  line-height: 1.55;
  max-width: 560px;
}

/* ============================================================
   Home page sections
   ============================================================ */

.section {
  margin: 72px 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.section-header h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-mono);
}

.section-header a {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.section-header a:hover {
  color: var(--ink);
}

.hero {
  margin-bottom: 80px;
}

.hero h1 {
  font-size: 2.6em;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 14px 0;
  font-weight: 800;
}

/* ============================================================
   CTAs — minimal chrome, type-first
   The subscribe button is the single accent moment per page.
   ============================================================ */

.newsletter-cta,
.mcp-cta {
  max-width: var(--max-width);
  margin: 64px auto 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--border);
}

.newsletter-cta h2,
.mcp-cta h2 {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-mono);
}

.newsletter-cta > p:first-of-type,
.mcp-cta > p:first-of-type {
  margin: 0 0 18px 0;
  color: var(--ink);
  font-size: 1em;
}

.newsletter-cta form {
  display: flex;
  gap: 8px;
}

.newsletter-cta input[type="email"] {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s;
}

.newsletter-cta input[type="email"]:focus {
  outline: 0;
  border-color: var(--ink);
}

.newsletter-cta input[type="email"]::placeholder {
  color: var(--muted);
}

.newsletter-cta button {
  padding: 12px 22px;
  font-size: 14px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: filter 0.15s;
}

.newsletter-cta button:hover {
  filter: brightness(1.08);
}

.mcp-cta pre {
  margin: 0 0 14px 0;
  font-size: 12px;
  padding: 14px 18px;
}

.mcp-cta > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93em;
}

.mcp-cta > p:last-child {
  margin-top: 12px;
}

/* ============================================================
   Academic citations (inline + popover + backlinks + target highlight)
   ============================================================ */

article a.inline-citation {
  text-decoration-style: dotted;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
}

article a.inline-citation:hover {
  text-decoration-color: var(--accent);
  color: var(--accent);
}

.citation-popover {
  position: absolute;
  z-index: 100;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 14px 18px;
  max-width: 420px;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.citation-popover em {
  font-style: italic;
}

.citation-popover .ref-doi {
  display: inline-block;
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 1px 6px;
}

.citation-popover .ref-doi:hover {
  border-color: var(--accent);
}

.ref-doi {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  vertical-align: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.ref-doi:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.ref-backlinks {
  display: inline-flex;
  gap: 6px;
  margin-left: 10px;
  vertical-align: 1px;
}

.ref-backlink {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color 0.15s, border-color 0.15s;
}

.ref-backlink:hover {
  color: var(--accent);
  border-color: var(--accent);
}

li[id^="ref-"]:target {
  background-color: color-mix(in srgb, var(--accent) 8%, transparent);
  outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 6px;
  border-radius: 2px;
  animation: ref-flash 1.2s ease-out;
}

@keyframes ref-flash {
  0% {
    background-color: color-mix(in srgb, var(--accent) 22%, transparent);
  }
  100% {
    background-color: color-mix(in srgb, var(--accent) 8%, transparent);
  }
}

html {
  scroll-behavior: smooth;
}

/* ============================================================
   Text Fragments native highlight (Chrome/Edge/Safari/Firefox 131+)
   Fires when a user arrives via #:~:text=... URL
   ============================================================ */

::target-text {
  background-color: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--ink);
  border-radius: 2px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 26%, transparent);
}

/* Selection styling — match the share-button accent */
::selection {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--ink);
}

/* ============================================================
   Share footer — appears at the end of each essay
   ============================================================ */

.essay-share {
  margin: 56px 0 8px;
  padding: 24px 0 0;
  border-top: 1px solid var(--border);
}

.essay-share h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.share-btn.copied {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   Comments thread
   ============================================================ */

.comments {
  margin: 64px 0 8px;
  padding: 32px 0 0;
  border-top: 1px solid var(--border);
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.comments-header h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.comments-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child {
  border-bottom: none;
}

.comment-header {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.comment-author {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}

.comment-author.is-author,
.comment-author.is-author a {
  color: var(--accent);
}

.comment-author a {
  color: inherit;
  text-decoration-color: var(--border);
}

.comment-author a:hover {
  text-decoration-color: var(--accent);
}

.comment-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.comment-body {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.comments-empty {
  font-family: var(--font-body);
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0 24px;
}

.comment-form {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.comment-form h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.comment-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form textarea {
  min-height: 90px;
  font-family: var(--font-body);
}

.comment-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.comment-form button {
  padding: 9px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.comment-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comment-form-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.comment-form .hp-field {
  /* honeypot — hidden from humans, bots see and fill */
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.comment-form .ok-msg {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 8px;
}

.comment-form .err-msg {
  color: #ff6b6b;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 8px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  html, body { font-size: 16px; }
  main { padding: 48px 20px 32px; }
  .hero h1 { font-size: 2em; }
  .page-header h1, article header h1 { font-size: 1.8em; }
  .nav-links { gap: 16px; }
  .newsletter-cta form { flex-direction: column; }
}
