:root {
  --bg: #0a2540;
  --fg: #f4e9d8;
  --fg-dim: rgba(244, 233, 216, 0.65);
  --rule: rgba(244, 233, 216, 0.15);

  /* Type palette — saturated, high-contrast. One per content type.
     Only essay is in use today; others wait for their first piece. */
  --essay: #ff5a1f;
  --fragment: #ffc93c;
  --poem: #e91e63;
  --prose: #c77dff;
  --reference: #00bcd4;
  --recipe: #00b894;
  --quote: #f4e9d8;
  --question: #4fc3f7;
  --dialogue: #a7ff83;
  --review: #ff9e7d;
  --list: #b8b8b8;
  --scratch: #ffd166;

  --type: var(--essay);
}

.type-essay     { --type: var(--essay); }
.type-fragment  { --type: var(--fragment); }
.type-poem      { --type: var(--poem); }
.type-prose     { --type: var(--prose); }
.type-reference { --type: var(--reference); }
.type-recipe    { --type: var(--recipe); }
.type-quote     { --type: var(--quote); }
.type-question  { --type: var(--question); }
.type-dialogue  { --type: var(--dialogue); }
.type-review    { --type: var(--review); }
.type-list      { --type: var(--list); }
.type-scratch   { --type: var(--scratch); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
}

a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--type); }

.site-header,
.site-footer,
article,
main.index {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3rem;
}
.site-title {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  font-size: 0.95rem;
}
.site-title::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  background: var(--type, var(--essay));
  margin-right: 0.6rem;
  transform: translateY(-1px);
}

.site-footer {
  padding-top: 3rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
}
.site-footer a { text-decoration: none; color: var(--fg-dim); }
.site-footer a:hover { color: var(--type); }

/* Content pages */
.content-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  margin-bottom: 1rem;
}
.type-marker {
  width: 0.9rem;
  height: 0.9rem;
  background: var(--type);
  flex-shrink: 0;
}
.type-label { color: var(--type); }

article h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  font-weight: 600;
  margin: 0 0 2rem;
  letter-spacing: -0.01em;
}
article h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 0.75rem;
  color: var(--type);
  font-weight: 600;
  letter-spacing: 0.01em;
}
article h3 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }
article p { margin: 0 0 1.25rem; }
article em { font-style: italic; }
article strong { font-weight: 600; }

blockquote {
  border-left: 3px solid var(--type);
  padding-left: 1.25rem;
  margin: 1.75rem 0;
  color: var(--fg-dim);
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  background: rgba(244, 233, 216, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}
pre {
  background: rgba(244, 233, 216, 0.06);
  border-left: 3px solid var(--type);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
pre code { background: none; padding: 0; }

hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* Sketches */
.sketch { display: block; }
.sketch canvas { display: block; max-width: 100%; }

.sketch-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.sketch-bg canvas { width: 100vw !important; height: 100vh !important; }
.has-sketch-bg article { background: rgba(10, 37, 64, 0.78); }

.sketch-hero {
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: 0 0 2rem;
  overflow: hidden;
  background: rgba(244, 233, 216, 0.04);
  border-left: 3px solid var(--type);
}

.sketch-interstitial {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 2.5rem 0;
  overflow: hidden;
  background: rgba(244, 233, 216, 0.04);
  border-left: 3px solid var(--type);
}

.sketch-inline {
  width: 100%;
  margin: 1.5rem 0;
  overflow: hidden;
}

.media-hero { margin: 0 0 2rem; }
.media-hero img,
.media-hero video { display: block; width: 100%; height: auto; }
.media-hero audio { display: block; width: 100%; }

/* Index page */
main.index { padding-top: 0; padding-bottom: 4rem; }

.hero {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  text-align: center;
  padding: 4rem 1.5rem 3rem;
}
.hero svg { display: block; }
.hero h1 {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0;
}
.hero p { color: var(--fg-dim); margin: 0; font-size: 0.95rem; }

/* Type filter chips */
.type-filter { position: absolute; opacity: 0; pointer-events: none; }

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.chip {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--rule);
  color: var(--fg-dim);
  cursor: pointer;
  user-select: none;
  border-radius: 2px;
}
.chip:hover { color: var(--type); border-color: var(--type); }
.chip.chip-all { --type: var(--fg); }

/* Active chip: scoped per-type via :has() on main */
main.index:has(#f-all:checked) .chip-all,
main.index:has(#f-essay:checked) .chip.type-essay,
main.index:has(#f-fragment:checked) .chip.type-fragment,
main.index:has(#f-poem:checked) .chip.type-poem,
main.index:has(#f-prose:checked) .chip.type-prose,
main.index:has(#f-reference:checked) .chip.type-reference,
main.index:has(#f-recipe:checked) .chip.type-recipe,
main.index:has(#f-quote:checked) .chip.type-quote,
main.index:has(#f-question:checked) .chip.type-question,
main.index:has(#f-dialogue:checked) .chip.type-dialogue,
main.index:has(#f-review:checked) .chip.type-review,
main.index:has(#f-list:checked) .chip.type-list,
main.index:has(#f-scratch:checked) .chip.type-scratch {
  background: var(--type);
  color: var(--bg);
  border-color: var(--type);
}

/* Hide non-matching sections when a specific type is selected */
main.index:has(.type-filter:checked:not(#f-all)) .type-section { display: none; }
main.index:has(#f-essay:checked) .type-section.type-essay,
main.index:has(#f-fragment:checked) .type-section.type-fragment,
main.index:has(#f-poem:checked) .type-section.type-poem,
main.index:has(#f-prose:checked) .type-section.type-prose,
main.index:has(#f-reference:checked) .type-section.type-reference,
main.index:has(#f-recipe:checked) .type-section.type-recipe,
main.index:has(#f-quote:checked) .type-section.type-quote,
main.index:has(#f-question:checked) .type-section.type-question,
main.index:has(#f-dialogue:checked) .type-section.type-dialogue,
main.index:has(#f-review:checked) .type-section.type-review,
main.index:has(#f-list:checked) .type-section.type-list,
main.index:has(#f-scratch:checked) .type-section.type-scratch { display: block; }

.type-section { margin-top: 3.5rem; }
.type-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--type);
  margin-bottom: 1.5rem;
}
.type-section-header::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  background: var(--type);
  flex-shrink: 0;
}
.type-section-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.entry-list time {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8rem;
  color: var(--fg-dim);
  padding-top: 0.25rem;
}
.entry-list a { font-size: 1.05rem; text-decoration: none; }
.entry-list a:hover { color: var(--type); }
.entry-desc { display: block; color: var(--fg-dim); font-size: 0.9rem; margin-top: 0.25rem; }

@media (max-width: 32rem) {
  .entry-list li { grid-template-columns: 1fr; gap: 0.25rem; }
  .entry-list time { padding-top: 0; }
}
