/* ============================================================
   STUDIO — the Sketchpad theme
   A working sheet from an electronic studio: a ruler down the
   margin, a timeline across the top, entries numbered like
   systems in a score. Paper, graphite and signal red, with a
   single thread of moss green leading back to the main site.
   ============================================================ */

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

:root {
  --paper:   #ecebe5;
  --paper-2: #e2e0d8;
  --ink:     #1c1c1a;
  --ink-md:  #52524c;
  --ink-lt:  #85847b;
  --signal:  #c8321f;
  --moss:    #4f6e46;
  --rule:    #c9c7bd;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 4.5rem;
  color-scheme: light;
}

html { font-size: 17px; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }

.sheet {
  max-width: 1100px; position: relative;
  padding-left: var(--gutter);
  border-left: 1px solid var(--ink);
  margin: 0 auto 0 max(1rem, calc((100vw - 1100px) / 2));
  min-height: 100vh;
}
.ruler {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--gutter);
  background-image: repeating-linear-gradient(to bottom, var(--ink) 0 1px, transparent 1px 24px);
  background-size: 8px 100%; background-repeat: no-repeat;
  pointer-events: none;
}

/* ── masthead ── */
.masthead {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1rem;
  padding: 2.2rem 1.5rem 1rem 0; border-bottom: 2px solid var(--ink);
}
.masthead .name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.masthead .name span { font-weight: 400; color: var(--ink-md); }
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; font-size: 0.82rem; }
.masthead nav a { text-decoration: none; }
.masthead nav a:hover { color: var(--signal); }
.masthead nav a[aria-current="page"] { border-bottom: 2px solid var(--signal); }
.masthead nav a.home { color: var(--moss); }

.timeline {
  font-family: var(--mono); font-size: 0.6rem; color: var(--ink-lt);
  padding: 10px 1.5rem 0 0; display: flex; justify-content: space-between;
  background: repeating-linear-gradient(to right, var(--ink-lt) 0 1px, transparent 1px 2.5%) top / 100% 6px no-repeat;
}

/* ── intro ── */
.intro { padding: 3rem 1.5rem 2.5rem 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 3rem; align-items: end; border-bottom: 1px solid var(--rule); }
.intro h1 { font-size: clamp(3rem, 8vw, 6rem); font-weight: 700; letter-spacing: -0.045em; line-height: 0.9; }
.intro h1 em { font-style: normal; color: var(--signal); }
.intro p { font-size: 1.05rem; line-height: 1.5; color: var(--ink-md); max-width: 28em; }
.intro p + p { margin-top: 0.8rem; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-lt); }

/* ── filter row ── */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 1.2rem 1.5rem 1.2rem 0; border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 0.68rem; }
.filters button {
  font: inherit; background: none; border: 1px solid var(--ink); color: var(--ink);
  padding: 0.25rem 0.7rem; cursor: pointer; letter-spacing: 0.04em; text-transform: capitalize;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.filters .count { margin-left: auto; color: var(--ink-lt); align-self: center; }

/* ── entries ── */
.entry { position: relative; padding: 2.4rem 1.5rem 2.4rem 0; border-bottom: 1px solid var(--rule); }
.entry[hidden] { display: none; }
.sysno {
  position: absolute; left: calc(var(--gutter) * -1); top: 2.4rem; width: var(--gutter);
  text-align: center; font-family: var(--mono); font-size: 0.66rem; font-weight: 700;
  background: var(--paper); padding: 0.2rem 0;
}
.entry-head { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: baseline; font-family: var(--mono); font-size: 0.66rem; color: var(--ink-lt); margin-bottom: 0.4rem; }
.tag { border: 1px solid currentColor; padding: 0 0.4rem; letter-spacing: 0.06em; text-transform: uppercase; }
.tag.released, .tag.tool { color: var(--moss); }
.tag.in-progress { color: var(--signal); }
.tag.shelved { color: var(--ink-lt); }
.entry h1, .entry h2 { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }
.entry h1 { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -0.035em; line-height: 1.05; }
.entry h2 a { text-decoration: none; }
.entry h2 a:hover { color: var(--signal); }

.entry-body { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.5rem; margin-top: 1rem; }
.entry-body .summary { color: var(--ink-md); font-size: 0.95rem; max-width: 36em; }
.entry-body .read { margin-top: 0.8rem; font-family: var(--mono); font-size: 0.68rem; }
.entry-body .read a { text-decoration: none; border-bottom: 1px solid var(--ink); }
.entry-body .read a:hover { color: var(--signal); border-color: var(--signal); }
dl.meta { font-family: var(--mono); font-size: 0.68rem; display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.2rem 0.6rem; align-content: start; border-top: 1px solid var(--ink); padding-top: 0.6rem; }
dl.meta dt { color: var(--ink-lt); }
dl.meta a { color: var(--moss); }

/* a strip of spectrogram, read left to right like the timeline */
.plate { margin-top: 1.4rem; }
.plate img { width: 100%; height: 130px; object-fit: cover; object-position: center 70%; display: block; }
.plate figcaption { font-family: var(--mono); font-size: 0.6rem; color: var(--ink-md); margin-top: 0.4rem; display: flex; justify-content: space-between; }
.entry audio { display: block; width: 100%; max-width: 26rem; height: 36px; margin-top: 1.2rem; }

/* single-sketch body text */
.prose { max-width: 38em; color: var(--ink-md); margin-top: 1.6rem; }
.prose > * + * { margin-top: 1rem; }
.prose h2, .prose h3 { color: var(--ink); letter-spacing: -0.01em; margin-top: 2rem; font-size: 1.15rem; }
.prose a { color: var(--moss); }
.prose code { font-family: var(--mono); font-size: 0.85em; background: var(--paper-2); padding: 0.05em 0.3em; }
.prose pre { background: var(--paper-2); padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.78rem; }
.prose pre code { background: none; padding: 0; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose figure, .prose svg { margin: 1.6rem 0; }

/* a drawn score: put an <svg class="score"> in a sketch's body */
svg.score { width: 100%; height: 110px; display: block; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
svg.score rect { fill: var(--ink); }
svg.score rect.hot { fill: var(--signal); }

.pager { display: flex; justify-content: space-between; gap: 2rem; padding: 1.4rem 1.5rem 1.4rem 0; border-bottom: 1px solid var(--rule); font-size: 0.9rem; }
.pager a { text-decoration: none; max-width: 48%; }
.pager a:hover { color: var(--signal); }
.pager span { display: block; font-family: var(--mono); font-size: 0.62rem; color: var(--ink-lt); }
.pager .next { text-align: right; margin-left: auto; }

.empty { padding: 2.4rem 1.5rem 2.4rem 0; color: var(--ink-md); border-bottom: 1px solid var(--rule); }

footer.site { padding: 2rem 1.5rem 3rem 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-family: var(--mono); font-size: 0.64rem; color: var(--ink-md); }
footer.site a { color: var(--moss); }

@media (max-width: 820px) {
  :root { --gutter: 2.2rem; }
  .intro, .entry-body { grid-template-columns: 1fr; gap: 1.4rem; }
  .masthead { grid-template-columns: 1fr; gap: 0.8rem; }
  .masthead nav { gap: 0.4rem 1.1rem; }
  .filters .count { margin-left: 0; width: 100%; }
}
