:root {
  --paper: #fbf6ee;
  --ink: #201d1a;
  --muted: #6d6257;
  --line: #d9cbb8;
  --rust: #9b442f;
  --teal: #1f6d6a;
  --gold: #d1a348;
  --panel: #fffaf2;
  --night: #151b28;
  --shadow: 0 18px 50px rgba(32, 29, 26, 0.12);
  --header-bg: rgba(251, 246, 238, 0.9);
  --input-bg: #fff;
  --terminal-bg: #131927;
  --terminal-bar: #0e1320;
  --terminal-text: #e6dcc6;
  --terminal-mute: rgba(230, 220, 198, 0.55);
  --terminal-border: rgba(230, 220, 198, 0.12);
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #14120e;
  --ink: #ede4d4;
  --muted: #968b7e;
  --line: #2a241e;
  --rust: #d77052;
  --teal: #5fb1ad;
  --gold: #e2bb6b;
  --panel: #1c1813;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(20, 18, 14, 0.85);
  --input-bg: #1c1813;
  --terminal-border: rgba(230, 220, 198, 0.18);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

body,
.site-header,
.subscribe,
input,
.theme-toggle,
.site-footer {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

a {
  color: inherit;
  text-decoration-color: rgba(31, 109, 106, 0.45);
  text-underline-offset: 0.2em;
}

[data-theme="dark"] a {
  text-decoration-color: rgba(95, 177, 173, 0.5);
}

.topnote {
  display: block;
  padding: 9px 16px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.topnote-cta {
  margin-left: 6px;
  color: var(--teal);
  font-weight: 600;
}

[data-theme="dark"] .topnote-cta {
  color: var(--gold);
}

.topnote:hover .topnote-cta {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

nav a {
  text-decoration: none;
}

nav a:hover {
  color: var(--ink);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

.theme-icon-dark {
  display: none;
}

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

[data-theme="dark"] .theme-icon-dark {
  display: block;
}

.hero {
  display: grid;
  gap: clamp(34px, 5.5vw, 60px);
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 6vw, 72px);
}

.terminal {
  position: relative;
  border: 1px solid var(--terminal-border);
  border-radius: 8px;
  background: var(--terminal-bg);
  color: var(--terminal-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.86rem, 1.4vw, 0.98rem);
  line-height: 1.6;
  overflow: hidden;
  box-shadow:
    0 30px 60px -28px rgba(12, 17, 28, 0.55),
    inset 0 0 0 1px rgba(255, 250, 242, 0.04);
}

.terminal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 250, 242, 0.018) 0,
    rgba(255, 250, 242, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--terminal-border);
  background: var(--terminal-bar);
  color: var(--terminal-mute);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.terminal-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.terminal-label::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 13px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(209, 163, 72, 0.55);
}

.terminal-status {
  display: inline-flex;
  gap: 5px;
}

.terminal-status span {
  display: block;
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 1px;
  opacity: 0.55;
}

.terminal-status span:nth-child(2) {
  opacity: 0.8;
}

.terminal-status span:nth-child(3) {
  opacity: 1;
}

.terminal-body {
  position: relative;
  padding: clamp(24px, 3.6vw, 40px);
}

.terminal-body p {
  margin: 0 0 1em;
}

.terminal-body p:last-child {
  margin-bottom: 0;
}

.terminal-signature {
  margin-top: 1.6em;
  color: var(--terminal-mute);
  font-size: 0.85em;
  letter-spacing: 0.04em;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--rust);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

[data-theme="dark"] .eyebrow {
  color: var(--gold);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 740px;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.4vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  max-width: 620px;
  margin: 20px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  line-height: 1.4;
}

.story {
  width: min(700px, calc(100% - 40px));
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.7vw, 1.22rem);
  line-height: 1.72;
}

.chapter-meta {
  margin: 0 0 56px;
  text-align: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.story h2 {
  margin-bottom: 32px;
  color: var(--teal);
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
}

.story h3 {
  margin: 44px 0 18px;
  color: var(--rust);
  font-size: 1.4rem;
}

.story p {
  margin: 0 0 1.35em;
}

.story em {
  color: var(--ink);
  font-style: italic;
}

.story .scene-break {
  margin: 56px auto;
  text-align: center;
  color: var(--muted);
  opacity: 0.55;
  font-size: 0.78rem;
  letter-spacing: 0.7em;
  user-select: none;
}

.story .transmission {
  margin: 0.9em auto;
  padding: 12px 16px;
  border-left: 4px solid var(--teal);
  background: rgba(31, 109, 106, 0.08);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  line-height: 1.55;
}

[data-theme="dark"] .story .transmission {
  background: rgba(95, 177, 173, 0.08);
  color: #d8e6e2;
}

.end-note {
  width: min(620px, calc(100% - 40px));
  margin: 56px auto 16px;
  padding: 36px 0 0;
  text-align: center;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.7vw, 1.18rem);
  font-style: italic;
  line-height: 1.5;
}

.end-note p {
  margin: 0;
}

.end-note .end-note-fineprint {
  margin-top: 14px;
  color: var(--muted);
  font-style: normal;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.subscribe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 32px;
  align-items: center;
  width: min(880px, calc(100% - 40px));
  margin: 28px auto 90px;
  padding: clamp(26px, 4.5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.subscribe h2 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 700;
}

.subscribe-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
button {
  min-height: 52px;
  border-radius: 6px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--ink);
  padding: 0 14px;
}

input:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(31, 109, 106, 0.18);
}

[data-theme="dark"] input:focus {
  outline-color: rgba(95, 177, 173, 0.25);
}

button {
  border: 0;
  background: var(--teal);
  color: white;
  padding: 0 20px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #185957;
}

[data-theme="dark"] button:hover {
  background: #4a9b97;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

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

.form-message {
  min-height: 28px;
  margin: 12px 0 0;
  font-size: 0.95rem;
}

.form-message[data-state="success"] {
  color: var(--teal);
}

.form-message[data-state="error"] {
  color: var(--rust);
}

.error-main {
  width: min(720px, calc(100% - 40px));
  margin: clamp(48px, 10vw, 120px) auto;
  display: grid;
  gap: 36px;
}

.error-return {
  margin: 0;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.error-return a {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.error-return a:hover {
  color: var(--ink);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .site-header {
    padding: 0 16px;
  }

  nav {
    gap: 12px;
  }

  .hero {
    width: min(100% - 32px, 720px);
    padding: 36px 0 48px;
  }

  .terminal-bar {
    padding: 9px 14px;
    font-size: 0.65rem;
    letter-spacing: 0.16em;
  }

  .terminal-body {
    padding: 22px 18px;
  }

  h1 {
    font-size: clamp(2rem, 8vw, 2.6rem);
  }

  .story {
    width: min(100% - 32px, 720px);
  }

  .chapter-meta {
    margin-bottom: 40px;
  }

  .end-note {
    width: min(100% - 32px, 620px);
    padding-top: 28px;
  }

  .subscribe {
    grid-template-columns: 1fr;
    width: min(100% - 32px, 720px);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body,
  .site-header,
  .subscribe,
  input,
  .theme-toggle,
  .site-footer {
    transition: none;
  }
}
