/* =========================================================
   Tau Intelligence — global stylesheet
   Palette derived from the company logo (warm copper / cream
   on near-black). Keep tokens here so the whole site can be
   re-themed by editing :root.
   ========================================================= */

:root {
  /* Core palette */
  --bg:           #0E0D0B;
  --bg-elev:     #15130F;
  --surface:     #1C1813;
  --surface-2:   #25201A;
  --line:        #2E2820;

  --primary:     #E8722C;   /* logo orange */
  --primary-2:   #B8541C;   /* deep copper  */
  --accent:      #E9A766;   /* warm gold    */
  --accent-2:    #6FB7C9;   /* cool contrast (sphere highlight) */

  --text:        #F2E9D8;
  --text-dim:    #B7AC97;
  --text-mute:   #7E7565;

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;

  /* Layout */
  --maxw: 1180px;
  --radius: 14px;
  --radius-sm: 8px;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

img { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s var(--ease);
}
a:hover { color: var(--primary); }

::selection { background: var(--primary); color: var(--bg); }

/* ===== Background grain + subtle gradient glow ===== */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(232,114,44,.18), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(184,84,28,.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 0.9  0 0 0 0 0.85  0 0 0 0 0.75  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  opacity: .35;
  mix-blend-mode: overlay;
  z-index: 0;
}

/* ===== Layout ===== */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.section {
  padding: 96px 0;
  position: relative;
  z-index: 1;
}

.section-tight { padding: 56px 0; }

/* ===== Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(14,13,11,.65);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: .02em;
}
.brand img { height: 32px; width: 32px; border-radius: 6px; }
.brand .brand-mark {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--primary);
  line-height: 1;
}
.brand .brand-name { font-size: 15px; }
.brand .brand-sub  { font-size: 11px; color: var(--text-mute); letter-spacing: .12em; text-transform: uppercase; }

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}
.nav-links a {
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--primary); background: rgba(232,114,44,.08); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px !important;
  border: 1px solid var(--primary);
  color: var(--primary) !important;
  border-radius: 999px;
}
.nav-cta:hover { background: var(--primary); color: var(--bg) !important; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

/* ===== Hero ===== */

/* Fixed fullscreen 3D canvas behind all content */
.hero-bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;  /* let clicks pass through to content */
}

.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 720px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.02);
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
  animation: pulse 2s infinite var(--ease);
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .35; transform: scale(.7); }
}

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.05;
  margin: 22px 0 18px;
  letter-spacing: -.01em;
}
.hero h1 .tau {
  color: var(--primary);
  font-style: italic;
  /* Keep inline so it doesn't introduce a wrap point between τ and the
     following "rustworthy" — preserves the τ-rustworthy wordplay. */
}
.hero p.lede {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto 28px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 28px;
  margin-top: 36px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta span::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--primary-2);
  display: inline-block;
  transform: rotate(45deg);
}

/* (Old hero-canvas-wrap styles removed — canvas is now fullscreen fixed) */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s var(--ease), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn-primary {
  background: var(--primary);
  color: #1a0f06;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); color: #1a0f06; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* ===== Generic section title ===== */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.section-title h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(28px, 3.6vw, 42px);
  margin: 0;
  letter-spacing: -.005em;
}
.section-title .kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--primary);
}
.section-title p {
  color: var(--text-dim);
  max-width: 560px;
  margin: 8px 0 0;
}

/* ===== Capability grid (home) ===== */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.cap-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform .25s var(--ease), border-color .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.cap-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(232,114,44,.4), transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
}
.cap-card:hover { transform: translateY(-3px); border-color: rgba(232,114,44,.4); }
.cap-card:hover::after { opacity: 1; }
.cap-card .icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(232,114,44,.10);
  color: var(--primary);
  margin-bottom: 18px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
}
.cap-card h3 {
  font-size: 18px;
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-weight: 600;
}
.cap-card p { margin: 0; color: var(--text-dim); font-size: 14.5px; }

/* ===== Logos / venues strip ===== */
.venues {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 28px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.venues span { color: var(--text-dim); }

/* ===== Cards (papers, blogs) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.card:hover { border-color: rgba(232,114,44,.45); background: var(--surface-2); transform: translateY(-2px); }
.card .meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  align-items: center;
}
.tag {
  padding: 3px 9px;
  background: rgba(232,114,44,.10);
  color: var(--primary);
  border-radius: 999px;
  border: 1px solid rgba(232,114,44,.25);
  font-size: 10.5px;
}
.card h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 22px;
  margin: 0;
  line-height: 1.25;
}
.card .authors { color: var(--text-dim); font-size: 14px; margin: -4px 0 0; }
.card .abstract { color: var(--text-dim); font-size: 14.5px; margin: 4px 0 0; }
.card .links {
  margin-top: auto;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
}
.card .links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 2px;
}
.card .links a:hover { color: var(--primary); border-color: var(--primary); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-bar button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: all .2s var(--ease);
}
.filter-bar button:hover { color: var(--text); border-color: var(--text-dim); }
.filter-bar button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg);
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 9px 16px;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  min-width: 220px;
  transition: border-color .2s var(--ease);
}
.search-input:focus { border-color: var(--primary); }

/* Empty / loading state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .08em;
}

/* ===== About page ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.about-grid h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  margin: 0 0 16px;
}
.about-grid p { color: var(--text-dim); font-size: 16.5px; }
.values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}
.value {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.value h4 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--primary);
}
.value p { margin: 0; font-size: 14px; color: var(--text-dim); }

.contact-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}
.contact-card h3 { margin: 0 0 8px; font-family: var(--font-serif); font-weight: 500; font-size: 26px; }
.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: 0; }
.contact-row .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  width: 90px;
  flex-shrink: 0;
}
.contact-row a { color: var(--text); }
.contact-row a:hover { color: var(--primary); }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 80px;
  padding: 40px 0;
  color: var(--text-mute);
  font-size: 13px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer .brand .brand-name { color: var(--text-dim); }

/* ===== Article (blog detail) ===== */
.article {
  max-width: 760px;
  margin: 60px auto;
  padding: 0 24px;
}
.article .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.article h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(32px, 4.4vw, 50px);
  line-height: 1.1;
  margin: 0 0 24px;
}
.article .pdf-frame {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
}

/* =========================================================
   Markdown article body — `.md` is the wrapper class added
   by blog-viewer.js around the rendered post HTML.
   ========================================================= */
.md { color: var(--text-dim); }
.md > *:first-child { margin-top: 0; }

.md h1, .md h2, .md h3, .md h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--text);
  margin: 1.8em 0 .5em;
  line-height: 1.2;
  letter-spacing: -.005em;
}
.md h1 { font-size: 32px; }
.md h2 { font-size: 26px; border-bottom: 1px solid var(--line); padding-bottom: .35em; }
.md h3 { font-size: 20px; }
.md h4 { font-size: 17px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-mono); }

.md p, .md li { color: var(--text-dim); line-height: 1.75; font-size: 17px; }
.md p  { margin: 1em 0; }
.md ul, .md ol { padding-left: 1.4em; margin: 1em 0; }
.md li { margin: .35em 0; }
.md li::marker { color: var(--primary); }

.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5em 0;
}

.md a {
  color: var(--primary);
  border-bottom: 1px dashed var(--primary-2);
}
.md a:hover { color: var(--accent); border-color: var(--accent); }

.md strong { color: var(--text); }
.md em     { color: var(--text); }

/* ----- Inline code & code blocks ----- */
.md code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .9em;
  color: var(--accent);
  border: 1px solid var(--line);
}
.md pre {
  position: relative;
  background: #0c0a07;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 18px 16px;
  margin: 1.4em 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.md pre code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}
/* Language label injected by blog-viewer.js (data-lang attr) */
.md pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 2px 7px;
  background: rgba(232,114,44,.10);
  border: 1px solid rgba(232,114,44,.25);
  border-radius: 999px;
}

/* ----- Blockquotes (non-callout) ----- */
.md blockquote {
  border-left: 3px solid var(--primary);
  margin: 1.4em 0;
  padding: .25em 0 .25em 18px;
  color: var(--text-dim);
  font-style: italic;
}
.md blockquote p { margin: .4em 0; }

/* ----- Tables ----- */
.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.md thead { background: var(--surface-2); }
.md th, .md td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.md th { color: var(--text); font-weight: 600; }
.md tr:last-child td { border-bottom: 0; }

/* ----- Task lists ----- */
.md input[type="checkbox"] {
  accent-color: var(--primary);
  margin-right: 6px;
  transform: translateY(1px);
}
.md ul:has(> li > input[type="checkbox"]) {
  list-style: none;
  padding-left: .25em;
}

/* ----- Images & figures ----- */
.md img { max-width: 100%; display: block; border-radius: var(--radius-sm); }

.md figure {
  margin: 1.8em 0;
  text-align: center;
}
.md figure img {
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.md figcaption {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-mute);
  margin-top: 10px;
  font-style: italic;
  line-height: 1.5;
}

/* Side-by-side figures: ::: figures … ::: */
.md .figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 1.8em 0;
}
.md .figure-row figure { margin: 0; }
.md .figure-row img    { width: 100%; height: auto; }

/* ----- Callouts (admonitions) ----- */
.md .callout {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--text-mute);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 1.6em 0;
}
.md .callout-icon {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 16px;
  color: var(--bg);
  background: var(--text-mute);
  margin-top: 2px;
}
.md .callout-body > *:first-child { margin-top: 0; }
.md .callout-body > *:last-child  { margin-bottom: 0; }

.md .callout-note,    .md .callout-info {
  border-left-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(111,183,201,.06), transparent 80%), var(--surface);
}
.md .callout-note  .callout-icon,
.md .callout-info  .callout-icon { background: var(--accent-2); }

.md .callout-tip {
  border-left-color: #7BC47F;
  background: linear-gradient(180deg, rgba(123,196,127,.07), transparent 80%), var(--surface);
}
.md .callout-tip   .callout-icon { background: #7BC47F; }

.md .callout-important {
  border-left-color: var(--accent);
  background: linear-gradient(180deg, rgba(233,167,102,.08), transparent 80%), var(--surface);
}
.md .callout-important .callout-icon { background: var(--accent); }

.md .callout-warning, .md .callout-caution {
  border-left-color: var(--primary);
  background: linear-gradient(180deg, rgba(232,114,44,.10), transparent 80%), var(--surface);
}
.md .callout-warning .callout-icon,
.md .callout-caution .callout-icon { background: var(--primary); }

.md .callout-danger {
  border-left-color: #D8553A;
  background: linear-gradient(180deg, rgba(216,85,58,.12), transparent 80%), var(--surface);
}
.md .callout-danger .callout-icon { background: #D8553A; }

/* ----- Math (KaTeX) ----- */
.md .katex { font-size: 1.05em; color: var(--text); }
.md .katex-display {
  margin: 1.6em 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* ----- Embedded video / iframe ----- */
.md iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #000;
  margin: 1.4em 0;
}

/* ----- Details / summary (collapsible) ----- */
.md details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 1.4em 0;
}
.md details[open] { background: var(--surface-2); }
.md summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-sans);
  list-style: none;
}
.md summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--primary);
  transition: transform .2s var(--ease);
}
.md details[open] > summary::before { transform: rotate(90deg); }

/* ----- Citation block (auto-appended to every markdown post) ----- */
.md .cite {
  margin: 3em 0 1em;
  padding: 22px 24px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(232,114,44,.05), transparent 70%),
    var(--surface);
}
.md .cite-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 16px;
  border-bottom: 0;
}
.md .cite-block {
  margin: 0 0 14px;
}
.md .cite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.md .cite-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.md .cite-copy {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.md .cite-copy:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.md .cite-copy.copied {
  color: var(--bg);
  background: var(--primary);
  border-color: var(--primary);
}
.md .cite-text {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.6;
}
.md .cite-bib {
  margin: 0;
  background: #0c0a07;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  overflow-x: auto;
}
.md .cite-bib code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.md .cite-bib::before { content: none; }   /* don't show the data-lang badge */


/* ===== Reveal on scroll ===== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ===== Demo page — collage layout ===== */

/* The collage is a CSS grid with 4 columns. Tiles span different
   numbers of columns depending on their aspect ratio class so they
   tile into a pleasing mosaic without any media exceeding viewport
   width or looking oversized. */
.demo-collage {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Landscape clips (16:9 / 2:1) → span 2 columns */
.demo-tile-landscape { grid-column: span 2; }
/* Wide clips (4:3) → span 2 columns */
.demo-tile-wide      { grid-column: span 2; }
/* Portrait clips (9:16) → span 1 column */
.demo-tile-portrait  { grid-column: span 1; }

.demo-tile {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0c0a07;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), transform .25s var(--ease);
}
.demo-tile:hover {
  border-color: rgba(232,114,44,.45);
  box-shadow: 0 16px 48px -16px rgba(232,114,44,.3);
  transform: translateY(-3px);
}

/* Media fills its tile, object-fit preserves native aspect ratio */
.demo-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
}

/* Dark frosted overlay — sits above media, carries the title + badge.
   Partially transparent at rest; fades to clear on hover. */
.demo-frost {
  position: absolute;
  inset: 0;
  background: rgba(14, 13, 11, .75);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  gap: 6px;
  transition: background .4s var(--ease), backdrop-filter .4s var(--ease);
  z-index: 2;
}
.demo-tile:hover .demo-frost {
  background: rgba(14, 13, 11, .08);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

/* Badge (top-left) */
.demo-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(14, 13, 11, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* Title text sitting on the overlay */
.demo-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
  transition: opacity .3s var(--ease);
}
.demo-tile:hover .demo-title {
  opacity: .3;
}

/* Play indicator in center — fades out on hover */
.demo-frost::before {
  content: "▶";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: rgba(232,114,44,.7);
  color: #15130F;
  font-size: 16px;
  border-radius: 50%;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.demo-tile:hover .demo-frost::before {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.6);
}

@media (max-width: 720px) {
  .demo-collage { grid-template-columns: 1fr 1fr; }
  .demo-tile-landscape { grid-column: span 2; }
  .demo-tile-wide      { grid-column: span 2; }
  .demo-tile-portrait  { grid-column: span 1; }
}
@media (max-width: 480px) {
  .demo-collage { grid-template-columns: 1fr; }
  .demo-tile-landscape,
  .demo-tile-wide,
  .demo-tile-portrait { grid-column: span 1; }
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .hero {
    min-height: 90vh;
    padding-top: 100px;
  }
  .cap-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    padding: 12px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; border-radius: 8px; }
  .section { padding: 64px 0; }
  .values { grid-template-columns: 1fr; }
}

/* ===== Page transitions ===== */
.page-transition-wrap {
  position: relative;
  z-index: 1;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
