html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: light dark;
}

:root {
  --bg: #f3eee3;
  --bg-elev: #fffaf1;
  --ink: #1c2420;
  --ink-soft: #4d5852;
  --moss: #2c6a48;
  --moss-deep: #1f4a34;
  --clay: #a65030;
  --sky: #3f6484;
  --rule: #d5ccbc;
  --thread: #b85c38;
  --lichen: #3d6b4f;
  --focus: #2c6a48;
  --danger: #8f2d2d;
  --radius: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --shadow: 0 18px 40px rgba(28, 36, 32, 0.08);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #121714;
    --bg-elev: #1b221d;
    --ink: #e8e2d4;
    --ink-soft: #b4b0a4;
    --moss: #8fbf9a;
    --moss-deep: #c5e0cb;
    --clay: #d4896a;
    --sky: #8aa4bc;
    --rule: #2c342f;
    --thread: #d4896a;
    --lichen: #8fbf9a;
    --focus: #8fbf9a;
    --danger: #e08b8b;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  }
}

html[data-theme="dark"] {
  --bg: #121714;
  --bg-elev: #1b221d;
  --ink: #e8e2d4;
  --ink-soft: #b4b0a4;
  --moss: #8fbf9a;
  --moss-deep: #c5e0cb;
  --clay: #d4896a;
  --sky: #8aa4bc;
  --rule: #2c342f;
  --thread: #d4896a;
  --lichen: #8fbf9a;
  --focus: #8fbf9a;
  --danger: #e08b8b;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, var(--thread) 0 7px, var(--lichen) 7px 10px, transparent 10px),
    var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
}

img {
  max-width: 100%;
  outline: 1px solid rgba(28, 36, 32, 0.1);
  outline-offset: -1px;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) img {
    outline-color: rgba(255, 255, 255, 0.1);
  }
}

html[data-theme="dark"] img {
  outline-color: rgba(255, 255, 255, 0.1);
}

a {
  color: var(--moss-deep);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--clay);
}

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

.skip {
  position: absolute;
  left: 0.8rem;
  top: -3rem;
  z-index: 10;
  padding: 0.55rem 0.8rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
}

.skip:focus-visible {
  top: 0.8rem;
}

.frame {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  padding: 0.4rem 0 1.4rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
  justify-content: center;
}

.wordmark-kicker,
.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--moss);
  margin: 0 0 0.35rem;
}

.wordmark-name {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-left: auto;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 999px;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: var(--bg-elev);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition-property: transform, background-color, border-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

.theme-toggle:active {
  transform: scale(0.96);
}

.theme-toggle-icon {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 4px -3px 0 -1px var(--bg-elev);
}

.hero {
  padding: 2.1rem 0 1.4rem;
}

.hero h1,
.essay h1,
.essay h2 {
  text-wrap: balance;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 3.35rem);
}

.lede,
.essay p {
  text-wrap: pretty;
}

.lede {
  max-width: 38rem;
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin: 0;
}

.doors {
  display: grid;
  gap: 0.9rem;
  margin: 0.4rem 0 2rem;
}

.door {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 0.9rem;
  padding: 1.15rem 1.15rem 1.05rem;
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  outline: 1px solid var(--rule);
  transition-property: transform, box-shadow;
  transition-duration: 160ms;
  transition-timing-function: ease-out;
}

.door:hover {
  transform: translateY(-2px);
}

.door-index {
  grid-row: 1 / span 3;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--clay);
  padding-top: 0.35rem;
}

.door h2 {
  margin: 0;
  font-size: 1.35rem;
}

.door p {
  margin: 0.35rem 0 0.7rem;
  color: var(--ink-soft);
}

.door-go {
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--moss-deep);
}

.pull,
.next,
.essay section {
  max-width: 40.5rem;
}

.essay section + section,
.pull,
.next {
  margin-top: 1.8rem;
}

.essay h2 {
  margin: 0 0 0.7rem;
  font-size: 1.55rem;
}

.essay p {
  margin: 0 0 1rem;
}

.pull {
  padding: 1.3rem 1.25rem;
  border-left: 3px solid var(--clay);
  background: var(--bg-elev);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.next {
  padding: 1rem 0 0;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
}

.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.2rem 0.4rem;
  background: var(--bg-elev);
  border-radius: calc(var(--radius) + 8px);
  outline: 1px solid var(--rule);
}

.footer-copy h2 {
  margin: 0 0 0.55rem;
  font-size: 1.5rem;
  text-wrap: balance;
}

.footer-copy p,
.subscribe-hint,
.colophon {
  color: var(--ink-soft);
}

.subscribe {
  position: relative;
  margin: 1rem 0 0.4rem;
}

.subscribe-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
}

.subscribe-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.subscribe input[type="email"] {
  flex: 1 1 16rem;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  font-family: var(--sans);
}

.subscribe button {
  min-height: 48px;
  padding: 0 1.15rem;
  border: 0;
  border-radius: 12px;
  background: var(--moss);
  color: #f7f4ec;
  font-family: var(--sans);
  font-weight: 600;
  cursor: pointer;
  transition-property: transform, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}

html[data-theme="dark"] .subscribe button {
  color: #121714;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .subscribe button {
    color: #121714;
  }
}

.subscribe button:active {
  transform: scale(0.96);
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.notice {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
}

.notice-status {
  background: #dce8df;
  background: color-mix(in srgb, var(--moss) 16%, var(--bg));
}

.notice-alert {
  background: #f0d9d6;
  background: color-mix(in srgb, var(--danger) 16%, var(--bg));
}

html[data-theme="dark"] .notice-status {
  background: #24332a;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .notice-status {
    background: #24332a;
  }

  html:not([data-theme="light"]) .notice-alert {
    background: #3a2424;
  }
}

html[data-theme="dark"] .notice-alert {
  background: #3a2424;
}

.colophon {
  font-family: var(--sans);
  font-size: 0.82rem;
  margin: 1.2rem 0 0.8rem;
}

@media (min-width: 840px) {
  .doors {
    grid-template-columns: repeat(3, 1fr);
  }

  .door {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    min-height: 100%;
  }

  .door-index {
    grid-row: auto;
  }

  .site-footer {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1rem 2rem;
    padding: 1.6rem 1.5rem 0.6rem;
  }

  .colophon {
    grid-column: 1 / -1;
  }
}

@media (max-width: 839px) {
  .nav {
    width: 100%;
    margin-left: 0;
    order: 3;
  }

  .theme-toggle {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door,
  .theme-toggle,
  .subscribe button {
    transition-duration: 0.01ms;
  }

  .door:hover,
  .theme-toggle:active,
  .subscribe button:active {
    transform: none;
  }
}
