/*
 * Mail Mario marketing site.
 * Palette is postal: navy ink, airmail blue and red, cool paper.
 * Red is reserved for "stopped / paused" moments and the airmail stripe.
 */
:root {
  --paper: #f4f6fa;
  --surface: #ffffff;
  --tint: #e9eef8;
  --line: #d9dee8;
  --ink: #111c33;
  --ink-2: #1c2a48;
  --muted: #56607a;
  --blue: #2f5bea;
  --blue-strong: #2148c9;
  --blue-soft: #e4ebfd;
  --red: #d6402f;
  --green: #16855a;
  --green-soft: #e1f3ea;

  --font:
    "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --page: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --section-y: clamp(4rem, 9vw, 7.5rem);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

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

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------------------------------------------------------------- airmail stripe */

.airmail {
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 14px,
    var(--paper) 14px 20px,
    var(--blue) 20px 34px,
    var(--paper) 34px 40px
  );
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(244 246 250 / 0.88);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  height: 4rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 20px;
}

.mark-body {
  fill: var(--ink);
}

.mark-flap {
  fill: none;
  stroke: var(--paper);
  stroke-width: 2;
  stroke-linejoin: round;
}

.nav {
  display: flex;
  gap: 1.75rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.nav a {
  text-decoration: none;
}

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

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.link-quiet {
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.link-quiet:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.btn-sm {
  min-height: 2.5rem;
  padding: 0 1rem;
  font-size: 0.9375rem;
}

.btn-lg {
  min-height: 3.5rem;
  padding: 0 1.75rem;
  font-size: 1.0625rem;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-strong);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
}

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

.btn-ghost-inverse {
  border-color: rgb(255 255 255 / 0.3);
  color: #fff;
}

.btn-ghost-inverse:hover {
  border-color: #fff;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------------------------------------------------------------- hero */

.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 var(--section-y);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.75rem, 6.4vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 800;
  text-wrap: balance;
}

.lede {
  margin-top: 1.75rem;
  max-width: 34rem;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  color: var(--muted);
}

.hero .cta-row {
  margin-top: 2.25rem;
}

.fineprint {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------- hero demo */

.demo figcaption {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 30rem;
}

.demo-window {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 rgb(17 28 51 / 0.04),
    0 24px 60px -24px rgb(17 28 51 / 0.28);
  overflow: hidden;
  font-size: 0.875rem;
}

.demo-chrome {
  display: flex;
  gap: 6px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.demo-chrome span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.demo-body {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
}

.demo-side {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 0.6rem;
  background: var(--paper);
  border-right: 1px solid var(--line);
  color: var(--muted);
}

.side-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
}

.side-item.is-active {
  background: var(--blue-soft);
  color: var(--ink);
  font-weight: 600;
}

.count-a {
  display: none;
}

.count {
  position: relative;
  font-weight: 700;
  color: var(--blue);
}

.demo-main {
  padding: 0.9rem 1rem 1.1rem;
  min-width: 0;
}

.demo-pane-title {
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0 0.25rem 0.4rem;
}

.demo-pane-title + .mail-list,
.demo-pane-title + .seq-list {
  margin-bottom: 1rem;
}

.demo-main > :last-child {
  margin-bottom: 0;
}

.mail {
  display: grid;
  grid-template-columns: 8px 7.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--line);
}

.mail:last-child {
  border-bottom: 1px solid var(--line);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.is-read .dot {
  background: transparent;
}

.mail-from {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-read .mail-from {
  font-weight: 400;
}

.mail-subj {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-time {
  color: var(--muted);
  font-size: 0.8125rem;
}

.mail-new {
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
}

.seq {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--line);
}

.seq-name {
  font-weight: 600;
  white-space: nowrap;
}

.seq-state {
  display: grid;
  justify-items: end;
  text-align: right;
}

.state {
  grid-area: 1 / 1;
  color: var(--muted);
  font-size: 0.8125rem;
}

.state-b {
  color: var(--red);
  font-weight: 600;
}

.state-a {
  visibility: hidden;
}

/*
 * The one orchestrated moment: a reply arrives, then the sequence stops.
 * Without motion (or with reduced motion) the final state is shown as-is.
 */
@media (prefers-reduced-motion: no-preference) {
  .mail-new {
    animation: mail-arrive 700ms cubic-bezier(0.2, 0.8, 0.2, 1) 1.1s both;
  }

  .count-a {
    display: inline-block;
    position: absolute;
    right: 0;
    animation: fade-out 1ms linear 1.4s both;
  }

  .count-b {
    animation: fade-in 1ms linear 1.4s both;
  }

  .state-a {
    visibility: visible;
    animation: fade-out 300ms ease 2.4s both;
  }

  .state-b {
    animation: fade-in 300ms ease 2.6s both;
  }

  .seq-live {
    animation: flash 1.4s ease 2.5s both;
  }
}

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

@keyframes mail-arrive {
  from {
    opacity: 0;
    transform: translateY(-10px);
    background: var(--surface);
  }
  60% {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes flash {
  0%,
  100% {
    background: transparent;
  }
  25% {
    background: #fbe9e6;
  }
}

/* ---------------------------------------------------------------- sections */

.section {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--line);
}

.section h2,
.closing h2 {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 800;
  text-wrap: balance;
}

.section-head {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head p,
.split-head p,
.rails-head p {
  margin-top: 1.25rem;
  color: var(--muted);
  max-width: 38rem;
}

.section h3 {
  font-size: 1.125rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.section h3 + p,
.feature-list dd {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 1rem;
}

.section-tint {
  background: var(--tint);
}

/* split: heading left, points right */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
}

.split-head {
  position: sticky;
  top: 6rem;
  align-self: start;
}

.points li {
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
}

.points li:first-child {
  border-top: 0;
  padding-top: 0.5rem;
}

.points em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- guard rails (dark) */

.section-ink {
  --muted: #aab4cc;
  background: var(--ink);
  color: #fff;
  border-top: 0;
}

.rails-head {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.rails-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.rail {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--ink-2);
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: var(--radius-lg);
}

.rail > h3 + p {
  max-width: 30rem;
}

.ramp {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 2rem;
}

.ramp .bar {
  fill: #3d5fd6;
}

.ramp .bar-cap {
  fill: #7d9bff;
}

.ramp-cap {
  stroke: rgb(255 255 255 / 0.35);
  stroke-dasharray: 3 4;
}

.ramp-axis {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  color: #8e99b3;
}

.meter {
  margin-top: 1.75rem;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.meter-row span:last-child {
  color: #ffb4a8;
}

.meter-track {
  position: relative;
  height: 10px;
  margin-top: 0.6rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
}

.meter-ours {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--at);
  border-radius: 999px;
  background: var(--red);
}

.meter-ses {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: calc(var(--at) - 2px);
  width: 2px;
  background: rgb(255 255 255 / 0.6);
}

.meter-note {
  margin-top: 0.4rem;
  text-align: right;
  font-size: 0.8125rem;
  color: #8e99b3;
}

.rail-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgb(255 255 255 / 0.12);
}

/* ---------------------------------------------------------------- feature list */

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2rem, 6vw, 5rem);
}

.feature-list > div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.35rem 0;
  border-top: 1px solid var(--line);
}

.feature-list dt {
  font-weight: 700;
}

.feature-list dd {
  margin-top: 0;
}

/* ---------------------------------------------------------------- steps */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding-top: 1.25rem;
  border-top: 3px solid var(--ink);
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 0.9rem;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--blue);
}

/* ---------------------------------------------------------------- closing */

.closing {
  background: var(--ink);
  color: #fff;
  padding: var(--section-y) 0;
}

.closing-inner {
  display: grid;
  gap: 2.25rem;
  justify-items: start;
}

.closing h2 {
  max-width: 48rem;
}

/* ---------------------------------------------------------------- footer */

.footer {
  background: var(--ink);
  color: #aab4cc;
  font-size: 0.9375rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  padding-top: 1.75rem;
  padding-bottom: 2rem;
  border-top: 1px solid rgb(255 255 255 / 0.12);
}

.brand-small {
  color: #fff;
  font-size: 1rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-nav a {
  text-decoration: none;
}

.footer-nav a:hover {
  color: #fff;
}

.footer-copy {
  margin-left: auto;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1000px) {
  .hero-inner,
  .split,
  .rails-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .split-head {
    position: static;
  }

  .rail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 2.5rem;
  }

  .feature-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .nav,
  .link-quiet {
    display: none;
  }

  .demo-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .demo-side {
    display: none;
  }

  .mail {
    grid-template-columns: 8px 6rem minmax(0, 1fr) auto;
  }

  .feature-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }
}

@media (max-width: 520px) {
  .rail-list,
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .mail {
    grid-template-columns: 8px minmax(0, 1fr) auto;
  }

  .mail-subj {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .seq {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .seq-state {
    justify-items: start;
    text-align: left;
  }

  .cta-row .btn {
    flex: 1 1 100%;
  }

  .footer-copy {
    margin-left: 0;
  }
}
