:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --ink: #18211f;
  --muted: #5d6865;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --line: #d6ded8;
  --primary: #1e6b5f;
  --primary-strong: #164c44;
  --accent: #b94f2f;
  --gold: #b1842c;
  --shadow: 0 18px 48px rgb(24 33 31 / 10%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111715;
  --ink: #eef4f0;
  --muted: #aab7b1;
  --surface: #1b2421;
  --surface-soft: #232f2b;
  --line: #34433e;
  --primary: #70c7bb;
  --primary-strong: #a0e3dc;
  --accent: #ed916f;
  --gold: #d4b15e;
  --shadow: 0 18px 48px rgb(0 0 0 / 28%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111715;
    --ink: #eef4f0;
    --muted: #aab7b1;
    --surface: #1b2421;
    --surface-soft: #232f2b;
    --line: #34433e;
    --primary: #70c7bb;
    --primary-strong: #a0e3dc;
    --accent: #ed916f;
    --gold: #d4b15e;
    --shadow: 0 18px 48px rgb(0 0 0 / 28%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(30 107 95 / 8%) 1px, transparent 1px),
    linear-gradient(0deg, rgb(30 107 95 / 8%) 1px, transparent 1px),
    var(--bg);
  background-size: 36px 36px;
}

body,
button,
input,
select,
textarea {
  font: inherit;
}

button,
input,
select,
textarea {
  color: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.topbar,
.section-heading,
.hero,
.section-grid,
.settings-grid,
.hero-actions,
.button-row,
.visual-track {
  display: flex;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: 0.8rem 0;
  background: color-mix(in srgb, var(--bg), transparent 8%);
  backdrop-filter: blur(18px);
}

.topbar h1,
.hero h2,
.panel h2,
.email-preview h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.3rem, 3vw, 1.85rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface), transparent 15%);
}

.nav a {
  min-width: 5.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

main {
  display: grid;
  gap: 1rem;
}

.hero {
  position: relative;
  align-items: stretch;
  justify-content: space-between;
  overflow: hidden;
  gap: clamp(1rem, 4vw, 3rem);
  min-height: 440px;
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgb(30 107 95 / 18%), transparent 55%),
    linear-gradient(90deg, var(--surface), var(--surface-soft));
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -12rem;
  bottom: -10rem;
  width: 34rem;
  height: 34rem;
  border: 1px solid color-mix(in srgb, var(--primary), transparent 55%);
  transform: rotate(28deg);
}

.hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  max-width: 690px;
}

.hero h2 {
  max-width: 13ch;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
}

.hero p:not(.eyebrow) {
  max-width: 62ch;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.6;
}

.hero-actions,
.button-row {
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.button-row {
  margin-top: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: white;
}

:root[data-theme="dark"] .button.primary {
  color: #07110f;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-strong);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
}

.flow-visual {
  position: relative;
  z-index: 1;
  display: grid;
  align-self: stretch;
  min-width: min(360px, 100%);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 32%);
}

:root[data-theme="dark"] .flow-visual {
  background: rgb(27 36 33 / 76%);
}

.visual-track {
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
}

.visual-track span {
  min-height: 2.6rem;
  padding: 0.7rem 0.85rem;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.visual-track span:nth-child(2n) {
  border-left-color: var(--gold);
}

.visual-card {
  display: grid;
  align-self: end;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
}

.visual-card strong {
  margin-top: 0.7rem;
  font-size: 3.5rem;
  line-height: 0.9;
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: #2fa36b;
}

.section-grid {
  align-items: flex-start;
  gap: 1rem;
}

.flow-panel {
  flex: 1 1 690px;
}

.preview-panel {
  flex: 0 1 390px;
}

.panel {
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(24 33 31 / 5%);
}

.section-heading {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.day-buttons {
  display: grid;
  gap: 0.65rem;
}

.day-button {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  min-height: 4.25rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-soft);
  text-align: left;
  cursor: pointer;
}

.day-button[data-active="true"] {
  border-color: var(--primary);
  border-left-color: var(--primary);
  background: color-mix(in srgb, var(--primary), transparent 90%);
}

.day-button span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.day-button strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.email-preview {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.mail-label,
.email-preview p {
  margin: 0;
}

.mail-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.email-preview h3 {
  font-size: 1.45rem;
}

#preview-body {
  white-space: pre-line;
  color: var(--muted);
  line-height: 1.55;
}

#preview-cta {
  justify-self: start;
}

.composer-grid,
.settings-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field.wide,
.export-field {
  grid-column: 1 / -1;
}

.field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 0.65rem 0.75rem;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary), transparent 62%);
  outline-offset: 2px;
}

.save-state {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.settings-panel {
  margin-bottom: 1rem;
}

.export-field {
  margin-top: 1rem;
}

#export-output {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-footer a {
  color: var(--primary);
}

@media (max-width: 840px) {
  .topbar,
  .hero,
  .section-grid,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .nav {
    overflow-x: auto;
  }

  .nav a {
    flex: 1;
  }

  .hero h2 {
    max-width: 11ch;
  }

  .flow-visual {
    min-width: 0;
  }

  .composer-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 1rem, 1180px);
  }

  .hero {
    min-height: 0;
  }

  .hero h2 {
    font-size: 2.35rem;
  }

  .nav a {
    min-width: 5rem;
  }

  .button,
  .button-row {
    width: 100%;
  }
}
