:root {
  --ink: #0a0a0a;
  --ink-70: rgba(10, 10, 10, 0.7);
  --ink-65: rgba(10, 10, 10, 0.65);
  --ink-55: rgba(10, 10, 10, 0.55);
  --ink-45: rgba(10, 10, 10, 0.45);
  --ink-18: rgba(10, 10, 10, 0.18);
  --ink-08: rgba(10, 10, 10, 0.08);
  --ink-06: rgba(10, 10, 10, 0.06);
  --paper: #ffffff;
  --green: #1ea65a;

  --font-sans: "Inter Tight", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --max-width: 1280px;
  --gutter: 44px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  font-family: inherit;
}

.marquee {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--gutter);
  border-bottom: 1px solid var(--ink-06);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
}

.nav-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 32px;
  font-size: 13px;
  color: var(--ink-65);
}

.nav-links a {
  transition: color 0.15s ease;
}

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

.nav-status {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--ink-55);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: 8px;
}

/* ---------- Meta ---------- */
.meta {
  padding: 36px var(--gutter) 0;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-45);
}

/* ---------- Hero ---------- */
.hero {
  flex: 1;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  padding: 24px var(--gutter) 32px;
  align-items: center;
}

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

.hero-title {
  margin: 0;
  font-size: clamp(64px, 9vw, 120px);
  line-height: 0.88;
  letter-spacing: -0.055em;
  font-weight: 600;
  color: var(--ink);
  min-height: calc(0.88em * 2);
  display: flex;
  align-items: flex-start;
}

.hero-blurb {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink-70);
  margin-top: 20px;
  max-width: 460px;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-18);
}

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

.stats {
  display: flex;
  gap: 48px;
  margin: 40px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--ink-08);
  flex-wrap: wrap;
}

.stat dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin-bottom: 6px;
}

.stat dd {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* ---------- Hero device ---------- */
.hero-device {
  border-radius: 28px;
  aspect-ratio: 4 / 5;
  max-height: 580px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.08);
  transition: background 0.5s ease, color 0.5s ease;
}

/* ---------- Browser frame inside hero ---------- */
.browser {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.1);
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #f3f1ec;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.browser-dots {
  display: flex;
  gap: 6px;
}

.browser-dots i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.browser-dots i:nth-child(1) { background: #ff5f57; }
.browser-dots i:nth-child(2) { background: #febc2e; }
.browser-dots i:nth-child(3) { background: #28c840; }

.browser-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(10, 10, 10, 0.55);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-screen {
  flex: 1;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}

.browser-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.mock-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  opacity: 0.7;
  text-transform: uppercase;
}

.mock-meta--bright { opacity: 0.75; }

.mock-headline {
  margin-top: 28px;
  font-family: var(--font-serif);
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.mock-headline em { opacity: 0.7; }

.mock-bars {
  margin-top: auto;
}

.mock-bars-row {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
}

.mock-bar {
  flex: 1;
  background: currentColor;
  opacity: 0.9;
  border-radius: 1px;
}

.mock-bars-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
}

.mock-cipher-body {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.55;
  flex: 1;
}

.mock-foot-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.6;
  letter-spacing: 0.1em;
}

.mock-clock {
  margin-top: auto;
  margin-bottom: auto;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 130px;
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.mock-progress {
  height: 4px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.mock-progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 62%;
  background: currentColor;
}

.mock-progress-foot {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
}

.mock-sleep-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.mock-sleep-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
}

.mock-eq {
  display: flex;
  gap: 4px;
}

.mock-eq > span {
  width: 3px;
  background: currentColor;
  opacity: 0.8;
  border-radius: 1px;
}

.mock-pins {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.mock-pin {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.mock-pin-line {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
}

.mock-quote {
  margin-top: 24px;
  font-family: var(--font-serif);
  font-size: 32px;
  line-height: 1.15;
  font-style: italic;
  letter-spacing: -0.015em;
  flex: 1;
}

.mock-terminal {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  flex: 1;
}

.mock-terminal-prompt { opacity: 0.7; }

.mock-terminal pre {
  margin: 8px 0 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
}

/* ---------- Strip header ---------- */
.strip-header {
  padding: 22px var(--gutter) 14px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--ink-08);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-55);
}

.strip-header strong {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Tab strip ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 6), 1fr);
  gap: 4px;
  padding: 0 var(--gutter) 28px;
}

.tab {
  cursor: pointer;
  padding: 16px 14px 14px;
  border: 0;
  border-top: 2px solid var(--ink-08);
  background: transparent;
  border-radius: 0 0 10px 10px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.72;
  transition: opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  font: inherit;
  color: inherit;
  position: relative;
}

.tab::after {
  content: '→';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  font-size: 14px;
  color: var(--ink-45);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.tab:hover {
  opacity: 1;
  background: rgba(10, 10, 10, 0.03);
}

.tab:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.tab[aria-selected="true"] {
  opacity: 1;
  border-top-color: var(--ink);
  background: rgba(10, 10, 10, 0.04);
}

.tab[aria-selected="true"]::after {
  content: '●';
  opacity: 1;
  transform: translateY(-50%);
  color: var(--ink);
  font-size: 8px;
}

.tab-glyph {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-family: Georgia, serif;
  flex-shrink: 0;
  overflow: hidden;
}

.tab-glyph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.tab-text { min-width: 0; }

.tab-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.tab-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-55);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root { --gutter: 28px; }

  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 32px;
  }

  .hero-device {
    max-height: 520px;
    aspect-ratio: 4 / 5;
    order: 2;
  }

  .nav-links { display: none; }

  .tabs {
    grid-template-columns: repeat(min(var(--tab-count, 6), 3), 1fr);
    row-gap: 8px;
  }
}

@media (max-width: 560px) {
  :root { --gutter: 20px; }

  .hero-title { font-size: 17vw; }

  .hero-blurb { font-size: 18px; }

  .stats { gap: 28px; }

  .stat dd { font-size: 18px; }

  .nav-status { display: none; }

  .tabs { grid-template-columns: repeat(min(var(--tab-count, 6), 2), 1fr); }

  .meta { font-size: 9px; }
}

/* ---------- Story page ---------- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
}

.story {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--gutter) 80px;
}

.story-meta {
  display: flex;
  justify-content: space-between;
  padding: 36px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-45);
}

.story-back {
  color: var(--ink-55);
  transition: color 0.15s ease;
}

.story-back:hover { color: var(--ink); }

.story-hero {
  padding: 56px 0 32px;
}

.story-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-55);
  margin-bottom: 18px;
}

.story-title {
  margin: 0;
  font-size: clamp(36px, 5.5vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.story-body {
  font-size: 18px;
  line-height: 1.6;
  color: rgba(10, 10, 10, 0.82);
  letter-spacing: -0.005em;
}

.story-lede {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.35;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -0.015em;
  margin: 0 0 56px;
}

.story-section {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin: 48px 0 14px;
  font-weight: 500;
}

.story-body p {
  margin: 0 0 20px;
}

.story-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--ink-08);
  flex-wrap: wrap;
}

.story-foot-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin-bottom: 6px;
}

.story-live {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}

.story-live:hover { text-decoration: underline; }

/* ---------- Story modal ---------- */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.42);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  animation: modalFade 0.2s ease;
  cursor: pointer;
}

.modal-panel {
  position: relative;
  background: var(--paper);
  border-radius: 20px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.18);
  animation: modalRise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-close {
  position: sticky;
  float: right;
  top: 14px;
  right: 14px;
  margin: 14px 14px -32px auto;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(10, 10, 10, 0.04);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-55);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 2;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: var(--font-sans);
}

.modal-close:hover {
  background: var(--ink-08);
  color: var(--ink);
}

/* Story styles override inside modal */
.modal-panel .story {
  padding: 8px 44px 44px;
  max-width: none;
}

.modal-panel .story-hero {
  padding: 18px 0 24px;
}

.modal-panel .story-title {
  font-size: clamp(32px, 4.4vw, 48px);
}

.modal-panel .story-foot {
  margin-top: 48px;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
  .modal { padding: 16px; }
  .modal-panel .story { padding: 8px 24px 32px; }
}

body.modal-open { overflow: hidden; }

/* ---------- Contact form ---------- */
.modal-panel--narrow {
  max-width: 520px;
}

.contact-form {
  padding: 36px 44px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.contact-header {
  margin-bottom: 6px;
}

.contact-title {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 600;
}

.contact-sub {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--ink-55);
  letter-spacing: -0.005em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-45);
}

.field input,
.field textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-18);
  padding: 6px 0 10px;
  outline: none;
  letter-spacing: -0.005em;
  transition: border-color 0.15s ease;
  resize: vertical;
  font-family: inherit;
}

.field textarea {
  min-height: 96px;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus {
  border-bottom-color: var(--ink);
}

.field input:invalid:not(:placeholder-shown),
.field textarea:invalid:not(:placeholder-shown) {
  border-bottom-color: #c44a3a;
}

.contact-foot {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

@media (max-width: 560px) {
  .contact-form { padding: 28px 24px 28px; }
}

.contact-status {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-55);
  margin-left: auto;
}

.contact-status[data-state="success"] { color: var(--green); }
.contact-status[data-state="error"] { color: #c44a3a; }
