:root,
[data-theme="paper"] {
  --bg: #F6F3EC;
  --surface: #EDE8DC;
  --ink: #1B1A17;
  --muted: #5F5C53;
  --faint: #6B685F;
  --rule: rgba(27, 26, 23, 0.13);
  --accent: #943423;
  --app-accent: #1F4486;
  --btn-bg: #1B1A17;
  --btn-ink: #F6F3EC;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="sepia"] {
  --bg: #EFE7D5;
  --surface: #E5DBC5;
  --ink: #242019;
  --muted: #655E51;
  --faint: #655F53;
  --rule: rgba(36, 32, 25, 0.14);
  --accent: #8F311F;
  --btn-bg: #242019;
  --btn-ink: #EFE7D5;
}

[data-theme="dusk"] {
  --bg: #141413;
  --surface: #1C1C1A;
  --ink: #E7E3D9;
  --muted: #989387;
  --faint: #898476;
  --rule: rgba(231, 227, 217, 0.12);
  --accent: #D9775F;
  --app-accent: #739AE3;
  --btn-bg: #E7E3D9;
  --btn-ink: #141413;
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 14px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--sans);
  font-size: 13px;
  border-radius: 4px;
  z-index: 60;
}

.skip-link:focus {
  left: 8px;
}

/* Reading Progress Hairline */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 50;
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}

.page-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 28px 96px;
}

/* Masthead */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
  font-family: var(--sans);
  flex-wrap: wrap;
  transition: opacity 0.3s ease;
}

body.focus-mode .masthead {
  opacity: 0.22;
}
body.focus-mode .masthead:hover {
  opacity: 1;
}

.site-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 22px;
  font-size: 13.5px;
  color: var(--muted);
}

.nav-links a {
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Home Hero */
.intro-band {
  max-width: 68ch;
  margin-bottom: 64px;
}

.intro-band--tight {
  margin-bottom: 40px;
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.display-title {
  font-weight: 400;
  font-size: clamp(29px, 3.6vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.018em;
  margin-bottom: 20px;
}

.display-title em {
  font-style: italic;
  color: var(--accent);
}

.intro-copy {
  font-size: 17.5px;
  color: var(--muted);
  max-width: 56ch;
}

.intro-copy a {
  color: var(--accent);
  border-bottom: 1px solid var(--rule);
}

/* Section Headers */
.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.filter-tabs {
  display: flex;
  gap: 16px;
  font-family: var(--sans);
  font-size: 13px;
}

.filter-btn {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  font-family: inherit;
  font-size: inherit;
  transition: color 0.2s ease;
}

.filter-btn:hover { color: var(--ink); }
.filter-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Writing Index List */
.writing-list {
  margin-bottom: 72px;
}

.writing-entry {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

.writing-entry.hidden {
  display: none;
}

.entry-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.entry-kind {
  display: block;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
  margin-top: 2px;
}

.entry-title {
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 6px;
  transition: color 0.2s ease;
}

.writing-entry:hover .entry-title {
  color: var(--accent);
}

.entry-excerpt {
  font-size: 15px;
  color: var(--muted);
  max-width: 58ch;
  line-height: 1.58;
}

.entry-time {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

/* Semestra Companion Shelf (Home) */
.app-shelf {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 36px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 64px;
}

.app-shelf .section-label {
  margin-bottom: 12px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.app-mark {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--app-accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-mark--paradeiser {
  background: #e61e14;
  color: #ffffff;
}

.app-mark--muninn {
  background: #272d3d;
  color: #f6f3ec;
}

.app-title {
  font-family: var(--sans);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}

.app-desc {
  font-size: 15.5px;
  color: var(--muted);
  margin-bottom: 22px;
  max-width: 48ch;
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--sans);
}

.btn-solid {
  background: var(--btn-bg);
  color: var(--btn-ink);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s ease;
}

.btn-solid:hover { opacity: 0.86; }

.btn-solid.btn-disabled {
  background: var(--surface);
  color: var(--faint);
  border: 1px solid var(--rule);
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
}

.btn-outline {
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 9px 18px;
  font-size: 13px;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.btn-outline:hover { border-color: var(--ink); }

.release-mini-list {
  border-top: 1px solid var(--rule);
}

.release-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}

.release-ver {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--app-accent);
  font-weight: 600;
  white-space: nowrap;
}

.release-mini-title {
  font-size: 14px;
  color: var(--ink);
  flex: 1;
}

.release-mini-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}

/* Longform Reader Article */
.reader-container {
  max-width: 62ch;
  margin: 0 auto;
}

.reader-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.control-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.ctrl-btn:hover,
.ctrl-btn.active {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface);
}

.article-header {
  margin-bottom: 40px;
}

.article-meta-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.article-meta-line .kind-tag {
  color: var(--accent);
}

.article-title {
  font-weight: 400;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.article-subtitle {
  font-size: 19px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.48;
}

.prose-body {
  font-size: var(--reader-size, 18px);
  line-height: 1.78;
}

.prose-body p {
  margin-bottom: 1.45em;
}

.prose-body.is-story > p:first-of-type::first-letter {
  float: left;
  font-size: 3.45em;
  line-height: 0.84;
  padding-right: 10px;
  padding-top: 5px;
  color: var(--accent);
}

.prose-body h2,
.prose-body h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-top: 2em;
  margin-bottom: 0.7em;
  line-height: 1.3;
}

.prose-body h2 { font-size: 1.25em; }
.prose-body h3 { font-size: 1.08em; }

.prose-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  margin: 1.8em 0;
  color: var(--muted);
  font-style: italic;
}

.prose-body ul,
.prose-body ol {
  margin: 1.2em 0 1.5em 1.4em;
}

.prose-body li {
  margin-bottom: 0.55em;
}

.prose-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 3px;
}

.scene-break {
  border: 0;
  height: auto;
  overflow: visible;
  text-align: center;
  margin: 2.2em 0;
  color: var(--faint);
  font-size: 14px;
}

.scene-break::before {
  content: "\00B7\00A0\00B7\00A0\00B7";
  letter-spacing: 0.6em;
}

.fn-ref a {
  font-family: var(--mono);
  font-size: 0.72em;
  color: var(--accent);
  vertical-align: super;
  padding: 0 2px;
}

.footnotes {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

.footnotes ol {
  margin-left: 1.2em;
}

.article-nav {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  font-family: var(--sans);
}

.article-nav a {
  display: block;
}

.article-nav-next {
  text-align: right;
}

.article-nav-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}

.article-nav-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
}

.article-nav a:hover .article-nav-title {
  color: var(--accent);
}

/* Semestra Dedicated Page */
.semestra-hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
}

.semestra-hero--single {
  grid-template-columns: minmax(0, 62ch);
}

.semestra-hero .app-title {
  font-size: 26px;
}

.semestra-hero .intro-copy {
  margin-bottom: 24px;
}

.semestra-hero .action-row {
  margin-bottom: 16px;
}

.semestra-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  line-height: 1.7;
}

.semestra-meta a {
  border-bottom: 1px solid var(--rule);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.semestra-meta a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.schematic-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 22px;
}

.schematic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 14px;
}

.state-switch {
  display: flex;
  gap: 6px;
}

.state-btn {
  background: none;
  border: 1px solid var(--rule);
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  cursor: pointer;
}

.state-btn.active {
  background: var(--app-accent);
  border-color: var(--app-accent);
  color: var(--bg);
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 40px;
  margin-bottom: 64px;
}

.cap-item {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.cap-item h2 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.cap-item p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.6;
}

.changelog-entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 32px;
  padding: 36px 0;
  border-bottom: 1px solid var(--rule);
}

.changelog-aside {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.changelog-version {
  display: inline-block;
  color: var(--app-accent);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.changelog-platform {
  margin-top: 6px;
}

.changelog-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.changelog-body {
  font-size: 15.5px;
  color: var(--muted);
  line-height: 1.68;
}

.changelog-body h3 {
  font-family: var(--sans);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 20px 0 10px;
}

.changelog-body ul {
  margin-left: 18px;
  margin-bottom: 12px;
}

.changelog-body li {
  margin-bottom: 8px;
}

.changelog-body strong {
  color: var(--ink);
  font-weight: 600;
}

/* About Page */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 56px;
  align-items: start;
}

.about-grid .prose-body {
  font-size: 17px;
}

.about-aside {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 24px;
  font-family: var(--sans);
  font-size: 14px;
}

.about-aside h2 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 12px;
}

.about-aside ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aside-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 1px;
}

.about-aside a {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
}

.about-aside a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Newsletter Band */
.newsletter-band {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 36px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 24px;
}

.newsletter-band.compact {
  margin-top: 52px;
  margin-bottom: 0;
  padding: 28px 0;
  grid-template-columns: 1fr;
  gap: 18px;
}

.newsletter-band .section-label {
  margin-bottom: 8px;
}

.newsletter-title {
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 6px;
}

.newsletter-desc {
  font-size: 15px;
  color: var(--muted);
  max-width: 46ch;
}

.newsletter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.newsletter-input {
  flex: 1 1 220px;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.newsletter-input::placeholder {
  color: var(--faint);
}

.newsletter-input:focus {
  border-color: var(--accent);
}

.newsletter-btn {
  height: 42px;
  padding: 0 20px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: none;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.newsletter-btn:hover {
  opacity: 0.86;
}

.newsletter-footnote {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.newsletter-status {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--accent);
  min-height: 18px;
}

/* Footer */
.site-footer {
  margin-top: 84px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--faint);
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a:hover {
  color: var(--ink);
}

@media (max-width: 820px) {
  .writing-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .app-shelf,
  .semestra-hero,
  .capabilities-grid,
  .changelog-entry,
  .about-grid,
  .article-nav,
  .newsletter-band {
    grid-template-columns: 1fr;
  }
  .app-shelf {
    padding: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
