/* ashmit.codes — one dark theme, same palette as the reel cards */
:root {
  --bg: #0B1220;
  --panel: #111A2E;
  --line: rgba(242, 244, 248, 0.09);
  --line-strong: rgba(242, 244, 248, 0.2);
  --grid: rgba(242, 244, 248, 0.055);
  --ink: #F2F4F8;
  --ink-2: #B7BFCF;
  --ink-3: #7F8AA3;
  --amber: #F2A31B;
  --amber-2: #FFC466;
  --amber-dim: rgba(242, 163, 27, 0.14);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --max: 1120px;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Graph-paper ground, fading out like the sandbox diagrams */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 10%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 80% 70% at 30% 10%, #000 10%, transparent 70%);
}

/* Warm glow + grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(700px 480px at 12% -5%, rgba(242, 163, 27, 0.16), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.96 0 0 0 0 0.98 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--amber); color: var(--bg); }

.wrap {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(11, 18, 32, 0.7);
  border-bottom: 1px solid var(--line);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.wordmark {
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: -0.01em;
}
.wordmark em { color: var(--amber); font-style: italic; }
.nav ul {
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.nav li a { color: var(--ink-2); transition: color 0.2s; }
.nav li a:hover, .nav li a[aria-current="page"] { color: var(--amber-2); }

/* ---------- Shared bits ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-dim);
}

.label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.link {
  position: relative;
  color: var(--ink);
  padding-bottom: 2px;
}
.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.link:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  padding: clamp(64px, 12vh, 140px) 0 clamp(56px, 10vh, 120px);
  min-height: min(calc(100vh - 64px), 860px);
}
.hero h1 {
  margin: 20px 0 22px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 6.2vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  color: var(--amber-2);
}
.hero p {
  max-width: 54ch;
  margin: 0;
  font-size: clamp(17px, 1.25vw, 19px);
  color: var(--ink-2);
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 13.5px;
}
.link sup { color: var(--amber); font-size: 0.95em; margin-left: 3px; }

/* Diagram, the reel-1 escape as a decorative motif */
.diagram {
  position: relative;
  margin: 0; /* figure's UA margin (1em 40px) overflowed the grid cell on phones */
  aspect-ratio: 420 / 320;
  width: 100%;
}
.diagram svg { width: 100%; height: 100%; overflow: visible; }
.diagram .box {
  fill: var(--panel);
  stroke: var(--line-strong);
  stroke-width: 1.2;
}
.diagram .box.dashed { fill: none; stroke-dasharray: 5 5; }
.diagram .box.hot { stroke: var(--amber); fill: var(--amber-dim); }
.diagram text {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--ink-2);
  letter-spacing: 0.04em;
}
.diagram text.small { font-size: 9.5px; fill: var(--ink-3); }
.diagram .wire {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw 1.6s var(--ease) forwards;
  animation-delay: 0.9s;
}
.diagram .wire.two { animation-delay: 1.6s; }
.diagram .pulse {
  fill: var(--amber);
  transform-origin: center;
  transform-box: fill-box;
  animation: pulse 2.4s ease-in-out infinite;
  animation-delay: 2.6s;
  opacity: 0;
}
.diagram .caption {
  position: absolute;
  right: 0;
  bottom: -30px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pulse {
  0%   { opacity: 0; transform: scale(0.6); }
  30%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.4); }
}

/* ---------- Sections ---------- */
.section {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 32px clamp(32px, 6vw, 96px);
  padding: clamp(56px, 9vh, 104px) 0;
  border-top: 1px solid var(--line);
}
.section h2 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.prose p { margin: 0 0 20px; color: var(--ink-2); font-size: 18px; max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }

.now {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 24px;
  margin: 36px 0 0;
  padding: 24px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 15.5px;
}
.now dt {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
  padding-top: 3px;
}
.now dd { margin: 0; color: var(--ink-2); }

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.stack li {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: border-color 0.2s, color 0.2s;
}
.stack li:hover { border-color: var(--amber); color: var(--amber-2); }

/* Writing empty state */
.empty {
  position: relative;
  padding: 36px 32px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  max-width: 640px;
  overflow: hidden;
}
.empty::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 200px at 0% 0%, var(--amber-dim), transparent 70%);
  pointer-events: none;
}
.empty h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.02em;
}
.empty p { margin: 0 0 22px; color: var(--ink-2); }
.empty .link { font-family: var(--mono); font-size: 13.5px; }

/* Posts list, used once posts exist */
.posts { margin: 0; padding: 0; list-style: none; max-width: 720px; }
.posts li { padding: 26px 0; border-top: 1px solid var(--line); }
.posts li:last-child { border-bottom: 1px solid var(--line); }
.posts time {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.posts h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.posts p { margin: 0; color: var(--ink-2); }

/* Article page */
.article { max-width: 680px; padding: clamp(56px, 9vh, 104px) 0; }
.article header h1 {
  margin: 14px 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.article header p { margin: 0 0 40px; color: var(--ink-3); font-family: var(--mono); font-size: 13px; }
.article .prose h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 44px 0 14px; letter-spacing: -0.02em; }
.article .prose a { color: var(--amber-2); border-bottom: 1px solid var(--amber-dim); }
.article .prose blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 22px;
  border-left: 2px solid var(--amber);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.3;
}
.article .prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 6px;
}
.article .prose pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
}
.article .prose pre code { background: none; padding: 0; }
.back { display: inline-block; margin-top: 44px; font-family: var(--mono); font-size: 13.5px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 48px;
}
.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}
.footer a:hover { color: var(--amber-2); }

/* ---------- Load-in ---------- */
.rise {
  opacity: 0;
  animation: rise 0.8s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 110ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; opacity: 1; }
  .diagram .wire { animation: none; stroke-dashoffset: 0; }
  .diagram .pulse { animation: none; opacity: 0.9; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 56px; padding-bottom: 40px; }
  .diagram { max-width: 460px; margin-top: 8px; }
  .section { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .nav ul { gap: 18px; }
  .nav li:nth-child(3) { display: none; }
  .hero h1 { font-size: clamp(38px, 11vw, 52px); }
  .now { grid-template-columns: 1fr; gap: 4px 0; padding: 20px; }
  .now dt { margin-top: 12px; }
  .now dt:first-child { margin-top: 0; }
  .empty { padding: 28px 22px; }
  .diagram .caption { position: static; display: block; margin-top: 14px; }
}
