/* ==========================================================================
   misraturp.com — styles
   Colours live in two blocks below (light and dark). Change a colour there
   and it changes everywhere.
   ========================================================================== */

/* ---------- Light (white) ---------- */
:root,
:root[data-theme="light"] {
  --bg: #FFFFFF;
  --ink: #241B35;          /* headings */
  --body: #3A3050;         /* body text */
  --body-2: #4E4466;       /* softer text, nav */
  --muted: #625879;        /* dates, captions */
  --line: #E7E4EE;
  --accent: #B0306A;       /* raspberry: links, buttons, italic words */
  --accent-hover: #7E1F4B;
  --on-accent: #FFFFFF;
  --tech: #5B4CDB;         /* violet: labels, quote line */
  --glow: 91, 76, 219;
  --glow-pink: 176, 48, 106;
  --cyan: #3FD0E8;
  --ph-1: #F2F0F6;         /* image placeholders */
  --ph-2: #ECEFF6;
  --ph-3: #F6EEF2;
  --screen: #241B35;       /* video thumbnails */
  --bubble-bg: #FFFFFF;
  --bubble-text: #241B35;
  --bubble-border: #E7E4EE;
  --donkey-glow: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.10));
  --grid: rgba(36, 27, 53, 0.06);   /* graph-paper lines */
  color-scheme: light;
}

/* ---------- Dark (deep violet) ---------- */
:root[data-theme="dark"] {
  --bg: #1C1530;
  --ink: #F3EEFA;
  --body: #E2DAEF;
  --body-2: #CFC5E0;
  --muted: #A99CC2;
  --line: #3A2F55;
  --accent: #FF6FA8;
  --accent-hover: #FF9CC4;
  --on-accent: #1C1530;
  --tech: #A497FF;
  --glow: 164, 151, 255;
  --glow-pink: 255, 111, 168;
  --cyan: #3FD0E8;
  --ph-1: #2E2547;
  --ph-2: #262B4A;
  --ph-3: #3A2440;
  --screen: #120D20;
  --bubble-bg: #2E2547;
  --bubble-text: #F3EEFA;
  --bubble-border: #A497FF;
  --donkey-glow: drop-shadow(0 0 6px rgba(164, 151, 255, 0.6));
  --grid: rgba(200, 185, 255, 0.07);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  overflow-x: clip;
  transition: background-color .25s ease, color .25s ease;
}
/* Graph-paper background: a fine 24px grid, fading out under the text column */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(50% - 460px), rgba(0,0,0,.18) calc(50% - 340px), rgba(0,0,0,.18) calc(50% + 340px), #000 calc(50% + 460px), #000 100%);
          mask-image: linear-gradient(90deg, #000 0, #000 calc(50% - 460px), rgba(0,0,0,.18) calc(50% - 340px), rgba(0,0,0,.18) calc(50% + 340px), #000 calc(50% + 460px), #000 100%);
}
@media (max-width: 800px) {
  body::before { -webkit-mask-image: none; mask-image: none; opacity: .5; }
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--tech); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: 'Newsreader', Georgia, serif; font-weight: 400; color: var(--ink); margin: 0; }
h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.015em; }
h2 { font-size: 28px; line-height: 1.2; }
h3, .h3 { font-size: 22px; line-height: 1.3; }
h1 em, h2 em { color: var(--accent); }
p { margin: 0; }
strong { color: var(--ink); font-weight: 600; }
.wrap { max-width: 720px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.soft { color: var(--body-2); }
.small { font-size: 15px; }
.label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--tech); margin: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--bg); padding: 8px 12px; }
.skip-link:focus { left: 8px; z-index: 10000; }

/* ---------- Header & footer ---------- */
.site-header {
  padding-top: 36px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
}
.site-name { font-family: 'Newsreader', Georgia, serif; font-size: 22px; color: var(--ink); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; font-size: 15px; }
.site-nav a { color: var(--body-2); text-decoration: none; padding: 6px 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--body-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
:root[data-theme="light"] .icon-sun, :root[data-theme="dark"] .icon-moon { display: none; }
.site-footer {
  margin-top: 0; padding-top: 32px; padding-bottom: 120px;
  background: linear-gradient(var(--line), var(--line)) center top / calc(100% - 48px) 1px no-repeat;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  font-size: 15px; color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.site-footer a { color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: 48px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 20px; }
.section--last { padding-bottom: 64px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head a { font-size: 15px; }
.page-head { padding: 72px 0 40px; display: flex; flex-direction: column; gap: 20px; }
.lead { font-size: 19px; line-height: 1.65; color: var(--body); }

/* Hero */
.hero { padding: 64px 0 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 32px 40px; }
.hero-text { flex: 999 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero-photo {
  position: relative; flex: 0 1 240px; min-width: 200px; aspect-ratio: 4 / 5; border-radius: 20px; overflow: hidden;
  background: var(--ph-1); display: flex; align-items: flex-end; padding: 16px;
}
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; }
.ph-label { font-size: 13px; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 24px; }
.timeline li > span:last-child { flex: 1 1 360px; }
.when { flex: 0 0 110px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--muted); padding-top: 3px; }
.when.now { color: var(--accent); font-weight: 500; }

/* Neon touches (story and work sections) */
.section--neon { border-top: 0; }
.glow-line {
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--tech) 55%, var(--cyan));
  box-shadow: 0 0 10px rgba(var(--glow), .75), 0 0 22px rgba(63, 208, 232, .45);
  margin-bottom: 8px;
}
.code-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--tech);
  text-shadow: 0 0 8px rgba(var(--glow), .55); margin-bottom: -12px;
}
.section--neon h2 { text-shadow: 0 0 14px rgba(var(--glow), .35); }

/* Quote */
.testimonial, .prose blockquote {
  margin: 8px 0; padding-left: 20px;
  border-left: 3px solid var(--tech);
  box-shadow: -6px 0 14px -6px rgba(var(--glow), .7);
  font-family: 'Newsreader', Georgia, serif; font-style: italic; font-size: 21px; line-height: 1.5; color: var(--ink);
}
.testimonial {
  margin: 20px 0 8px; padding: 0; border: 0; box-shadow: none;
  font-size: 19px; line-height: 1.65;
  display: flex; flex-direction: column; gap: 18px;
}
/* The quote sits in a speech bubble with a small tail pointing at the name */
.testimonial p {
  position: relative;
  background: var(--bubble-bg);
  border: 1px solid rgba(var(--glow), .35);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 0 0 4px rgba(var(--glow), .05), 0 10px 30px -12px rgba(var(--glow), .45);
}
.testimonial p::after {
  content: ""; position: absolute; left: 36px; bottom: -9px; width: 16px; height: 16px;
  background: var(--bubble-bg);
  border-right: 1px solid rgba(var(--glow), .35); border-bottom: 1px solid rgba(var(--glow), .35);
  transform: rotate(45deg); border-bottom-right-radius: 3px;
}
.testimonial footer { margin: 0; padding-left: 28px; font-family: 'Hanken Grotesk', system-ui, sans-serif; font-style: normal; font-size: 15px; color: var(--muted); }
@media (max-width: 560px) { .testimonial p { padding: 20px; } .testimonial footer { padding-left: 20px; } }

/* Lists */
.uses { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }

/* Videos */
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px 16px; }
.video { display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
.screen {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--screen); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(var(--glow), .6), 0 0 18px rgba(var(--glow), .45), 0 0 36px rgba(var(--glow-pink), .18);
  transition: box-shadow .2s ease;
}
.video:hover .screen { box-shadow: 0 0 0 1px rgba(var(--glow), .9), 0 0 24px rgba(var(--glow), .6), 0 0 44px rgba(var(--glow-pink), .3); }
.screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.play { position: relative; }
.play circle { fill: var(--bg); fill-opacity: .92; }
.play path { fill: var(--tech); }
.video-title { font-size: 15px; line-height: 1.4; font-weight: 500; }
.video-meta { font-size: 13px; color: var(--muted); margin-top: -4px; }

/* Post lists */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list a { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; color: var(--ink); text-decoration: none; }
.post-list .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.post-list .t { font-family: 'Newsreader', Georgia, serif; font-size: 24px; line-height: 1.25; }
.post-list a:hover .t { color: var(--accent); }
.post-list .meta, .post-list time { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--muted); }
.post-list .excerpt { font-size: 16px; line-height: 1.6; color: var(--body-2); }
.post-list.compact li + li { border-top: 1px solid var(--line); }  /* lines only between posts */
.post-list.compact a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 24px; padding: 14px 0; }
.post-list.compact time { white-space: nowrap; }
.post-list.compact .t { font-size: 20px; }
.year-group { gap: 8px; padding: 32px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  font: inherit; font-size: 15px; cursor: pointer; min-height: 40px;
  padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--body-2);
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* Books */
.shelf-group { display: flex; flex-direction: column; gap: 12px; }
.cover {
  flex: 0 0 56px; width: 56px; height: 84px; border-radius: 4px; overflow: hidden;
  background: var(--ph-1); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.book.book--now { display: flex; flex-direction: row; gap: 14px; align-items: flex-start; }
.book--now > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.book-line { font-size: 15px; line-height: 1.4; }
.book-title { font-family: 'Newsreader', Georgia, serif; font-size: 17px; line-height: 1.3; color: var(--ink); display: inline-block; }
.book--now .book-title { font-size: 19px; }
.book-note { font-size: 14px; line-height: 1.55; color: var(--body-2); }
.book-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px 24px; }
.book { display: flex; flex-direction: column; gap: 10px; }
.book-top { display: flex; gap: 12px; align-items: flex-start; }
.book-top > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.book-grid .book:nth-child(2) .cover { background: var(--ph-2); }
.book-grid .book:nth-child(3) .cover { background: var(--ph-3); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; min-height: 48px;
  background: var(--accent); color: var(--on-accent); text-decoration: none;
  padding: 14px 30px; border-radius: 999px; font-weight: 600; font-size: 17px;
}
.button:hover { background: var(--accent-hover); color: var(--on-accent); }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 8px; }

/* ---------- Posts ---------- */
.post-head { padding: 64px 0 32px; display: flex; flex-direction: column; gap: 16px; }
.back-link { font-size: 15px; text-decoration: none; }
.meta { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--muted); }
.post-head h1 { font-size: 48px; }
.post-cover { margin: 0 0 40px; }
.post-cover img { border-radius: 12px; width: 100%; }
.post-cover figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
.prose { font-family: 'Newsreader', Georgia, serif; font-size: 21px; line-height: 1.7; color: var(--ink); }
.prose > * + * { margin-top: 24px; }
.prose h2 { font-size: 28px; font-weight: 500; margin-top: 40px; }
.prose h3 { font-size: 23px; font-weight: 500; margin-top: 36px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li + li { margin-top: 10px; }
.prose img { border-radius: 12px; width: 100%; }
.prose p:has(> img:only-child) + p > em:only-child { display: block; margin-top: -12px; font-size: 16px; color: var(--muted); font-family: 'Hanken Grotesk', system-ui, sans-serif; }
.prose iframe { width: 100%; height: 480px; border: 0; border-radius: 12px; background: var(--ph-1); }
.prose .photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.prose .photo-grid p { display: contents; }
.prose .photo-grid img { aspect-ratio: 4 / 3; object-fit: cover; margin: 0; }
.prose a { word-break: break-word; }
.author-note { margin-top: 56px; padding: 32px 0; border-top: 1px solid var(--line); display: flex; gap: 20px; align-items: center; }
.author-note p { font-size: 16px; line-height: 1.6; }
.author-photo { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; background: var(--ph-1); overflow: hidden; }
.author-photo img { width: 100%; height: 100%; object-fit: cover; }
.post-pager { padding: 32px 0 64px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.post-pager a { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.post-pager a span { font-size: 14px; color: var(--muted); }
.post-pager a strong { font-family: 'Newsreader', Georgia, serif; font-weight: 400; font-size: 20px; }
.post-pager .next { align-items: flex-end; text-align: right; }
.post-pager a:hover strong { color: var(--accent); }

/* AI resources */
.resource-list { list-style: none; margin: 0; padding: 0; }
.resource-list li { padding: 24px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

/* ---------- Donkey ---------- */
.dk-wrap { position: fixed; left: 0; right: 0; bottom: 10px; height: 72px; pointer-events: none; z-index: 9999; }
.dk-mover { position: absolute; bottom: 0; left: 0; width: 104px; height: 72px; will-change: transform; }
.dk-btn {
  pointer-events: auto; display: block; width: 104px; height: 72px; padding: 0; margin: 0; border: 0;
  background: transparent; cursor: pointer; filter: var(--donkey-glow);
}
.dk-bubble {
  position: absolute; bottom: 82px; white-space: nowrap; padding: 10px 14px; border-radius: 14px;
  background: var(--bubble-bg); color: var(--bubble-text); border: 1px solid var(--bubble-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 14px; line-height: 1.4; pointer-events: none;
}
.dk-bubble strong { display: block; font-weight: 600; font-size: 15px; color: inherit; }
.dk-bubble[hidden] { display: none; }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  h1 { font-size: 38px; }
  .post-head h1 { font-size: 38px; }
  .prose { font-size: 19px; }
  .hero { padding-top: 40px; }
  .page-head { padding-top: 48px; }
  .prose iframe { height: 360px; }
}

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

@media (max-width: 560px) {
  .hero-photo { flex-basis: 100%; max-width: 260px; }
}

.donkey-note { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--muted); }

/* Privacy and legal notice pages */
.legal h2 { margin-top: 16px; }
.details { margin: 0; display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 10px 24px; }
.details dt { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; color: var(--muted); padding-top: 4px; }
.details dd { margin: 0; min-width: 0; }
@media (max-width: 560px) { .details { grid-template-columns: 1fr; gap: 2px; } .details dd + dt { margin-top: 12px; } }
