/* ihasmail.org
   Palette lifted from the logo: the cat's orange (#F9A34B), the envelope's
   teal (#46CAC3) and the ink outline both are drawn in (#1C4053). Teal
   leads, orange is the highlight, and the ink becomes the dark ground.

   Light is the base definition on :root. Dark is redefined twice -- once
   under prefers-color-scheme for visitors who never touched the toggle,
   once under [data-theme="dark"] so an explicit choice wins either way.
   No colour is ever defined *only* inside one of those blocks. */

:root {
  --bg: #f6fbfb;
  --bg-alt: #eaf4f4;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #d2e3e5;
  --border-strong: #b3d0d3;

  --text: #10303d;
  --text-muted: #4a6b76;
  --text-faint: #57737c;

  /* Teal darkened for text and edges on a light ground, so it clears AA. */
  --accent: #0b6b67;
  --accent-hot: #095553;
  --accent-soft: #46cac3;
  --on-accent: #ffffff;

  /* Orange likewise darkened wherever it has to carry text. */
  --warm: #9c580c;
  --warm-soft: #f9a34b;

  --tint: rgba(11, 107, 103, 0.09);
  --tint-warm: rgba(156, 88, 12, 0.10);
  --glow: rgba(70, 202, 195, 0.22);
  --shadow: 0 18px 44px -26px rgba(16, 48, 61, 0.42);
  --code-bg: #edf6f6;

  --radius: 12px;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d2430;
    --bg-alt: #0a1c26;
    --surface: #12303e;
    --surface-raised: #163a4a;
    --border: #21505f;
    --border-strong: #2e6a7a;

    --text: #eaf6f6;
    --text-muted: #a3c3cb;
    --text-faint: #86aab4;

    --accent: #46cac3;
    --accent-hot: #6fdcd6;
    --accent-soft: #46cac3;
    --on-accent: #062028;

    --warm: #f9a34b;
    --warm-soft: #f9a34b;

    --tint: rgba(70, 202, 195, 0.10);
    --tint-warm: rgba(249, 163, 75, 0.12);
    --glow: rgba(70, 202, 195, 0.26);
    --shadow: 0 22px 60px -28px rgba(0, 0, 0, 0.75);
    --code-bg: #0a1c26;
  }
}

:root[data-theme="dark"] {
  --bg: #0d2430;
  --bg-alt: #0a1c26;
  --surface: #12303e;
  --surface-raised: #163a4a;
  --border: #21505f;
  --border-strong: #2e6a7a;

  --text: #eaf6f6;
  --text-muted: #a3c3cb;
  --text-faint: #86aab4;

  --accent: #46cac3;
  --accent-hot: #6fdcd6;
  --accent-soft: #46cac3;
  --on-accent: #062028;

  --warm: #f9a34b;
  --warm-soft: #f9a34b;

  --tint: rgba(70, 202, 195, 0.10);
  --tint-warm: rgba(249, 163, 75, 0.12);
  --glow: rgba(70, 202, 195, 0.26);
  --shadow: 0 22px 60px -28px rgba(0, 0, 0, 0.75);
  --code-bg: #0a1c26;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
code, .mono { font-family: var(--mono); }
code { background: var(--code-bg); border-radius: 5px; padding: 1px 6px; font-size: 0.92em; }

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

/* ---- nav ---- */
header.site {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; flex: none; }
.brand .mark { height: 40px; width: auto; display: block; }
.brand .wordmark {
  font-size: 21px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text);
}

nav.primary { display: flex; align-items: center; gap: 24px; }
nav.primary a:not(.btn) {
  text-decoration: none; color: var(--text-muted);
  font-size: 14.5px; font-weight: 500; transition: color .15s;
}
nav.primary a:not(.btn):hover { color: var(--text); }

/* ---- theme toggle ---- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none; padding: 0;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 9px;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover {
  color: var(--accent); border-color: var(--border-strong);
  background: var(--tint);
}
.theme-toggle svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
/* Show the icon for the theme you'd switch *to*: a sun while dark, a moon
   while light. Both branches are spelled out for each theme state. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 8px; font-size: 14.5px; font-weight: 600;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  font-family: var(--sans); transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hot); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--tint); }
.btn .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---- hero ---- */
.hero {
  padding: 92px 0 84px; text-align: center;
  position: relative; overflow: hidden; border-top: none;
}
.hero::before {
  content: ""; position: absolute; inset: -45% -10% auto -10%; height: 540px;
  background: radial-gradient(ellipse at center, var(--glow), transparent 65%);
  pointer-events: none;
}
.hero .hero-mark {
  height: 132px; width: auto; margin: 0 auto 26px;
  display: block; position: relative;
  filter: drop-shadow(0 14px 30px rgba(16, 48, 61, 0.22));
}
.hero h1 {
  font-size: clamp(36px, 5.4vw, 60px); font-weight: 800; letter-spacing: -0.035em;
  margin: 0 0 18px; position: relative; line-height: 1.08;
}
.hero h1 .accent { color: var(--accent); }
.hero p.lede {
  max-width: 660px; margin: 0 auto 34px; color: var(--text-muted);
  font-size: 18.5px; position: relative;
}
.hero-ctas {
  display: flex; gap: 14px; justify-content: center;
  flex-wrap: wrap; position: relative;
}
.hero-ctas .btn { padding: 12px 26px; font-size: 15.5px; }

.badges {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 30px; flex-wrap: wrap; position: relative;
}
.badge {
  font-family: var(--mono); font-size: 12px; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 100px; padding: 4px 13px;
  background: var(--surface);
}
.badge strong { color: var(--accent); font-weight: 600; }

/* ---- section shell ---- */
section { padding: 88px 0; border-top: 1px solid var(--border); }
section.tinted { background: var(--bg-alt); }
.eyebrow {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent);
  letter-spacing: 2px; text-transform: uppercase; margin: 0 0 12px;
}
h2.section-title {
  font-size: clamp(27px, 3.4vw, 37px); font-weight: 800;
  letter-spacing: -0.02em; margin: 0 0 14px;
}
p.section-sub {
  color: var(--text-muted); max-width: 660px;
  font-size: 16.5px; margin: 0 0 48px;
}
.section-head { text-align: center; margin: 0 auto; max-width: 740px; }
.section-head p.section-sub { margin-left: auto; margin-right: auto; }
main > section[id] { scroll-margin-top: 86px; }

/* ---- feature grid ---- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px;
}
.card .icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tint); color: var(--accent);
  margin-bottom: 16px;
}
.card .icon svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.card.warm .icon { background: var(--tint-warm); color: var(--warm); }
.card h3 { font-size: 17px; margin: 0 0 8px; }
.card p { color: var(--text-muted); font-size: 14.5px; margin: 0; }

/* ---- screenshots ---- */
/* align-items: start so the portrait phone card doesn't stretch the
   landscape card beside it into a block of empty white. */
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.shot {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.shot img { display: block; width: 100%; height: auto; border-bottom: 1px solid var(--border); }
/* The phone capture is only 500px wide -- stretching it to a full grid
   cell just makes it soft, so cap it and centre it in the card instead. */
.shot.narrow { display: flex; flex-direction: column; align-items: center; }
.shot.narrow img { max-width: 340px; }
.shot.narrow .cap { width: 100%; border-top: 1px solid var(--border); }
.shot .cap { padding: 15px 18px; }
.shot .cap h4 { margin: 0 0 4px; font-size: 14.5px; }
.shot .cap p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.shot-note {
  text-align: center; color: var(--text-faint); font-size: 13.5px;
  margin: 28px auto 0; max-width: 640px; font-family: var(--mono);
}

/* ---- architecture ---- */
.flow {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0; align-items: stretch; margin-bottom: 40px;
}
.flow .node {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px; text-align: center;
}
.flow .node.mid { border-color: var(--accent); background: var(--tint); }
.flow .node h4 { margin: 0 0 6px; font-size: 15.5px; }
.flow .node .sub { color: var(--text-muted); font-size: 13px; margin: 0; }
.flow .node .tag {
  display: block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 9px;
}
.flow .arrow {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 0 14px; min-width: 132px;
}
.flow .arrow .label {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  text-align: center; margin-bottom: 6px; line-height: 1.35;
}
.flow .arrow .line {
  width: 100%; height: 1px; background: var(--border-strong); position: relative;
}
.flow .arrow .line::after {
  content: ""; position: absolute; right: 0; top: -3px;
  border-left: 6px solid var(--border-strong);
  border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
}

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 52px; align-items: start; }
.twocol h3 { font-size: 20px; margin: 0 0 12px; }
.twocol p { color: var(--text-muted); font-size: 15.5px; margin: 0 0 14px; }
ul.checks { list-style: none; padding: 0; margin: 18px 0 0; }
ul.checks li {
  padding-left: 27px; position: relative; margin-bottom: 11px;
  color: var(--text-muted); font-size: 15px;
}
ul.checks li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}

/* ---- stack table ---- */
table.stack { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.stack th {
  text-align: left; color: var(--text-faint); font-weight: 600; font-size: 12px;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 0 12px; border-bottom: 1px solid var(--border);
}
table.stack td { padding: 15px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.stack td:first-child {
  font-family: var(--mono); color: var(--accent);
  white-space: nowrap; padding-right: 24px;
}
table.stack td:nth-child(2) {
  color: var(--text); white-space: nowrap;
  padding-right: 24px; font-weight: 600;
}
table.stack td:last-child { color: var(--text-muted); }
.table-scroll { overflow-x: auto; }

/* ---- license band ---- */
.license-band {
  background: linear-gradient(135deg, var(--tint), transparent 70%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px; display: flex; align-items: center; gap: 32px;
  justify-content: space-between; flex-wrap: wrap;
}
.license-band h3 { margin: 0 0 8px; font-size: 20px; }
.license-band p { margin: 0; color: var(--text-muted); font-size: 15px; max-width: 540px; }

/* ---- prose ---- */
.prose { max-width: 780px; margin: 0 auto; }
.prose h2 {
  font-size: clamp(24px, 3vw, 32px); font-weight: 800;
  letter-spacing: -0.02em; margin: 0 0 24px;
}
.prose p { color: var(--text-muted); font-size: 16.5px; margin: 0 0 20px; }
.prose p strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote {
  margin: 32px 0; padding: 4px 0 4px 22px;
  border-left: 2px solid var(--accent);
  color: var(--text); font-size: 18px; font-style: normal;
}

/* ---- footer ---- */
footer { border-top: 1px solid var(--border); padding: 46px 0; background: var(--bg-alt); }
footer .wrap {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 24px;
}
footer .brand { margin-bottom: 12px; }
footer .brand .mark { height: 36px; }
footer .copy { color: var(--text-faint); font-size: 12.5px; margin-top: 8px; max-width: 420px; }
footer .copy a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
footer .copy a:hover { color: var(--accent); }
footer .links { display: flex; gap: 22px; font-size: 13.5px; color: var(--text-faint); flex-wrap: wrap; }
footer .links a { text-decoration: none; }
footer .links a:hover { color: var(--accent); }

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

@media (max-width: 900px) {
  .flow { grid-template-columns: 1fr; }
  .flow .arrow { min-width: 0; padding: 14px 0; flex-direction: row; gap: 12px; }
  .flow .arrow .label { margin-bottom: 0; }
  .flow .arrow .line { width: 1px; height: 26px; }
  .flow .arrow .line::after {
    right: -3px; top: auto; bottom: 0;
    border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
    border-top: 6px solid var(--border-strong); border-bottom: none;
  }
}
@media (max-width: 860px) {
  nav.primary a.hide-mobile { display: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .twocol { grid-template-columns: 1fr; gap: 32px; }
  .shots { grid-template-columns: 1fr; }
  section { padding: 64px 0; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  nav.primary { gap: 12px; }
  .license-band { padding: 26px; }
  .hero { padding: 64px 0 56px; }
  footer .wrap { flex-direction: column; }
}
