/* ==========================================================================
   Invoaro design system
   A restrained, original visual language: deep teal-green brand color,
   warm-neutral paper background, system font stack (no external font
   requests), utility classes for layout, and shared component styles used
   across the marketing site and the invoice generator.
   ========================================================================== */

:root {
  /* Brand */
  --brand-600: #1e6f5c;
  --brand-500: #22876f;
  --brand-400: #3aa588;
  --brand-100: #e4f2ee;
  --brand-50: #f2f9f7;

  /* Ink / neutrals */
  --ink-900: #12181f;
  --ink-700: #3c4650;
  --ink-500: #6b7580;
  --ink-300: #9aa3ab;

  /* Paper */
  --paper-0: #ffffff;
  --paper-50: #f6f7f5;
  --paper-100: #ececea;
  --border: #e1e4e1;
  --border-strong: #c9cdc9;

  /* Status */
  --success: #1e7a4c;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --focus: #2563eb;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Layout */
  --content-max: 1180px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(18, 24, 31, 0.06);
  --shadow-md: 0 8px 24px rgba(18, 24, 31, 0.08);
  --shadow-lg: 0 20px 48px rgba(18, 24, 31, 0.14);
}

/* -------------------------------------------------------------------------
   Reset & base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--paper-50);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink-900);
}

h1 { font-size: clamp(2.1rem, 1.6rem + 2.2vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 var(--space-4); color: var(--ink-700); }

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { padding-left: 1.25em; color: var(--ink-700); }

label { font-weight: 600; font-size: 0.9rem; color: var(--ink-900); }

/* Visible, accessible focus state everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0; top: -48px;
  background: var(--ink-900);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

/* -------------------------------------------------------------------------
   Layout helpers
   ------------------------------------------------------------------------- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.section { padding-block: var(--space-8); }
.section--tight { padding-block: var(--space-6); }
.section--muted { background: var(--paper-0); border-block: 1px solid var(--border); }

.stack { display: flex; flex-direction: column; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: var(--space-3);
}

.text-muted { color: var(--ink-500); }
.text-center { text-align: center; }

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brand-600);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--brand-500); }

.btn--secondary {
  background: var(--paper-0);
  color: var(--ink-900);
  border-color: var(--border-strong);
}
.btn--secondary:hover { border-color: var(--brand-500); color: var(--brand-600); }

.btn--ghost {
  background: transparent;
  color: var(--ink-700);
}
.btn--ghost:hover { background: var(--paper-100); }

.btn--sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* -------------------------------------------------------------------------
   Header / navigation
   ------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-block: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 750;
  font-size: 1.2rem;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--brand-500), var(--brand-600));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.95rem;
}

.nav-primary {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.nav-primary a {
  color: var(--ink-700);
  font-weight: 550;
  font-size: 0.95rem;
}
.nav-primary a:hover { color: var(--brand-600); text-decoration: none; }
.nav-primary a[aria-current="page"] { color: var(--brand-600); }

.nav-actions { display: flex; align-items: center; gap: var(--space-3); }

.nav-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  background: var(--paper-0);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}

@media (max-width: 880px) {
  .nav-primary { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-header.is-open .nav-primary {
    display: flex;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: flex-start;
    background: var(--paper-0);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-5);
    gap: var(--space-4);
  }
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--paper-0);
  padding-block: var(--space-7);
  margin-top: var(--space-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-6);
}
@media (max-width: 780px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer-col h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  margin-bottom: var(--space-3);
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: var(--space-2); }
.footer-col a { color: var(--ink-700); }
.footer-bottom {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  color: var(--ink-500);
  font-size: 0.85rem;
}

/* -------------------------------------------------------------------------
   Cards / badges / forms (shared by marketing pages and the generator)
   ------------------------------------------------------------------------- */
.card {
  background: var(--paper-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.badge-row { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-700);
  background: var(--paper-0);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
}
.badge svg { width: 14px; height: 14px; color: var(--brand-600); flex: none; }

/* M10-B3 Phase 2A: a small "X% OFF" badge for /pricing's Invoaro Billing card, shown only when
   Commercial's own Plan.IsOnSale is true - reuses the existing --success color token rather than
   introducing a new one. */
.badge--sale {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  margin-bottom: var(--space-2);
}

.field { margin-bottom: var(--space-4); }
.field label { display: block; margin-bottom: var(--space-2); }
.field .hint { font-size: 0.8rem; color: var(--ink-500); margin-top: var(--space-1); }
.field .error { font-size: 0.82rem; color: var(--danger); margin-top: var(--space-1); }

.input, select.input, textarea.input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--paper-0);
  font: inherit;
  color: var(--ink-900);
}
.input:focus { border-color: var(--brand-500); }
.input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-bg); }

fieldset { border: 0; padding: 0; margin: 0 0 var(--space-6); }
legend {
  font-weight: 700;
  font-size: 1rem;
  padding: 0;
  margin-bottom: var(--space-4);
  color: var(--ink-900);
}

/* -------------------------------------------------------------------------
   Placeholder / "coming in this build" notice used for stub pages
   ------------------------------------------------------------------------- */
.build-note {
  border: 1px dashed var(--border-strong);
  background: var(--paper-0);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  color: var(--ink-500);
}

/* -------------------------------------------------------------------------
   Print
   ------------------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
}

/* -------------------------------------------------------------------------
   Invoice generator
   ------------------------------------------------------------------------- */
.generator-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-6);
  align-items: start;
  padding-bottom: var(--space-9);
}

@media (max-width: 980px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }
  .generator-preview .card {
    position: static !important;
  }
}

.item-row {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; padding-bottom: 0; }

@media (max-width: 640px) {
  .item-row {
    grid-template-columns: 1fr !important;
  }
  .item-row .remove-item { justify-self: start; }
}

output.item-amount {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

dialog {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop {
  background: rgba(18, 24, 31, 0.45);
}

/* -------------------------------------------------------------------------
   /invoice-templates — CSS-only mockup cards (not real PDF renders; colors
   match each PDF template's actual accent so the preview is honest).
   ------------------------------------------------------------------------- */
.template-card {
  display: flex;
  flex-direction: column;
}

.template-card .btn { margin-top: var(--space-4); }

.template-mock {
  height: 210px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-0);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow: hidden;
}

.template-mock__center-line {
  height: 10px;
  width: 45%;
  margin: 0 auto;
  background: var(--ink-300);
  border-radius: 2px;
}

.template-mock__rule {
  height: 2px;
  width: 60%;
  margin: 0 auto;
}
.template-mock__rule--dark { background: #1e1e1e; }

.template-mock__band {
  height: 34px;
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) 0;
  background: #2e5aac;
}

.template-mock__left-line {
  height: 10px;
  width: 40%;
  background: var(--ink-300);
  border-radius: 2px;
}

.template-mock__hairline { height: 1px; background: #bdbdbd; }

.template-mock__row { display: flex; justify-content: space-between; gap: var(--space-3); }
.template-mock__row span { display: block; height: 8px; border-radius: 2px; background: var(--paper-100); flex: 1; }
.template-mock__row--left { justify-content: flex-start; }
.template-mock__row--left span { flex: 0 0 auto; width: 38%; }
.template-mock__row--left span + span { width: 24%; }

.template-mock__table { display: flex; flex-direction: column; gap: var(--space-2); margin-top: auto; }
.template-mock__table span { display: block; height: 7px; border-radius: 2px; background: var(--paper-100); }
.template-mock__table span:first-child { background: var(--border-strong); }
.template-mock--minimal .template-mock__table span,
.template-mock__table--minimal span {
  background: var(--paper-50);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

/* Elegant: a restrained double accent rule and a bordered totals card (mirrors the PDF template's
   one bordered accent element, rather than a colored band or ruled underline). */
.template-mock__rule--accent { background: #8a6d3b; }

.template-mock__totals-card {
  margin-top: auto;
  align-self: flex-end;
  width: 58%;
  border: 1px solid #8a6d3b;
  border-radius: 2px;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.template-mock__totals-card span { display: block; height: 6px; border-radius: 2px; background: var(--paper-100); }
.template-mock__totals-card span:last-child { background: #8a6d3b; opacity: 0.4; }

/* Corporate: a boxed invoice-number badge, two boxed From/Bill-To panels, and a striped table with
   a highlighted total — a heavier, more structured look for B2B invoicing. */
.template-mock__rule--corporate { height: 3px; background: #2f4858; }

.template-mock__badge {
  align-self: flex-end;
  width: 42%;
  border: 1px solid #2f4858;
  border-radius: 2px;
  padding: 4px 8px;
}
.template-mock__badge span { display: block; height: 6px; border-radius: 2px; background: #2f4858; opacity: 0.5; }

.template-mock__panels { display: flex; gap: var(--space-2); }
.template-mock__panels > div {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.template-mock__panels span { display: block; height: 6px; border-radius: 2px; background: var(--paper-100); }

.template-mock__table--zebra span:nth-child(even) { background: var(--paper-50); }

.template-mock__total-highlight {
  margin-top: auto;
  background: var(--paper-50);
  border-left: 3px solid #2f4858;
  padding: 4px 8px;
}
.template-mock__total-highlight span { display: block; height: 7px; border-radius: 2px; background: #2f4858; opacity: 0.4; }

/* Template selector in the invoice generator form: a grid of visual thumbnail cards built on
   native <input type="radio"> for full keyboard support (arrow keys move the selection, Tab
   enters/exits the group, Space selects) and correct screen-reader semantics ("selected, radio
   button, <name>") with no extra ARIA needed. The radio itself is visually hidden (not
   display:none, so it stays focusable) and the visible card reacts to :checked / :focus-visible
   on it via a sibling selector. Selection is shown with both a border/background change and a
   checkmark badge, so it never depends on color alone. */
.template-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.template-option { display: block; cursor: pointer; }

.template-option__frame {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--paper-0);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.template-option__input:checked ~ .template-option__frame {
  border-color: var(--brand-600);
  background: var(--brand-50);
}

.template-option__input:focus-visible ~ .template-option__frame {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.template-option__input:focus-visible { outline: none; }

.template-option__mock {
  height: 92px;
  padding: var(--space-2);
  gap: 6px;
}

.template-option__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.template-option__name { font-weight: 600; font-size: 0.88rem; color: var(--ink-900); }

.template-option__badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-600);
  visibility: hidden;
}

.template-option__input:checked ~ .template-option__frame .template-option__badge { visibility: visible; }

/* -------------------------------------------------------------------------
   FAQ accordions (native <details>/<summary> — no JS needed)
   ------------------------------------------------------------------------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 760px;
  margin-inline: auto;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 1rem;
  color: var(--ink-900);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex: none;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--ink-500);
  transition: transform 0.15s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: var(--radius-sm); }
.faq-item p { margin: var(--space-3) 0 0; }

/* -------------------------------------------------------------------------
   Breadcrumbs
   ------------------------------------------------------------------------- */
.breadcrumbs {
  padding-top: var(--space-5);
}
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.85rem;
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: var(--space-2); }
.breadcrumbs a { color: var(--ink-500); }
.breadcrumbs a:hover { color: var(--brand-600); }
.breadcrumbs [aria-current="page"] { color: var(--ink-700); font-weight: 600; }
.breadcrumbs__sep { color: var(--ink-300); }
