/*
 * Invoice Builder landing. Palette and type follow the extension's
 * "Emerald Prestige" tokens (apps/extension/src/styles/theme.css).
 * The invoice "paper" is set in IBM Plex Mono so it reads as a document.
 */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./assets/fonts/Manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./assets/fonts/Manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116, U+20BD;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/PlexMono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/PlexMono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/PlexMono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/PlexMono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f7f6f1;
  --surface: #ffffff;
  --text: #17302a;
  --text-muted: #5d6f68;
  --primary: #064e3b;
  --primary-fg: #f5f0e0;
  --accent: #0d7a5f;
  --gold: #c9a84c;
  --gold-soft: #f1e6bf;
  --border: #dfe3dc;
  --band: #064e3b;
  --band-text: #eef2ea;
  --band-muted: #a9c2b7;
  --focus: #0d7a5f;

  --paper: #fffef9;
  --paper-text: #1d2a26;
  --paper-muted: #6c7a74;
  --paper-rule: #d9d6c8;

  --font-body: "Manrope", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-doc: "Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --radius: 8px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12211d;
    --surface: #1a2c27;
    --text: #eef2ea;
    --text-muted: #a3b3ac;
    --primary: #38a983;
    --primary-fg: #0e1c18;
    --accent: #38a983;
    --border: rgb(255 255 255 / 12%);
    --band: #0b1a16;
    --focus: #5fd0a9;
    color-scheme: dark;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

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

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

a {
  color: inherit;
}

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

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn--primary {
  background: var(--primary);
  color: var(--primary-fg);
}

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

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

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

.btn--sm {
  min-height: 40px;
  padding: 0 18px;
  font-size: 0.9375rem;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a:not(.btn) {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
}

.site-nav a:not(.btn):hover {
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(40px, 7vw, 96px) clamp(56px, 8vw, 112px);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 14fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero__title {
  font-size: clamp(2.25rem, 3.9vw, 3.5rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero__lead {
  max-width: 34em;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 1.125rem;
}

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

/* ---------- Live demo ---------- */

.demo {
  position: relative;
  padding: 20px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 14px;
}

.demo__bar {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 3.5ch;
  align-items: center;
  gap: 16px;
  padding: 4px 4px 18px;
  font-weight: 600;
}

.demo__bar output {
  font-family: var(--font-doc);
  font-weight: 500;
  text-align: right;
}

.demo__range {
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent);
}

.demo__panes {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: 16px;
  align-items: stretch;
}

.cart {
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pane-title {
  margin-bottom: 12px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-muted);
}

.cart__list {
  display: grid;
  gap: 12px;
}

.cart__item {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.4;
}

.cart__item-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--font-doc);
  font-size: 0.8125rem;
}

.cart__sums {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 0.875rem;
}

.cart__sums > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cart__sums dd {
  font-family: var(--font-doc);
  font-weight: 500;
}

.cart__gain {
  color: var(--accent);
  font-weight: 700;
}

.cart__gain dd {
  font-weight: 500;
}

.cart__fx {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* The invoice stays a white sheet in both themes: it is a printed document. */
.paper {
  align-self: start;
  position: relative;
  padding: 20px 20px 16px;
  background: var(--paper);
  color: var(--paper-text);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgb(23 48 42 / 10%), 0 18px 36px -20px rgb(23 48 42 / 45%);
  font-family: var(--font-doc);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.paper__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--paper-text);
}

.paper__title {
  font-size: 0.9375rem;
  font-weight: 500;
}

.paper__who {
  margin-top: 10px;
  color: var(--paper-muted);
}

.paper__who b {
  color: var(--paper-text);
  font-weight: 500;
}

.paper table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
}

.paper th {
  padding: 0 0 6px;
  border-bottom: 1px solid var(--paper-rule);
  color: var(--paper-muted);
  font-weight: 400;
  text-align: left;
}

.paper td {
  padding: 8px 0;
  border-bottom: 1px dashed var(--paper-rule);
  vertical-align: top;
}

.paper .num {
  padding-left: 10px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.paper__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--gold-soft);
  border-left: 4px solid var(--gold);
  font-weight: 500;
}

.paper__total output {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.paper__note {
  margin-top: 10px;
  color: var(--paper-muted);
  font-size: 0.75rem;
}

/* One orchestrated moment: the cart lines land on the invoice in order. */
@media (prefers-reduced-motion: no-preference) {
  .demo.is-seq .cart__item,
  .demo.is-seq .paper tbody tr,
  .demo.is-seq .paper__total {
    animation: land 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 140ms + 200ms);
  }

  .demo.is-seq .paper tbody tr {
    animation-delay: calc(var(--i, 0) * 140ms + 700ms);
  }

  .demo.is-seq .paper__total {
    animation-delay: 1300ms;
  }
}

@keyframes land {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(56px, 8vw, 112px);
  border-top: 1px solid var(--border);
}

.section .wrap {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(28px, 6vw, 88px);
}

.section__head {
  align-self: start;
  position: sticky;
  top: 96px;
}

.section__title {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.section__intro {
  margin-top: 16px;
  color: var(--text-muted);
  max-width: 28em;
}

.item-title {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.item-text {
  margin-top: 6px;
  max-width: 36em;
  color: var(--text-muted);
}

/* Steps: the content is a real sequence, so the numbers are kept. */
.steps {
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px 20px;
  padding-block: 28px;
  border-bottom: 1px solid var(--border);
}

.steps li:first-child {
  padding-top: 0;
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  color: var(--primary);
  font-family: var(--font-doc);
  font-weight: 500;
}

.steps li > .item-text {
  margin-top: 0;
}

.features {
  display: grid;
}

.features > div {
  padding-block: 28px;
  border-bottom: 1px solid var(--border);
}

.features > div:first-child {
  padding-top: 0;
}

.features dt {
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.features dd {
  margin-top: 6px;
  max-width: 36em;
  color: var(--text-muted);
}

/* ---------- Local-first band ---------- */

.band {
  background: var(--band);
  color: var(--band-text);
  border-top: 0;
}

.band .section__intro,
.band .item-text {
  color: var(--band-muted);
}

.band .features > div {
  border-color: rgb(255 255 255 / 14%);
}

.band .features dd {
  color: var(--band-muted);
}

.band .section__title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 20px;
  background: var(--gold);
}

/* ---------- FAQ ---------- */

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq details:first-child {
  border-top: 1px solid var(--border);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-block: 20px;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  font-family: var(--font-doc);
  font-weight: 400;
  transition: transform 0.2s, border-color 0.15s;
}

.faq details[open] summary::after {
  content: "−";
  border-color: var(--text);
}

.faq details p {
  max-width: 38em;
  padding-bottom: 22px;
  color: var(--text-muted);
}

/* ---------- Install ---------- */

.install {
  padding-block: clamp(64px, 9vw, 128px);
  background: var(--primary);
  color: var(--primary-fg);
}

.install .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.install__title {
  max-width: 14em;
  font-size: clamp(1.875rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.install__text {
  margin-top: 14px;
  max-width: 32em;
  opacity: 0.85;
}

.btn--gold {
  background: var(--gold);
  color: #2b2208;
}

.btn--gold:hover {
  background: #d8b95f;
}

@media (prefers-color-scheme: dark) {
  .install {
    background: #0f3a2e;
    color: #f5f0e0;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 32px 40px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
}

.site-footer a {
  color: inherit;
  text-underline-offset: 3px;
}

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

/* ---------- Flow strip ---------- */

.flow {
  padding-block: clamp(40px, 6vw, 72px);
  border-top: 1px solid var(--border);
}

.flow__steps,
.flow__phases {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: start;
  column-gap: clamp(4px, 1.5vw, 16px);
}

.flow__step {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.flow__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  color: var(--primary);
}

.flow__step--order .flow__icon {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: #5a4a12;
}

.flow__icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow__name {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.flow__sub {
  max-width: 16em;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.flow__arrow {
  display: grid;
  place-items: center;
  height: 64px;
  color: var(--text-muted);
}

.flow__arrow svg {
  width: 28px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow__phases {
  margin-top: 28px;
}

.flow__phase {
  padding-top: 10px;
  border-top: 2px solid var(--primary);
  color: var(--text-muted);
  font-family: var(--font-doc);
  font-size: 0.8125rem;
  text-align: center;
}

.flow__phase--before {
  grid-column: 1 / 6;
}

.flow__phase--after {
  grid-column: 7;
  border-top-color: var(--gold);
}

@media (prefers-color-scheme: dark) {
  .flow__step--order .flow__icon {
    background: transparent;
    color: var(--gold);
  }
}

@media (max-width: 720px) {
  .flow__steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow__arrow,
  .flow__phases {
    display: none;
  }

  .flow__step {
    grid-template-columns: 64px minmax(0, 1fr);
    justify-items: start;
    column-gap: 16px;
    padding-bottom: 20px;
    text-align: left;
  }

  .flow__step:last-child {
    padding-bottom: 0;
  }

  .flow__icon {
    grid-row: span 2;
    margin-bottom: 0;
  }

  .flow__step:not(:last-child) .flow__icon::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    width: 1.5px;
    height: 20px;
    background: var(--border);
  }

  .flow__name {
    align-self: end;
  }

  .flow__sub {
    align-self: start;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero .wrap,
  .section .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .section__head {
    position: static;
  }
}

@media (max-width: 640px) {
  .site-nav a:not(.btn) {
    display: none;
  }

  .demo {
    padding: 12px;
  }

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

  .steps li {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 6px 14px;
  }
}
