/* Claude Thoughts — playful, chunky, colourful theme for Typst HTML export. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1b1d29;
  --ink-soft: #5d6173;
  --rule: #e7e4dc;
  --edge: #1b1d29;            /* chunky outlines & press shadows */
  --code-bg: #f5f3ee;

  /* playful palette: base + tint */
  --coral: #ff6b57;  --coral-tint: #ffe7e2;
  --sun:   #ffbf1f;  --sun-tint:   #fff4d4;
  --mint:  #13c2a3;  --mint-tint:  #dcf7f1;
  --sky:   #3b82f6;  --sky-tint:   #e3edff;
  --grape: #8b5cf6;  --grape-tint: #eee6ff;

  --accent: var(--sky);
  --accent-tint: var(--sky-tint);

  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --font-math: "STIX Two Math", "Latin Modern Math", "Cambria Math", math;

  --pad: clamp(16px, 5vw, 72px);
  --measure: 52rem;           /* article column */
  --radius: 18px;
  --press: 0 5px 0 var(--edge);
  --spark-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2010'%3E%3Cpath%20d='M8.00%205.60L11.59%205.00L8.00%204.40ZM7.67%205.50L11.83%207.53L8.33%204.50ZM7.51%205.34L10.18%208.17L8.49%204.66ZM7.40%204.97L7.79%209.52L8.60%205.03ZM7.49%204.69L5.89%208.50L8.51%205.31ZM7.67%204.50L4.36%207.46L8.33%205.50ZM8.05%204.40L3.72%204.68L7.95%205.60ZM8.28%204.47L4.29%203.01L7.72%205.53ZM8.51%204.68L5.64%201.22L7.49%205.32ZM8.60%205.05L8.31%201.02L7.40%204.95ZM8.54%205.26L10.01%200.90L7.46%204.74ZM8.29%205.52L11.26%203.17L7.71%204.48Z'%20fill='black'%20stroke='black'%20stroke-width='0.6'%20stroke-linejoin='round'/%3E%3C/svg%3E");
  --clay: #d97757;           /* Claude spark colour */
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #12131c;
  --surface: #1b1d2a;
  --ink: #eef0f7;
  --ink-soft: #a3a8bd;
  --rule: #2b2e40;
  --edge: #454a66;
  --code-bg: #f5f3ee; /* Typst bakes light syntax colours; keep code on a light card */
  --coral-tint: #3a211f; --sun-tint: #3a311a; --mint-tint: #133630;
  --sky-tint: #1a2744;   --grape-tint: #2a2047;
  color-scheme: dark;
}

/* per-guide accent (body class on posts, card class on the home grid) */
.accent-coral, .card-coral { --accent: var(--coral); --accent-tint: var(--coral-tint); }
.accent-sun,   .card-sun   { --accent: var(--sun);   --accent-tint: var(--sun-tint); }
.accent-mint,  .card-mint  { --accent: var(--mint);  --accent-tint: var(--mint-tint); }
.accent-sky,   .card-sky   { --accent: var(--sky);   --accent-tint: var(--sky-tint); }
.accent-grape, .card-grape { --accent: var(--grape); --accent-tint: var(--grape-tint); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.75;
  overflow-x: hidden;
}

.wrap { width: 100%; padding-inline: var(--pad); }

/* Article text sits in a centred column; home page (hero + grid) uses full width. */
article > * { max-width: var(--measure); margin-inline: auto; }
article > .hero, article > .guide-grid, article > .section-title { max-width: none; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
a:hover { background: var(--accent-tint); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; margin: 0 0 0.3em; }
h2 { font-size: 1.75rem; font-weight: 700; margin: 2.2em auto 0.6em; }
h2::after {
  content: ""; display: block; width: 64px; height: 10px; margin-top: 0.4em;
  background: var(--accent);
  -webkit-mask: var(--spark-mask) repeat-x 0 0 / 16px 10px;
          mask: var(--spark-mask) repeat-x 0 0 / 16px 10px;
  animation: twinkle 2.4s ease-in-out infinite;
}
h3 { font-size: 1.3rem; font-weight: 700; margin: 1.8em auto 0.5em; }
p { margin: 0 auto 1.1em; }
hr { border: 0; border-top: 2px dashed var(--rule); margin: 2.5em auto; }
::selection { background: var(--sun); color: #1b1d29; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--rule);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 68px; }
.brand {
  font-family: var(--font-head); font-weight: 800; font-size: 1.2rem;
  text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.brand::before {
  content: ""; display: inline-block;
  width: 34px; height: 34px; margin-right: 0.5rem;
  background: var(--clay) url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12.00%2013.80L19.80%2012.00L12.00%2010.20ZM11.01%2013.50L20.33%2017.50L12.99%2010.50ZM10.52%2013.02L16.74%2018.89L13.48%2010.98ZM10.20%2011.92L11.54%2021.83L13.80%2012.08ZM10.46%2011.07L7.42%2019.62L13.54%2012.93ZM10.99%2010.51L4.08%2017.35L13.01%2013.49ZM12.14%2010.21L2.69%2011.30L11.86%2013.79ZM12.85%2010.41L3.93%207.66L11.15%2013.59ZM13.53%2011.05L6.87%203.78L10.47%2012.95ZM13.79%2012.14L12.67%203.35L10.21%2011.86ZM13.62%2012.79L16.37%203.10L10.38%2011.21ZM12.88%2013.57L19.09%208.03L11.12%2010.43Z'%20fill='white'%20stroke='white'%20stroke-width='1'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
  border: 2px solid var(--edge); border-radius: 10px;
  box-shadow: 0 3px 0 var(--edge); vertical-align: middle;
}
.brand:hover { background: none; }

.site-nav { display: flex; align-items: center; gap: 0.4rem; font-family: var(--font-head); font-weight: 600; }
.site-nav a { text-decoration: none; padding: 0.35em 0.9em; border-radius: 999px; color: var(--ink-soft); }
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 2px var(--rule); }

.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: 0.3rem;
  border: 2px solid var(--edge); border-radius: 12px; background: var(--surface); color: var(--ink);
  font-size: 1.1rem; cursor: pointer; box-shadow: 0 3px 0 var(--edge);
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.theme-toggle:hover { transform: translateY(1px); box-shadow: 0 2px 0 var(--edge); }
.theme-toggle:active { transform: translateY(3px); box-shadow: 0 0 0 var(--edge); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Home ---------- */
main { padding-block: 2.5rem 5rem; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 2rem;
  padding: 1.5rem 0 0.5rem;
}
.hero-art { color: var(--ink); }
.hero-art svg { width: 100%; height: auto; display: block; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; gap: 0.5rem; } }
.hero-title { font-size: clamp(2.6rem, 7vw, 4.6rem); }
.hero-lede { font-size: 1.3rem; color: var(--ink-soft); max-width: 46ch; margin: 0; }
.section-title { font-size: 1.6rem; margin: 3rem 0 1.25rem; }

.guide-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.75rem;
}
.guide-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius);
  box-shadow: var(--press);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.guide-card:not(.is-planned):hover { transform: translateY(-4px); box-shadow: 0 9px 0 var(--edge); }
.guide-card:not(.is-planned):active { transform: translateY(3px); box-shadow: 0 2px 0 var(--edge); }

.card-art {
  height: 150px; overflow: hidden; color: #fff;
  background: var(--accent);
  border-bottom: 2px solid var(--edge);
}
.card-art svg { width: 100%; height: 100%; display: block; }
.banner-name {
  font-family: var(--font-head); font-weight: 800; letter-spacing: -0.01em;
  fill: var(--accent); stroke: currentColor; stroke-width: 2px; paint-order: stroke;
  stroke-linejoin: round;
  transition: transform 300ms cubic-bezier(.3, 1.6, .5, 1);
  transform-box: fill-box; transform-origin: center;
}
.guide-card:not(.is-planned):hover .banner-name { transform: rotate(-3deg) scale(1.06); }
.card-sun .card-art { color: #1b1d29; }
.card-body { display: flex; flex-direction: column; gap: 0.45rem; padding: 1.2rem 1.35rem 1.35rem; flex: 1; }
.card-body p { margin: 0; }
.guide-card h3 { margin: 0; font-size: 1.3rem; }
.guide-card h3 a { text-decoration: none; }
.guide-card h3 a:hover { background: none; }
.guide-card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.guide-summary { color: var(--ink-soft); font-size: 1rem; line-height: 1.6; flex: 1; }
.guide-source {
  font-family: var(--font-head); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent);
}
.guide-status {
  align-self: flex-start; margin-top: 0.5rem !important;
  font-family: var(--font-head); font-weight: 700; font-size: 0.9rem;
  padding: 0.3em 0.9em; border-radius: 999px; border: 2px solid var(--edge);
  background: var(--accent); color: #fff;
}
.is-planned .guide-status { background: var(--accent-tint); color: var(--ink); border-style: dashed; }
.is-planned .card-art { filter: saturate(0.75); }

/* ---------- Article ---------- */
.post-header {
  max-width: var(--measure); margin: 0 auto 2.5rem; padding: 2rem 2rem 1.75rem;
  background: var(--accent-tint); border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: var(--press);
}
.post-header h1 { margin: 0; }
.kicker, .meta {
  font-family: var(--font-head); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0;
}
.kicker { display: inline-block; margin-bottom: 0.8rem; padding: 0.25em 0.8em; border-radius: 999px; background: var(--accent); color: #fff; border: 2px solid var(--edge); }
.meta { color: var(--ink-soft); margin-top: 0.8rem; }

article ul, article ol { padding-left: 1.5em; }
article li { margin-bottom: 0.4em; }
article li::marker { color: var(--accent); font-weight: 700; }

blockquote { margin: 1.5em auto; padding: 0.2em 1.2em; border-left: 6px solid var(--accent); border-radius: 4px; color: var(--ink-soft); }

img, svg { max-width: 100%; height: auto; }
figure { margin: 2em auto; }
figcaption { font-size: 0.95rem; color: var(--ink-soft); text-align: center; margin-top: 0.5em; }

table { border-collapse: separate; border-spacing: 0; width: 100%; display: table; overflow: hidden; font-size: 1rem; border: 2px solid var(--edge); border-radius: 14px; }
th, td { padding: 0.6em 1em; border-bottom: 1px solid var(--rule); text-align: left; }
th { font-family: var(--font-head); background: var(--accent-tint); }

/* ---------- Callout (one component; colours come from inline --c vars) ---------- */
.callout {
  --c: var(--sun);
  margin: 2em auto; padding: 1.2rem 1.4rem;
  background: var(--c-fill, color-mix(in srgb, var(--c) 16%, var(--bg)));
  border: 2px solid var(--c-stroke, var(--edge));
  border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--c-stroke, var(--edge));
}
.callout > :last-child { margin-bottom: 0; }
.callout code { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; }
.callout.border-dashed { border-style: dashed; }
.callout.border-dotted { border-style: dotted; border-width: 3px; }
.callout.border-none { border-color: transparent; }
.callout.border-left { border-width: 0 0 0 6px; border-color: var(--c-stroke, var(--c)); border-radius: 6px var(--radius) var(--radius) 6px; }
.callout.no-shadow, .callout.border-none, .callout.border-left { box-shadow: none; }
.callout-title {
  display: table; margin: 0 0 0.6em;
  font-family: var(--font-head); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.2em 0.75em; border-radius: 999px; border: 2px solid var(--edge);
  background: var(--c); color: var(--c-on, #fff);
}

/* ---------- Math (native MathML from Typst) ---------- */
math { font-family: var(--font-math); font-size: 1.1em; }
math[display="block"] {
  display: block math; font-size: 1.35em; margin: 1.5em auto; padding: 0.8em 0;
  overflow-x: auto; overflow-y: hidden;
}

/* ---------- Code ---------- */
code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--accent-tint); padding: 0.12em 0.4em; border-radius: 6px;
}
pre {
  background: var(--code-bg); color: #1b1d29;
  border: 2px solid var(--edge); border-radius: 14px; box-shadow: var(--press);
  padding: 1.1rem 1.3rem; overflow-x: auto; line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: 0.88rem; color: inherit; }

/* ---------- Footer ---------- */
.site-footer { border-top: 2px solid var(--rule); padding-block: 1.75rem; font-size: 0.95rem; color: var(--ink-soft); }
.site-footer p { margin: 0; }


/* ---------- Claude sparks ---------- */
.line-art { overflow: visible; }
.spark { fill: var(--clay); stroke: var(--clay); stroke-width: 1.2; stroke-linejoin: round; }
.spark-soft { opacity: .55; }
.spark-main { stroke-width: 3; }
.spark-card { fill: currentColor; stroke: currentColor; opacity: .45; }
.card-art .spark-card { stroke-width: 0.8; }

.spin, .spin-pulse, .twinkle, .float { transform-box: fill-box; transform-origin: center; }
.spin { animation: spin 5s linear infinite; }
.spin-pulse { animation: spin-pulse 18s ease-in-out infinite; }
.twinkle { animation: twinkle 3s ease-in-out infinite; }
.float { animation: float 4s ease-in-out infinite; }
.orbit { transform-box: view-box; transform-origin: 300px 165px; animation: spin 40s linear infinite; }

.spark-divider { display: block; width: 100%; height: 24px; margin: 1.5rem auto; overflow: visible; }
article > .spark-divider { max-width: var(--measure); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-pulse {
  0%   { transform: rotate(0deg) scale(1); }
  25%  { transform: rotate(90deg) scale(1.08); }
  50%  { transform: rotate(180deg) scale(.96); }
  75%  { transform: rotate(270deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%      { transform: scale(.55) rotate(45deg); opacity: .45; }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-6px) rotate(30deg); }
}

/* figures & details */
.figure-box { margin: 2em auto; padding: 1.2rem; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--radius); box-shadow: var(--press); color: var(--ink); }
.figure-box > svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.figure-box figcaption { margin-top: 0.8em; }
details { margin: 1.5em auto; padding: 0.9rem 1.2rem; border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-tint); }
summary { cursor: pointer; font-family: var(--font-head); font-weight: 700; }
details[open] summary { margin-bottom: 0.6em; }
dl, article > dl { margin: 1em auto; }
dt { font-family: var(--font-head); font-weight: 700; }
dd { margin: 0 0 0.8em 1.2em; }

@media (max-width: 520px) {
  body { font-size: 1.05rem; }
  main { padding-block: 1.5rem 3rem; }
  .post-header { padding: 1.4rem 1.2rem; }
  .brand::before { display: none; }
  .brand { font-size: 1rem; }
  .header-inner { gap: 0.5rem; }
  .site-nav { gap: 0.1rem; font-size: 0.92rem; }
  .site-nav a { padding: 0.3em 0.6em; }
  .theme-toggle { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after { transition: none !important; animation: none !important; }
}
.empty-note { margin: 0; max-width: none; color: var(--ink-soft); }

/* ---------- Book-guide blocks (What If) ---------- */
.eq { text-align: center; font-size: 1.08em; margin: 1.2em auto; padding: 0.7em 1em; background: var(--accent-tint); border-radius: 12px; overflow-x: auto; }
.ch-pages { color: var(--ink-soft); font-size: 0.95rem; margin-top: -0.4em; }
.figure-box .fig-desc { margin: 0; padding: 0.9em 1.1em; border: 2px dashed var(--rule); border-radius: 12px; color: var(--ink-soft); font-size: 0.95rem; }
.figure-box .fig-desc::before { content: "Figure in the book: "; font-weight: 700; color: var(--ink); }
