/* marginvat.com: one shared stylesheet. Rules: apps/product/DESIGN.md (outside Shopify: full premium treatment). */
:root {
  --deep: #0c3b2e;
  --green: #13795b;
  --mint: #34d399;
  --sky: #38bdf8;
  --sun: #fbbf24;
  --ink: #0b1f17;
  --muted: #4d6058;
  --surface: #ffffff;
  --page: #f7faf8;
  --tint: #ecfdf5;
  --hairline: rgba(12, 59, 46, 0.09);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --shadow: 0 30px 60px -32px rgba(12, 59, 46, 0.32), 0 2px 8px -4px rgba(12, 59, 46, 0.08);
  --radius: 28px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eaf4ef;
    --muted: #9db3aa;
    --surface: #0f1915;
    --page: #08110d;
    --tint: rgba(52, 211, 153, 0.1);
    --hairline: rgba(234, 244, 239, 0.1);
    --shadow: 0 30px 60px -32px rgba(0, 0, 0, 0.7);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* Soft colour glows, fixed so they never repaint while scrolling. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40rem 30rem at 85% -10%, rgba(52, 211, 153, 0.22), transparent 70%),
    radial-gradient(36rem 26rem at -10% 30%, rgba(56, 189, 248, 0.14), transparent 70%);
}
a { color: var(--green); }
@media (prefers-color-scheme: dark) { a { color: var(--mint); } }
img, svg { display: block; max-width: 100%; }
.wrap { width: min(1080px, 100% - 32px); margin: 0 auto; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; line-height: 1.08; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif; }
h1 { font-size: clamp(2.4rem, 6vw, 4.1rem); font-weight: 750; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 720; }
h3 { font-size: 1.2rem; font-weight: 680; letter-spacing: -0.015em; }
p { margin: 0; }
.lead { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.55; color: var(--muted); max-width: 40rem; }
.muted { color: var(--muted); }
.eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--tint);
  box-shadow: inset 0 0 0 1px var(--hairline);
  justify-self: start;
}
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--mint); } }

/* ---------- Floating island nav ---------- */
.nav {
  position: sticky;
  top: 14px;
  z-index: 10;
  width: min(1080px, 100% - 24px);
  margin: 14px auto 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  box-shadow: inset 0 0 0 1px var(--hairline), 0 12px 30px -20px rgba(12, 59, 46, 0.4);
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 750; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--deep), var(--mint)); display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; }
.nav-links { display: flex; gap: 18px; margin-left: auto; font-size: 15px; }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 900px) { .nav-links .hide-md { display: none; } }
@media (max-width: 640px) { .nav-links .hide-sm { display: none; } .nav { gap: 10px; } }

/* ---------- Buttons: pill with a nested arrow ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, var(--deep), var(--green));
  box-shadow: 0 14px 30px -14px rgba(19, 121, 91, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-decoration: none;
  cursor: pointer;
  transition: transform 500ms var(--ease), box-shadow 500ms var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn .arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  transition: transform 500ms var(--ease);
}
.btn:hover .arrow { transform: translate(2px, -1px) scale(1.05); }
.btn-ghost { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow); }
.btn-ghost .arrow { background: var(--tint); color: var(--green); }
.btn-sm { padding: 6px 6px 6px 16px; font-size: 14px; }
.btn-sm .arrow { width: 26px; height: 26px; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--mint) 60%, transparent); outline-offset: 2px; }

/* ---------- Sections ---------- */
/* Section rhythm: neighbouring sections share their padding, so keep each side modest (Luke, 11 Oct: gaps too big). */
section { padding: clamp(36px, 4.5vw, 56px) 0; }
.section-head { display: grid; gap: 14px; max-width: 44rem; margin-bottom: 32px; }
.hero { padding-top: clamp(44px, 6.5vw, 84px); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.hero h1 { margin: 18px 0 18px; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

/* ---------- Double-bezel cards ---------- */
.shell { padding: 6px; border-radius: var(--radius); background: color-mix(in srgb, var(--green) 7%, transparent); box-shadow: inset 0 0 0 1px var(--hairline); }
.core { border-radius: calc(var(--radius) - 6px); background: var(--surface); padding: clamp(20px, 3vw, 32px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), var(--shadow); }
.core-dark {
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(52, 211, 153, 0.5), transparent 55%),
    radial-gradient(80% 90% at 0% 100%, rgba(56, 189, 248, 0.25), transparent 60%),
    linear-gradient(135deg, var(--deep), var(--green));
}
.core-dark .muted { color: rgba(255, 255, 255, 0.8); }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.bento > * { grid-column: span 2; }
.bento > .wide { grid-column: span 4; }
.bento > .half { grid-column: span 3; }
.feature { display: grid; gap: 10px; align-content: start; }
.feature-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: var(--green); background: var(--tint); }
@media (prefers-color-scheme: dark) { .feature-icon { color: var(--mint); } }
@media (max-width: 860px) { .bento > *, .bento > .wide, .bento > .half { grid-column: span 6; } }

/* ---------- Worked sums ---------- */
.sum { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sum td { padding: 9px 0; border-top: 1px solid var(--hairline); }
.sum tr:first-child td { border-top: 0; }
.sum td:last-child { text-align: right; font-weight: 650; white-space: nowrap; padding-left: 16px; }
.sum .total td { font-weight: 750; font-size: 1.05em; border-top: 2px solid var(--ink); }
.sum .note { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.core-dark .sum td { border-color: rgba(255, 255, 255, 0.18); }
.core-dark .sum .total td { border-color: #fff; }
.core-dark .sum .note { color: rgba(255, 255, 255, 0.75); }
.why { padding: 14px 16px; border-radius: 16px; background: var(--tint); font-size: 15px; }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: s; }
.step { counter-increment: s; display: grid; gap: 8px; }
.step::before {
  content: counter(s);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--mint));
}
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.input-row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="email"], input[type="number"], input[type="text"], input[type="date"], textarea, select {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  color: var(--ink);
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 400; color: var(--muted); }
.check input { margin-top: 4px; accent-color: var(--green); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { font-size: 15px; font-weight: 600; min-height: 1.4em; }
.form-msg:empty { min-height: 0; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: #b42318; }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--page); box-shadow: inset 0 0 0 1px var(--hairline); }
.segmented button { border: 0; padding: 7px 16px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: none; cursor: pointer; transition: background 400ms var(--ease), color 400ms var(--ease); }
.segmented button[aria-pressed="true"] { color: #fff; background: var(--green); }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; }
.faq details { border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); padding: 18px 22px; }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--green); font-weight: 700; transition: transform 400ms var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: 10px; color: var(--muted); }

/* ---------- Prose (privacy, support) ---------- */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.5rem; margin: 40px 0 12px; }
.prose p, .prose li { color: var(--muted); }
.prose p + p { margin-top: 12px; }
.prose ul { padding-left: 1.2rem; }
.draft-banner { padding: 14px 18px; border-radius: 16px; background: #fff7e6; color: #7a4b00; font-weight: 600; }

/* ---------- Footer ---------- */
footer { padding: 48px 0 64px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; }
.footer-row a { color: var(--muted); text-decoration: none; }
.footer-row a:hover { color: var(--ink); }
.footer-legal { margin-top: 18px; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ---------- Scroll reveal ----------
   Content is visible by default (search engines, slow connections). site.js only hides what's below the fold,
   then fades it in as it scrolls into view. */
.reveal { transition: opacity 900ms var(--ease), transform 900ms var(--ease), filter 900ms var(--ease); }
.reveal.pending { opacity: 0; transform: translateY(24px); filter: blur(6px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal.pending { opacity: 1; transform: none; filter: none; transition: none; }
  .btn, .btn .arrow { transition: none; }
}

/* ---------- 404: a stock book card for the missing page ---------- */
.lost { min-height: 72vh; display: grid; align-items: center; }
.lost-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.lost-card { position: relative; overflow: hidden; display: grid; gap: 14px; transform: rotate(-1.5deg); transition: transform 900ms var(--ease); }
.lost-card:hover { transform: rotate(0deg); }
.lost-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lost-no { font-weight: 750; letter-spacing: -0.01em; }
.lost-badge { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; color: #7a4b00; background: #fff4dc; box-shadow: inset 0 0 0 1px rgba(122, 75, 0, 0.12); }
.lost-title { font-size: 1.25rem; font-weight: 680; letter-spacing: -0.015em; }
.lost-digits {
  position: absolute;
  right: -10px;
  bottom: -42px;
  z-index: 0;
  font-size: 9rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  pointer-events: none;
  background: linear-gradient(135deg, var(--mint), var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.22;
}
.lost-card .sum { position: relative; z-index: 1; }
@media (max-width: 860px) { .lost { min-height: 0; } .lost-card { transform: none; } }
@media (prefers-reduced-motion: reduce) { .lost-card, .lost-card:hover { transform: none; transition: none; } }

/* ---------- Free tools: forms in groups ---------- */
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.group { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.group + .group { padding-top: 18px; border-top: 1px solid var(--hairline); }
.group legend { padding: 0; margin-bottom: 4px; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); }
@media (prefers-color-scheme: dark) { .group legend { color: var(--mint); } }
.hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }

/* ---------- Invoice template: a sheet of paper that builds as you type ---------- */
.invoice-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 32px; align-items: start; }
.invoice-side { display: grid; gap: 18px; position: sticky; top: 92px; }
@media (max-width: 920px) { .invoice-grid { grid-template-columns: 1fr; } .invoice-side { position: static; } }
.paper {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 4vw, 40px);
  border-radius: 6px;
  color: #1a1a1a;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 40px 70px -40px rgba(12, 59, 46, 0.45), 0 2px 6px rgba(12, 59, 46, 0.08), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.paper-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-bottom: 18px; border-bottom: 3px solid #13795b; }
.paper-title { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; color: #0c3b2e; }
.paper-seller { font-size: 1.1rem; font-weight: 700; }
.paper-lines { white-space: pre-line; color: #555; }
.paper-label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #13795b; }
.paper-strong { font-weight: 650; }
.paper-meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.paper-meta dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; align-content: start; }
.paper-meta dt { color: #555; }
.paper-meta dd { margin: 0; font-weight: 650; text-align: right; }
.paper-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paper-table th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #555; padding: 9px 10px; background: #f2f7f4; }
.paper-table td { padding: 11px 10px; border-bottom: 1px solid #e6ebe8; vertical-align: top; }
.paper-table .num { text-align: right; white-space: nowrap; }
.paper-table tfoot td { border-bottom: 0; font-weight: 750; font-size: 1.05rem; padding-top: 14px; }
.paper-scheme { justify-self: start; padding: 8px 12px; border-radius: 6px; font-weight: 650; color: #0c3b2e; background: #ecfdf5; box-shadow: inset 0 0 0 1px rgba(19, 121, 91, 0.2); }
.paper-foot { font-size: 12px; color: #666; }
.invoice-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }
.checklist li { display: flex; gap: 10px; align-items: center; color: var(--muted); transition: color 400ms var(--ease); }
.checklist li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--hairline); transition: background 400ms var(--ease), box-shadow 400ms var(--ease); }
.checklist li.done { color: var(--ink); }
.checklist li.done::before { box-shadow: none; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat; }

/* ---------- Stock book template: sample table ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sheet { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.sheet th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 10px 12px; background: var(--tint); white-space: nowrap; }
.sheet th.sale { background: color-mix(in srgb, var(--sky) 14%, transparent); }
.sheet th.sum-col { background: color-mix(in srgb, var(--sun) 22%, transparent); }
.sheet td { padding: 10px 12px; border-top: 1px solid var(--hairline); white-space: nowrap; }
.sheet .num { text-align: right; }
.sheet .muted-cell { color: var(--muted); }
.legend-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.legend-row span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 8px; vertical-align: -1px; background: var(--tint); }
.legend-row .sale::before { background: color-mix(in srgb, var(--sky) 30%, transparent); }
.legend-row .sum-col::before { background: color-mix(in srgb, var(--sun) 40%, transparent); }
.columns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 28px; margin: 0; padding: 0; list-style: none; }
.columns li { display: grid; gap: 2px; }
.columns b { font-weight: 650; }
.columns span { color: var(--muted); font-size: 15px; }
@media (max-width: 760px) { .columns { grid-template-columns: 1fr; } }

/* ---------- Guide: numbered steps ---------- */
.guide-step { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.guide-step h3 { margin-bottom: 8px; }
.guide-no { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; color: #fff; background: linear-gradient(135deg, var(--green), var(--mint)); }
@media (max-width: 480px) { .guide-step { grid-template-columns: 1fr; } }

/* ---------- Printing: only the invoice sheet ---------- */
@media print {
  body { background: #fff; }
  body::before, .no-print, .nav, footer { display: none !important; }
  section { padding: 0 !important; }
  .wrap { width: 100%; }
  .invoice-grid { display: block; }
  .invoice-side { position: static; display: block; }
  .paper { box-shadow: none; padding: 0; border-radius: 0; }
  .reveal, .reveal.pending { opacity: 1 !important; transform: none !important; filter: none !important; }
}
