/* attention.sh — terminal-inspired, dark by design */

:root {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #4ade80;      /* terminal green */
  --accent-soft: #86efac;
  --link: #79c0ff;
  --border: #30363d;
  --grid-minor: rgba(74, 222, 128, 0.035); /* blueprint grid — fine lines */
  --grid-major: rgba(74, 222, 128, 0.07);  /* blueprint grid — every 5th line */
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.mono { font-family: var(--mono); }
.dim { color: var(--text-dim); }
.accent { color: var(--accent); }

/* header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  background: rgba(13, 17, 23, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.site-header nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.brand .prompt { color: var(--accent); margin-right: 0.4em; }
.nav-links {
  display: flex;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
}
.nav-links a:hover { color: var(--accent); }

/* main */
main { padding: 3rem 0 4rem; min-height: 60vh; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.4rem; margin-top: 2.5rem; }
h3 { font-size: 1.1rem; margin-top: 2rem; }

a { color: var(--link); }
a:hover { color: var(--accent-soft); }

/* hero */
.hero { padding: 1.5rem 0 1rem; }
.hero .kicker {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-transform: lowercase;
  margin-bottom: 0.75rem;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 1rem; }
.hero p.lede { font-size: 1.15rem; color: var(--text-dim); max-width: 40rem; }
.story-cta {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  margin-right: 0.5rem;
}
.story-cta:hover { background: rgba(74, 222, 128, 0.12); color: var(--accent-soft); }

.terminal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.88rem;
  padding: 1rem 1.25rem;
  margin: 2rem 0;
  overflow-x: auto;
  line-height: 1.8;
}
.terminal .cmd::before { content: "$ "; color: var(--accent); }
.terminal .out { color: var(--text-dim); }

/* cards / focus areas */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}
.cards li {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
}
.cards h3 { margin: 0 0 0.4rem; font-size: 1rem; font-family: var(--mono); color: var(--accent-soft); }
.cards p { margin: 0; font-size: 0.92rem; color: var(--text-dim); }

/* post lists */
.post-list { list-style: none; padding: 0; }
.post-list li {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list time {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 7.5rem;
}
.post-list a { text-decoration: none; font-weight: 550; }

/* posts */
.post-header { margin-bottom: 2rem; }
.post-header h1 { margin-top: 0.25rem; }
.post img { max-width: 100%; }
.back-link { margin-top: 3rem; font-family: var(--mono); font-size: 0.9rem; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }

table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; font-size: 0.92rem; }
th { background: var(--bg-raised); }

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.site-footer p { margin: 0.25rem 0; }

@media (max-width: 600px) {
  .wrap { padding: 0 1rem; }
  main { padding: 2rem 0 3rem; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.25rem; margin-top: 2rem; }
  .hero h1, .page-hero h1 { font-size: 1.75rem; }
  .hero p.lede, .page-hero .lede { font-size: 1.02rem; }
  .post-list li { flex-direction: column; gap: 0.15rem; }
  .site-header nav { flex-wrap: wrap; }
  .nav-links { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .terminal { font-size: 0.8rem; padding: 0.9rem 1rem; }
  .stats { gap: 0.9rem 2rem; }
  .stat-n { font-size: 1.45rem; }
  th, td { padding: 0.4rem 0.55rem; font-size: 0.85rem; }
  blockquote { padding-left: 1rem; }
  .story-cta { margin-bottom: 0.5rem; }
}

/* ------------------------------------------------------------------ */
/* home page enhancements — additive only, progressive enhancement    */
/* ------------------------------------------------------------------ */

/* hero sits over the sitewide blueprint grid (#grid-bg) */
.hero { position: relative; }

/* terminal: reserved height + typing cursor (loop is JS-driven) */
.terminal { min-height: 10rem; }
.terminal .cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.15em;
  background: var(--accent);
  vertical-align: -0.15em;
  animation: cursor-blink 1.1s step-end infinite;
}
@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* cards: hover lift + glow, arrow slide on h3 */
.cards li {
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.cards li:hover {
  transform: translateY(-3px);
  border-color: rgba(74, 222, 128, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 18px rgba(74, 222, 128, 0.09);
}
.cards h3 { transition: color 0.22s ease; }
.cards h3::after {
  content: "→";
  display: inline-block;
  margin-left: 0.45em;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.cards li:hover h3 { color: var(--accent); }
.cards li:hover h3::after { opacity: 1; transform: translateX(0); }

/* cards: staggered on-scroll entrance (classes applied by home.js) */
.cards li.pre-reveal { opacity: 0; }
.cards li.reveal { animation: card-in 0.6s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* post list: hover tint + title slide */
.post-list li {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  margin-left: -0.6rem;
  margin-right: -0.6rem;
  border-radius: 6px;
  transition: background-color 0.18s ease;
}
.post-list li:hover { background-color: rgba(74, 222, 128, 0.05); }
.post-list li a { transition: transform 0.18s ease; }
.post-list li:hover a { transform: translateX(3px); }

/* story CTA: gentle looping pulse; solid glow on hover */
.story-cta {
  animation: cta-pulse 2.8s ease-in-out infinite;
  transition: box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}
.story-cta:hover {
  animation: none;
  box-shadow: 0 0 16px 2px rgba(74, 222, 128, 0.3);
}
@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
  50% { box-shadow: 0 0 14px 1px rgba(74, 222, 128, 0.24); }
}

/* reduced motion: no pulses, no slides — content stays put */
@media (prefers-reduced-motion: reduce) {
  .story-cta,
  .terminal .cursor,
  .cards li.reveal { animation: none; }
  .cards li,
  .cards h3,
  .cards h3::after,
  .post-list li,
  .post-list li a,
  .story-cta { transition: none; }
  .cards li.pre-reveal { opacity: 1; }
  .cards li:hover { transform: none; }
  .post-list li:hover a { transform: none; }
}

/* ------------------------------------------------------------------ */
/* landing page: liveliness pass 2                                     */
/* ------------------------------------------------------------------ */

/* hero entrance: staggered rise-in on load */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.hero .kicker { animation: rise-in 0.65s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
.hero h1 { animation: rise-in 0.65s cubic-bezier(0.22, 0.9, 0.3, 1) 0.08s both; }
.hero .lede { animation: rise-in 0.65s cubic-bezier(0.22, 0.9, 0.3, 1) 0.18s both; }
.hero .story-line { animation: rise-in 0.65s cubic-bezier(0.22, 0.9, 0.3, 1) 0.3s both; }

/* a soft green sheen sweeps the headline every few seconds */
.hero h1 {
  background: linear-gradient(100deg, var(--text) 42%, var(--accent-soft) 50%, var(--text) 58%);
  background-size: 260% 100%;
  background-position: 130% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation:
    rise-in 0.65s cubic-bezier(0.22, 0.9, 0.3, 1) 0.08s both,
    h1-sheen 7s linear 2s infinite;
}
@keyframes h1-sheen {
  0% { background-position: 130% 0; }
  45% { background-position: -140% 0; }
  100% { background-position: -140% 0; }
}

/* terminal window chrome */
.term-window {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 2rem 0;
  background: var(--bg-raised);
}
.term-window .terminal { border: none; border-radius: 0; margin: 0; }
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.6);
}
.term-bar .dot { width: 11px; height: 11px; border-radius: 50%; }
.term-bar .dot.r { background: #ff5f57; }
.term-bar .dot.y { background: #febc2e; }
.term-bar .dot.g { background: #28c840; }
.term-bar .term-title {
  margin-left: 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* stats strip */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.8rem;
  list-style: none;
  padding: 0.4rem 0;
  margin: 0 0 1rem;
}
.stats li { display: flex; flex-direction: column; }
.stat-n {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-l { font-size: 0.85rem; color: var(--text-dim); }

/* generic scroll reveals (h2s, post rows) — classes added only by JS */
.pre-reveal { opacity: 0; }
.reveal { animation: card-in 0.6s cubic-bezier(0.22, 0.9, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .hero .kicker, .hero h1, .hero .lede, .hero .story-line { animation: none; }
  .hero h1 { background: none; -webkit-text-fill-color: currentColor; }
  .pre-reveal { opacity: 1; }
  .reveal { animation: none; }
}

/* ------------------------------------------------------------------ */
/* sitewide: inside-the-transformer ambience                           */
/* ------------------------------------------------------------------ */

/* behind every page: the blueprint grid (CSS, below) plus the circuit bezel —
 * a faint signal trace around the viewport edge with traveling packets, drawn
 * by circuit.js in a ~12px band where content never sits. The canvas clears
 * to transparent each frame, so this grid shows through and also stands alone
 * with no JS / under reduced motion. The grid is masked to bloom near the top
 * and fade into the dark toward the edges — keeps long text readable. */
#circuit-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 200px 200px, 200px 200px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(130% 95% at 50% -12%, #000 34%, rgba(0, 0, 0, 0.35) 72%, transparent 100%);
  mask-image: radial-gradient(130% 95% at 50% -12%, #000 34%, rgba(0, 0, 0, 0.35) 72%, transparent 100%);
}
@media (max-width: 600px) {
  #circuit-bg { background-size: 32px 32px, 32px 32px, 160px 160px, 160px 160px; }
}

/* the residual stream: reading progress along the top edge */
.stream {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 100;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.55);
  pointer-events: none;
}

/* stage kickers on inner pages (mirrors the story page) */
.stage {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin: 0 0 0.5rem;
}
.page-hero { padding: 1rem 0 0.5rem; }
.page-hero h1 { margin: 0 0 0.8rem; }
.page-hero .lede { font-size: 1.1rem; color: var(--text-dim); max-width: 40rem; }

/* research: the layer stack */
.layer-list {
  list-style: none;
  margin: 2rem 0;
  padding: 0;
  counter-reset: layer;
}
.layer-list li {
  display: flex;
  gap: 1.3rem;
  align-items: baseline;
  border: 1px solid var(--border);
  border-left: 3px solid rgba(74, 222, 128, 0.5);
  border-radius: 8px;
  background: var(--bg-raised);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.8rem;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.layer-list li:hover {
  transform: translateX(4px);
  border-color: rgba(74, 222, 128, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 18px rgba(74, 222, 128, 0.08);
}
.layer-list .ln {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.layer-list h3 { margin: 0 0 0.35rem; font-size: 1rem; font-family: var(--mono); color: var(--accent-soft); }
.layer-list p { margin: 0; font-size: 0.94rem; color: var(--text-dim); }

/* essay figures — inline SVG panels */
.fig {
  margin: 2rem 0;
  padding: 1.1rem 1.2rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raised);
  overflow-x: auto; /* narrow screens scroll the figure rather than shrink its text to nothing */
  -webkit-overflow-scrolling: touch;
}
.fig svg { display: block; width: 100%; height: auto; }
/* below this width the 3:1 figures would shrink text under ~8px — hold a
 * legible floor and let the figure scroll horizontally inside its card. */
@media (max-width: 640px) {
  .fig svg { min-width: 600px; }
  /* the figure is wider than the screen and scrolls — signal that */
  .fig figcaption::before { content: "\21C4 swipe \00B7 "; color: var(--accent); }
}
.fig text { font-family: var(--mono); font-size: 12px; fill: var(--text-dim); }
.fig .tt { fill: var(--text); }
.fig .ts { font-size: 10.5px; }
.fig .axis { stroke: var(--border); stroke-width: 1; }
.fig .grid { stroke: #21262d; stroke-width: 1; }
.fig figcaption {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* footer easter egg */
.footer-formula {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: rgba(74, 222, 128, 0.35);
  margin-top: 0.8rem;
}
.footer-formula sub, .footer-formula sup { font-size: 0.7em; }

@media (max-width: 600px) {
  .layer-list li { flex-direction: column; gap: 0.4rem; }
}
