/* ==========================================================================
   Mythic Research Archive — Core Stylesheet
   
   Design principles:
   - Information density over visual comfort
   - Typography over decoration
   - Structure over ornament
   - Austere, pre-modern aesthetic
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables & Dark Mode
   -------------------------------------------------------------------------- */

:root {
  --bg-primary: #fafaf8;
  --bg-secondary: #f5f5f3;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-tertiary: #666;
  --border-light: #ddd;
  --border-medium: #ccc;
  --border-heavy: #1a1a1a;
  --link-color: #2a2a2a;
  --link-underline: #999;
  --accent-ember: #b38b56;
  --accent-line: #c6b089;
  --mythic-symbol: #1a1a1a;
  --panel-bg: var(--bg-primary);
  --selection-bg: rgba(179, 139, 86, 0.3);
  --selection-text: #1a1a1a;
}

[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #151515;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-tertiary: #888;
  --border-light: #333;
  --border-medium: #444;
  --border-heavy: #e8e8e8;
  --link-color: #d0d0d0;
  --link-underline: #666;
  --accent-ember: #c9a46a;
  --accent-line: #d5c099;
  --mythic-symbol: #fff;
  --panel-bg: var(--bg-primary);
  --selection-bg: rgba(201, 164, 106, 0.35);
  --selection-text: #0a0a0a;
}

/* --------------------------------------------------------------------------
   CSS Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: 18px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", 
               Georgia, serif;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  max-width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-variant-numeric: oldstyle-nums;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.mythic-sep {
  margin: 0.75rem 0 0.5rem;
  letter-spacing: 0.4em;
  color: var(--mythic-symbol);
  font-size: 0.9rem;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 0.25rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.1rem;
}

h5, h6 {
  font-size: 1rem;
  font-variant: small-caps;
}

p {
  margin-bottom: 1rem;
  max-width: 70ch;
}

/* Optimal line length for dense reading */
article p,
article li {
  max-width: 65ch;
  text-align: justify;
}

.katex-display {
  display: block;
  width: 100%;
  max-width: 65ch;
  margin: 1.25rem auto;
  text-align: center;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.15em;
  transition: text-decoration-color 0.2s;
}

a:hover {
  text-decoration-color: var(--text-primary);
}

a:visited {
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.site-nav {
  border-bottom: 2px solid var(--border-heavy);
  padding: 1rem 0;
  margin-bottom: 2rem;
  position: sticky;
  top: 0;
  background: var(--panel-bg);
  z-index: 100;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Offset scroll targets so sticky nav doesn't cover them */
[id^="param-"] {
  scroll-margin-top: 4.5rem;
}

.nav-inner {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}

.nav-group {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  justify-content: center;
}

.nav-home {
  font-weight: 400;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: 0.05em;
  position: relative;
  display: inline-block;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
  transition: opacity 0.2s;
  position: relative;
  display: inline-block;
}

.nav-links a[aria-current="page"],
.nav-home[aria-current="page"] {
  font-size: 1.15rem;
}

.nav-links a[aria-current="page"]::after,
.nav-home[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -0.42rem;
  width: 2.1rem;
  height: 1px;
  background: var(--text-secondary);
  opacity: 0.85;
}

.nav-links a:hover {
  opacity: 0.6;
}

/* Nav utility controls */
.nav-tools {
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
}

/* Dark mode toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  font-size: 1rem;
  font-family: inherit;
  transition: opacity 0.2s, border-color 0.2s;
  margin-left: 0;
  grid-column: 3;
  justify-self: end;
}

.ascii-toggle[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.ascii-toggle {
  min-width: 2.25rem;
  text-align: center;
  line-height: 1;
  font-size: 1.05rem;
}

.theme-toggle:hover {
  opacity: 0.6;
  border-color: var(--border-heavy);
}

.theme-toggle:focus {
  outline: 2px solid var(--border-heavy);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Main Layout
   -------------------------------------------------------------------------- */

.site-main {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.content-wrap {
  max-width: 70ch;
  margin: 0 auto;
}

.content-wrap--wide {
  max-width: 90rem;
}

/* --------------------------------------------------------------------------
   ASCII Art Support (Core Design Primitive)
   -------------------------------------------------------------------------- */

.ascii-art {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", 
               "Droid Sans Mono", "Source Code Pro", monospace;
  font-size: 0.45rem;
  line-height: 1.05;
  color: #e8e8e8;  /* Always light colored for dark mode */
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;
  tab-size: 8;
  -moz-tab-size: 8;
  text-decoration: none;
  filter: grayscale(100%);
  transition: filter 0.3s ease, color 0.3s ease;
}

.ascii-art--dark {
  display: block;
}

.ascii-art--light {
  display: none;
  color: #011101;
  filter: none;
}

/* Invert ASCII in light mode to make it dark */
[data-theme="light"] .ascii-art {
  filter: grayscale(100%) invert(1);
}

[data-theme="light"] .ascii-art--light {
  display: block;
  filter: none;
  color: #1a1a1a;
}

[data-theme="light"] .ascii-art--dark {
  display: none;
}

.ascii-art * {
  color: inherit !important;
  text-decoration: none !important;
}

/* ASCII playground (interactive controls) */
.ascii-playground {
  --ascii-playground-columns: 175;
  --ascii-playground-columns-mobile: 88;
  margin: 2rem 0 2.5rem;
  display: grid;
  gap: 1.25rem;
  width: min(100vw - 4rem, 90rem);
  margin-left: 50%;
  transform: translateX(-50%);
}

.ascii-playground .ascii-figure {
  align-items: center;
  width: 100%;
}

.ascii-playground .ascii-art {
  font-size: 0.5rem;
  line-height: 1.05;
}

.ascii-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem 1.5rem;
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  width: min(100%, 65ch);
  justify-self: center;
  margin: 0 auto;
}

.ascii-control {
  display: grid;
  gap: 0.4rem;
}

.ascii-controls .ascii-control:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 20rem;
}

.ascii-control-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.ascii-control label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  font-variant: small-caps;
  color: var(--text-tertiary);
}

.ascii-control-value {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.ascii-control input[type="range"] {
  width: 100%;
  accent-color: var(--text-secondary);
}

.ascii-controls-note {
  margin: 0 auto;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  width: min(100%, 65ch);
}

@media (max-width: 900px) and (pointer: coarse) {
  .katex-display {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
  }

  .ascii-playground {
    width: min(100vw - 0.8rem, 90rem);
    margin-left: 50%;
    transform: translateX(-50%);
  }

  .ascii-figure--paper .ascii-art {
    width: 155ch;
    max-width: 100%;
    overflow: hidden;
  }

  .ascii-playground .ascii-art {
    /* Push ASCII close to viewport margins on phones/tablets. */
    font-size: clamp(0.2rem, calc((100vw - 0.9rem) / var(--ascii-playground-columns-mobile)), 0.5rem);
    line-height: 1.01;
    padding: 0.25rem 0;
  }

  .ascii-controls {
    width: min(100%, calc(100vw - 0.8rem));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
    padding-inline: 0.15rem;
  }

  .ascii-controls .ascii-control:last-child:nth-child(odd) {
    max-width: none;
  }

  .ascii-controls-note {
    width: min(100%, calc(100vw - 0.8rem));
    padding-inline: 0.15rem;
  }
}

@media (max-width: 640px) and (pointer: coarse) {
  .ascii-playground .ascii-art {
    font-size: clamp(0.22rem, calc((100vw - 0.9rem) / 84), 0.52rem);
  }

  .ascii-controls {
    width: min(100%, calc(100vw - 0.8rem));
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .ascii-control label,
  .ascii-control-value {
    font-size: 0.76rem;
  }

  .ascii-controls-note {
    width: 100%;
  }
}

.ascii-art--crop-right {
  width: var(--ascii-crop-chars, auto);
  max-width: 100%;
  overflow: hidden;
  text-align: right;
}

.ascii-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ASCII art as homepage masthead */
.index-header .ascii-art:not(.ascii-art--crop-right) {
  margin: 3rem auto;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Paper Layout
   -------------------------------------------------------------------------- */

.paper {
  max-width: 55rem;
}

.paper-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-heavy);
  max-width: 65ch;
}

.paper-header h1,
.story-header h1 {
  text-align: center;
}

.paper-header .mythic-sep,
.story-header .mythic-sep {
  text-align: center;
}

.paper-meta {
  display: flex;
  gap: 2rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-variant: small-caps;
  justify-content: center;
  flex-wrap: wrap;
}

.paper-tags {
  display: flex;
  gap: 1rem;
  list-style: none;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.paper-tags li::before {
  content: "§ ";
  color: var(--text-tertiary);
}

.paper-abstract {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-line);
}

.paper-abstract h2 {
  font-size: 0.9rem;
  font-variant: small-caps;
  margin: 0 0 0.75rem 0;
  border: none;
  letter-spacing: 0.1em;
}

.paper-abstract p {
  margin: 0;
  font-size: 0.95rem;
}

.paper-content {
  font-size: 1rem;
  max-width: 65ch;
}

.paper-references {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-medium);
}

.paper-references h2 {
  font-size: 1rem;
  font-variant: small-caps;
  margin-bottom: 1rem;
  border: none;
}

.paper-references ol {
  margin-left: 2rem;
}

.paper-references li {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  max-width: 70ch;
}

.entry-footer-nav {
  margin-top: 3rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border-medium);
  max-width: 65ch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry-footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.85rem;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: border-color 0.2s, color 0.2s, opacity 0.2s;
}

.entry-footer-link:hover {
  border-color: var(--border-heavy);
  color: var(--text-primary);
  opacity: 0.9;
}

.entry-footer-link--primary {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Story Layout
   -------------------------------------------------------------------------- */

.story {
  max-width: 55rem;
}

.story-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-medium);
  max-width: 65ch;
}

.story-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-variant: small-caps;
  justify-content: center;
  flex-wrap: wrap;
}

.story-visual {
  margin: 1.35rem auto 1.1rem;
  max-width: min(100%, 28rem);
}

.story-visual img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.story-visual-source {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-tertiary);
  text-align: center;
  opacity: 0.9;
}

.story-visual-label {
  font-style: normal;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

.story-visual-sep {
  margin: 0 0.4rem;
}

.draft-marker {
  color: #c00;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.story-serial-info {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.serial-name {
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.05em;
}

.story-content {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 65ch;
}

.story-content > p:first-of-type::first-letter {
  font-family: "Iowan Old Style", "Blackletter 686", serif;
  font-size: 4rem;
  float: left;
  line-height: 1;
  letter-spacing: -0.12em;
  padding-right: 0.15em;
  color: #dcd7c9;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.2), 0 0 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .story-content > p:first-of-type::first-letter {
  color: #1a1a1a;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
}

.serial-nav {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-medium);
}

.serial-nav h2 {
  font-size: 1rem;
  font-variant: small-caps;
  margin-bottom: 1rem;
  border: none;
}

.serial-nav ol {
  margin-left: 2rem;
}

.serial-nav li {
  margin-bottom: 0.5rem;
}

.serial-nav [aria-current="page"] a {
  font-weight: 600;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   About Page
   -------------------------------------------------------------------------- */

.about-page {
  max-width: 70ch;
  margin: 0 auto;
}

.about-page p,
.about-page li {
  text-align: left;
}

.about-header {
  margin-bottom: 1.8rem;
}

.about-header h1,
.about-header .mythic-sep {
  text-align: center;
}

.about-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem);
  gap: 1.4rem;
  align-items: start;
  margin-bottom: 2.2rem;
}

.about-intro-copy p {
  max-width: 54ch;
  text-align: justify;
}

.about-ascii {
  justify-self: end;
  align-items: center;
  width: min(100%, 22rem);
  padding: 0;
  border: 0;
  background: transparent;
}

.about-ascii .ascii-art {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  font-size: 0.35rem;
  line-height: 1.03;
  overflow: hidden;
}

.about-ascii-source {
  margin-top: 0.5rem;
  width: 100%;
  text-align: center;
  font-size: 1rem;
  font-style: italic;
  color: var(--text-tertiary);
  opacity: 0.9;
}

.about-block + .about-block {
  margin-top: 1.9rem;
}

.about-block h2 {
  margin-top: 0;
}

.about-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
  max-width: 65ch;
}

.about-contact-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s, opacity 0.2s;
}

.about-contact-card:hover {
  border-color: var(--border-heavy);
  background-color: var(--bg-secondary);
  opacity: 0.9;
}

.about-contact-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: currentColor;
}

.about-contact-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.about-contact-name {
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  line-height: 1.2;
}

.about-contact-hint {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.about-updated {
  margin-top: 0.9rem;
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Index Pages (Papers, Stories, etc.)
   -------------------------------------------------------------------------- */

.index-page {
  max-width: 90rem;
}

.index-page--section {
  max-width: 78rem;
  margin: 0 auto;
}

.index-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 4rem;
  padding: 0;
  border: none;
  background: transparent;
}

.index-header--home {
  align-items: stretch;
  margin-bottom: 1.5rem;
}

.index-page--section .index-header {
  margin-bottom: 2.25rem;
}

.index-hero {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(260px, 0.9fr);
  gap: 3.5rem;
  align-items: center;
  max-width: 78rem;
  margin: 0 auto;
  margin-top: 4.5rem;
}

.index-header--home .index-text h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.index-header--home .index-text h1::first-letter {
  font-family: "Iowan Old Style", "Blackletter 686", serif;
  font-size: 4rem;
  letter-spacing: -0.12em;
  color: #dcd7c9;
  display: inline-block;
  margin-right: 0.25rem;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.2), 0 0 12px rgba(0, 0, 0, 0.3);
  text-transform: none;
}
[data-theme="light"] .index-header--home .index-text h1::first-letter {
  color: #1a1a1a;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
}
.index-header--home .ascii-container {
  justify-content: flex-end;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.index-header--home .ascii-art {
  margin: 0;
  font-size: 0.37rem;
  max-width: 100%;
  overflow: hidden;
}

.index-header--home .index-text {
  text-align: left;
  max-width: 40ch;
}

.index-header--home .mythic-sep {
  text-align: left;
  opacity: 0.8;
}

.ascii-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
}

.index-text {
  text-align: center;
  max-width: 60ch;
}

.index-page--section .index-text {
  max-width: 72ch;
}

.index-description {
  margin-top: 0.5rem;
  font-size: 1.05rem;
  max-width: 60ch;
}

.index-quote {
  margin: 0.5rem auto 0;
  max-width: 70ch;
  text-align: center;
}

.index-quote-text {
  margin: 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
  position: relative;
  padding: 0 1rem;
  opacity: 0.9;
}

.index-quote-source {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-tertiary);
  opacity: 0.9;
}

.index-quote-sep {
  margin: 0 0.5rem;
  color: var(--text-tertiary);
}

.latest-block {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-medium);
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

.latest-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.latest-title {
  margin: 0;
  font-size: 1rem;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  border: none;
}

.random-button {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity 0.2s, border-color 0.2s;
}

.random-button:hover {
  opacity: 0.6;
  border-color: var(--border-heavy);
}

.latest-list {
  margin: 1.5rem 0 0;
}

.latest-list li {
  margin-bottom: 0;
}

.latest-list h3 {
  font-size: 1rem;
}

.latest-list .item-meta {
  font-size: 0.8rem;
}

.latest-list .item-excerpt {
  font-size: 0.9rem;
}

.index-content h2 {
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.index-page--section .index-content {
  max-width: 72ch;
  margin: 0 auto;
}

.index-page--section .index-content > p:first-child {
  margin-bottom: 1.9rem;
  font-size: 1rem;
  color: var(--text-secondary);
}

.index-page--section .index-content h2 {
  margin-top: 2.3rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 0.25rem;
  color: var(--text-tertiary);
}

/* List of papers/stories */
.content-list {
  list-style: none;
  margin: 2rem 0;
}

.content-list li {
  margin-bottom: 1.5rem;
  max-width: none;
}

.content-list h3 {
  font-size: 1.1rem;
  margin: 0;
}

.content-list .item-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  font-variant: small-caps;
}

.content-list .item-excerpt {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.index-page--section .content-list {
  margin: 1.15rem 0 0;
}

.index-page--section .content-list li {
  margin: 0;
  padding: 0 0 1.2rem;
  border-bottom: 1px solid var(--border-light);
}

.index-page--section .content-list li + li {
  margin-top: 1.2rem;
}

.index-page--section .content-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.index-page--section .content-list h3 {
  font-size: 1.2rem;
  line-height: 1.25;
}

.index-page--section .content-list .item-meta {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}

.index-page--section .content-list .item-excerpt {
  margin-top: 0.9rem;
  font-size: 1rem;
  line-height: 1.55;
  max-width: 62ch;
}

/* --------------------------------------------------------------------------
   Code Blocks
   -------------------------------------------------------------------------- */

code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", 
               "Source Code Pro", monospace;
  font-size: 0.9em;
  background: var(--bg-secondary);
  padding: 0.15em 0.3em;
  border-radius: 2px;
}

pre {
  background: var(--bg-secondary);
  padding: 1rem;
  overflow-x: auto;
  border-left: 3px solid var(--border-medium);
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}

th {
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-heavy);
  padding: 0.5rem 1rem 0.5rem 0;
  font-variant: small-caps;
}

td {
  border-bottom: 1px solid var(--border-light);
  padding: 0.5rem 1rem 0.5rem 0;
}

tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Blockquotes
   -------------------------------------------------------------------------- */

blockquote {
  margin: 2rem 0;
  padding-left: 2rem;
  border-left: 3px solid var(--accent-line);
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */

ul, ol {
  margin: 1rem 0 1rem 2rem;
}

li {
  margin-bottom: 0.5rem;
}

ul:not(.nav-links):not(.paper-tags):not(.content-list) {
  list-style: none;
  margin-left: 1.5rem;
}

ul:not(.nav-links):not(.paper-tags):not(.content-list) > li {
  position: relative;
}

ul:not(.nav-links):not(.paper-tags):not(.content-list) > li::before {
  content: "❖";
  position: absolute;
  left: -1.25rem;
  color: var(--mythic-symbol);
}

ul ul, ol ol, ul ol, ol ul {
  margin: 0.5rem 0 0.5rem 2rem;
}

/* --------------------------------------------------------------------------
   Horizontal Rules
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem 0;
}

figure {
  margin: 2rem 0;
}

figcaption {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 6rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-medium);
}

.footer-inner {
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 2rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-variant: small-caps;
}

/* --------------------------------------------------------------------------
   Hero Landing Page — Immersive Design
   -------------------------------------------------------------------------- */

.meta-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-light);
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  font-variant: small-caps;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-tertiary);
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.meta-pill:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
}

.meta-pill:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.hero-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  letter-spacing: 0.03em;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.hero-method:hover {
  opacity: 1;
}

.hero-method .caption-technique {
  font-variant: small-caps;
  letter-spacing: 0.1em;
}

.hero-params {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  line-height: 1.5;
  opacity: 0.88;
}

.hero-params .caption-technique {
  margin-right: 0.4rem;
  font-variant: small-caps;
  letter-spacing: 0.1em;
}

.hp-k {
  opacity: 0.55;
  font-style: italic;
  margin-right: 0.08em;
}

.hp-k sub {
  font-size: 0.72em;
}

.hp-v {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.hp-dot {
  opacity: 0.3;
  margin: 0 0.15em;
}

.hero-method-link {
  margin: 0.4rem 0 0;
}

/* Enhanced ASCII figure for hero */
.ascii-figure--hero {
  position: relative;
}

.caption-technique {
  font-variant: small-caps;
  letter-spacing: 0.1em;
}

/* Single subtle reveal for homepage blocks */
@keyframes homeReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .index-header--home,
  .index-quote {
    animation: homeReveal 0.45s ease-out both;
  }
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .nav-inner {
    grid-template-columns: 1fr;
    padding: 0 1rem;
    gap: 0.75rem;
    justify-items: center;
  }

  .nav-group {
    grid-column: 1;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.85rem 1rem;
  }

  .nav-links {
    gap: 0.85rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-tools {
    grid-column: 1;
    justify-self: center;
  }

  .theme-toggle {
    grid-column: auto;
    justify-self: auto;
  }

  .site-main {
    padding: 0 1rem 3rem;
  }

  .ascii-art {
    font-size: 0.25rem;
    padding: 0.75rem 0;
  }

  .index-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.75rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.35rem;
  }



  .index-header--home .index-text h1 {
    font-size: 2.25rem;
    text-align: center;
  }

  .index-header--home .index-text h1::first-letter {
    font-size: 3rem;
    margin-right: 0.15rem;
  }

  .index-header--home .ascii-container {
    order: 2;
    justify-content: center;
    margin-bottom: 0;
  }

  .index-header--home .index-text {
    order: 1;
    max-width: 34rem;
    text-align: center;
    margin: 0 auto;
  }

  .index-header--home .mythic-sep {
    text-align: center;
  }

  .index-header--home .ascii-art {
    font-size: 0.205rem;
  }

  .ascii-figure--hero {
    --ascii-crop-chars: 192ch !important;
  }

  .hero-method {
    justify-content: center;
    text-align: center;
  }

  .hero-params,
  .hero-method-link {
    text-align: center;
  }

  .latest-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .latest-list {
    margin-top: 1.25rem;
  }

  .entry-footer-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .entry-footer-link {
    width: 100%;
  }

  .about-intro {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.7rem;
  }

  .about-ascii {
    justify-self: center;
    width: min(100%, 21rem);
  }

  .about-ascii .ascii-art {
    font-size: 0.21rem;
  }

  .index-page--section .index-header {
    margin-bottom: 1.7rem;
  }

  .index-page--section .index-content > p:first-child {
    margin-bottom: 1.45rem;
    font-size: 1rem;
  }

  .index-page--section .index-content h2 {
    margin-top: 1.95rem;
    margin-bottom: 0.9rem;
  }

  .index-page--section .content-list h3 {
    font-size: 1.15rem;
  }

  .index-page--section .content-list li + li {
    margin-top: 1rem;
  }

  .index-page--section .content-list .item-excerpt {
    margin-top: 0.75rem;
    font-size: 0.97rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .nav-links a,
  .nav-home {
    font-size: 0.9rem;
  }

  .index-hero {
    gap: 1.2rem;
    margin-top: 1.15rem;
  }

  .index-header--home .index-text h1 {
    font-size: 2rem;
  }

  .index-header--home .index-text h1::first-letter {
    font-size: 2.6rem;
  }

  .index-header--home .ascii-art {
    font-size: 0.22rem;
  }

  .ascii-figure--hero {
    --ascii-crop-chars: 190ch !important;
  }

  .paper-meta,
  .story-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .about-ascii {
    width: 100%;
    padding: 0;
  }

  .about-ascii .ascii-art {
    font-size: 0.19rem;
  }

  .index-page--section .content-list h3 {
    font-size: 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */

@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }

  .site-nav,
  .site-footer {
    display: none;
  }

  a {
    text-decoration: none;
    color: black;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  .ascii-art {
    font-size: 6pt;
  }
}
