/* ─────────────────────────────────────────────────────────────
   ohmydata — minimal editorial theme
   palette, type, layout, components
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #0e0e0e;
  --bg-soft: #161616;
  --line: #262626;
  --ink: #ebe7df;
  --ink-dim: #8a8780;
  --accent: #d4a574;       /* warm amber */
  --accent-soft: #d4a57422;

  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --max: 1100px;
  --pad-x: clamp(20px, 5vw, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* gaussian particle field (canvas, injected by script.js) */
.noise-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* subtle grain overlay layered on top of particles for warmth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main { flex: 1 0 auto; position: relative; z-index: 2; }

/* ─── topbar ─── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--pad-x);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.04em;
  position: relative;
  z-index: 3;
}
.mark {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.mark:hover { color: var(--accent); }
.mark-icon {
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.4s ease;
}
.mark:hover .mark-icon {
  opacity: 1;
  transform: translateX(1px);
}
.meta { color: var(--ink-dim); }

/* ─── hero ─── */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(60px, 12vh, 130px) var(--pad-x) clamp(60px, 10vh, 100px);
}

.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(64px, 13vw, 160px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 40px;
  color: var(--ink);
}
.title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.title-ohmy { display: inline; }
.title-data {
  display: inline;
  font-style: italic;
  color: var(--ink-dim);
}

.about {
  max-width: 560px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 48px;
}

/* ─── about row + dancing wizard ─── */
.about-row {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 48px;
}
.about-row .about { margin-bottom: 0; }

.wizard-wrap {
  flex-shrink: 0;
  /* Y-axis bounce — the "step" half of the candyfloss */
  animation: candyfloss-bounce 0.66s ease-in-out infinite;
}

.wizard-sprite {
  width: 96px;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  /* lateral sway — the "candyfloss" half (twice the period of the bounce) */
  transform-origin: 50% 95%;
  animation: candyfloss-sway 1.32s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.18));
}

.wiz-dice {
  transform-box: fill-box;
  transform-origin: center;
  animation: dice-wobble 0.66s ease-in-out infinite;
}

@keyframes candyfloss-sway {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}
@keyframes candyfloss-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
@keyframes dice-wobble {
  0%, 100% { transform: rotate(-14deg) translateY(0.3px); }
  50%      { transform: rotate(14deg) translateY(-0.3px); }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-wrap, .wizard-sprite, .wiz-dice { animation: none; }
}
.about strong {
  color: var(--accent);
  font-weight: 500;
}
.about em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1em;
  color: var(--ink);
}

/* ─── buttons ─── */
.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition: all 0.25s ease;
}
.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  transform: translateY(-1px);
}
.btn:hover svg { transform: translateX(3px); }
.btn svg { transition: transform 0.25s ease; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── topics / carousel ─── */
.topics {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad-x) 100px;
}
.topics-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.topics-head h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.01em;
}
.controls { display: flex; gap: 8px; }
.ctrl {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.2s ease;
}
.ctrl:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.track {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.track::-webkit-scrollbar { height: 4px; }
.track::-webkit-scrollbar-track { background: transparent; }
.track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.track::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.card {
  flex: 0 0 320px;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-soft);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}
.media {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #000;
}
.media img,
.media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-body { padding: 18px 20px 22px; }
.num {
  display: block;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--ink);
}
.card p {
  font-size: 13px;
  color: var(--ink-dim);
  line-height: 1.55;
}

/* ─── subpage layout (socials, projects) ─── */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 80px) var(--pad-x) 80px;
}
.back {
  display: inline-block;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-bottom: 32px;
  transition: color 0.2s ease;
}
.back:hover { color: var(--accent); }
.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 88px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.page-title em {
  font-style: italic;
  color: var(--accent);
}
.page-sub {
  color: var(--ink-dim);
  margin-bottom: 56px;
  font-size: 14px;
}

/* ─── socials list ─── */
.links { list-style: none; }
.links li {
  border-top: 1px solid var(--line);
}
.links li:last-child { border-bottom: 1px solid var(--line); }
.links a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 0;
  text-decoration: none;
  color: var(--ink);
  transition: padding 0.25s ease, color 0.25s ease;
}
.links a:hover {
  padding-left: 14px;
  color: var(--accent);
}
.link-label {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.01em;
}
.link-handle {
  color: var(--ink-dim);
  font-size: 13px;
}
.links a:hover .link-handle { color: var(--accent); }

/* ─── projects ─── */
.projects {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.project {
  background: var(--bg);
  padding: 28px 26px;
  transition: background 0.2s ease;
}
.project:hover { background: var(--bg-soft); }
.project-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}
.project-head .num {
  display: inline;
  margin-bottom: 0;
}
.project-head h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.project p {
  color: var(--ink-dim);
  font-size: 14px;
  margin-bottom: 16px;
  max-width: 56ch;
}
.project-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.project-foot a {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.project-foot a:hover { text-decoration: underline; }

/* ─── footer ─── */
.footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  padding: 22px var(--pad-x);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  position: relative;
  z-index: 3;
}

/* ─── responsive ─── */
@media (max-width: 700px) {
  .about-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
  }
  .wizard-sprite { width: 80px; }
}

@media (max-width: 600px) {
  .topbar { font-size: 11px; }
  .card { flex: 0 0 78vw; }
  .links a { padding: 18px 0; }
  .link-label { font-size: 20px; }
  .project-head h3 { font-size: 22px; }
  .footer { flex-direction: column; gap: 6px; }
  .topic-title { font-size: clamp(38px, 11vw, 60px) !important; }
  .topic-section { grid-template-columns: 1fr !important; }
  .topic-section h2 { margin-bottom: 12px !important; }
}

/* ─── topic page ─── */
.topic {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 80px) var(--pad-x) 60px;
}
.topic-head {
  margin-bottom: 72px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.topic-num {
  display: block;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  margin-bottom: 14px;
}
.topic-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 88px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.topic-title em {
  font-style: italic;
  color: var(--accent);
}
.topic-tagline {
  color: var(--ink-dim);
  font-size: 14px;
  margin-bottom: 24px;
  max-width: 56ch;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
}
.status-pill::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
  box-shadow: 0 0 6px var(--accent);
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.7); }
}

/* sections use a hanging label on the left */
.topic-section {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}
.topic-section:last-of-type { border-bottom: none; }
.topic-section h2 {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-top: 4px;
  position: relative;
}
.topic-section h2::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 11px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}
.topic-section .placeholder,
.topic-section p,
.topic-section ul,
.topic-section ol {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
}
.topic-section .placeholder {
  color: var(--ink-dim);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.65;
}
.topic-section ul.placeholder,
.topic-section ol.placeholder {
  list-style: none;
  padding-left: 0;
}
.topic-section ul.placeholder li {
  padding: 6px 0 6px 18px;
  position: relative;
}
.topic-section ul.placeholder li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* math block (LaTeX shown as-is until you wire up KaTeX/MathJax) */
.math-block {
  margin-top: 16px;
  padding: 18px 22px;
  border-left: 2px solid var(--accent);
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  overflow-x: auto;
}

/* visual placeholder where a gif/video will go */
.visual-placeholder {
  margin-top: 16px;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 8px,
      rgba(255,255,255,0.012) 8px 16px
    );
}
.visual-placeholder span { user-select: none; }

/* code block */
.code-block {
  margin-top: 16px;
  padding: 18px 22px;
  background: #08080a;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
}
.code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre;
}

/* prev / next */
.topic-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.topic-nav a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.topic-nav a:hover {
  border-color: var(--accent);
  background: var(--bg-soft);
}
.topic-nav .nav-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.topic-nav .nav-title {
  font-family: var(--font-display);
  font-size: 18px;
}
.topic-nav .nav-next { text-align: right; align-items: flex-end; }
.topic-nav a.disabled {
  opacity: 0.35;
  pointer-events: none;
}
