/* Design tokens: design-system/tokens.json → node scripts/build-tokens.mjs */
@import url("design-system/tokens.css");

:root {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: var(--min-width);
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
  padding: 0.6rem 0.9rem;
  transform: translateY(-150%);
  background: var(--canvas);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem max(6vw, calc((100vw - var(--page-max)) / 2));
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header > nav {
  margin-left: auto;
}

.wordmark {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.92rem;
}

nav a,
.text-link {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.hero,
.section,
.closing {
  padding: var(--section-y) max(6vw, calc((100vw - var(--content-max)) / 2));
}

.hero {
  max-width: 1200px;
  padding-top: var(--hero-y);
  padding-bottom: var(--hero-y);
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  max-width: var(--heading-max);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

h1 {
  margin-bottom: 1.5rem;
  font-size: clamp(2.8rem, 7vw, 5.8rem);
}

h2 {
  margin-bottom: 1.5rem;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

.hero-copy,
.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.button:hover,
.button:focus-visible {
  background: var(--accent-strong);
}

.product {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  align-items: start;
  gap: 4rem;
  background: var(--paper);
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.product-card h3 a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.product-card > div:first-child > p:last-child {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
}

.product-card-action .price {
  margin-top: 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1rem max(6vw, calc((100vw - var(--content-max)) / 2));
  color: var(--muted);
  font-size: 0.9rem;
}

.prose-page {
  padding-bottom: 5rem;
}

.prose {
  width: min(100% - 3rem, var(--prose-max));
  margin: 2.5rem auto 0;
}

.prose h1,
.prose h2 {
  max-width: var(--prose-max);
}

.prose h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
}

.prose h2 {
  margin-top: 3rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.prose p,
.prose li {
  color: var(--muted);
}

.prose .lead {
  color: var(--muted);
}

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

.draft-notice {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--notice-border);
  background: var(--notice-bg);
  color: var(--notice-text) !important;
}

.steps-list {
  padding-left: 1.5rem;
}

.steps-list li {
  padding: 0.25rem 0 1rem 0.5rem;
}

.steps-list h3 {
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.steps-list p {
  margin-bottom: 0;
}

.site-footer nav {
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer nav a {
  font-size: 0.9rem;
}

.product-hero {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.product-hero h1 {
  max-width: 900px;
}

.product-hero .price {
  margin-top: 2rem;
}

.button:disabled {
  border-color: var(--disabled);
  background: var(--disabled);
  cursor: not-allowed;
}

.section-intro {
  max-width: var(--measure);
  color: var(--muted);
  font-size: 1.15rem;
}

.workflow-list {
  max-width: 850px;
  margin: 2.5rem 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
  counter-reset: workflow;
}

.workflow-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  counter-increment: workflow;
}

.workflow-list li > div::before {
  content: "0" counter(workflow);
  display: block;
  margin-bottom: 0.45rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.workflow-list h3 {
  margin-bottom: 0.3rem;
}

.workflow-list p {
  margin-bottom: 0;
  color: var(--muted);
}

.workflow-list li > span {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-section ul {
  max-width: var(--measure);
}

.ai-section li {
  padding: 0.2rem 0;
}

.limitations {
  background: var(--paper);
}

.limitations p {
  max-width: var(--measure);
  color: var(--muted);
}

.faq details {
  max-width: 850px;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

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

.faq summary {
  cursor: pointer;
  font-weight: 700;
}

.faq details p {
  max-width: var(--measure);
  margin: 0.8rem 0 0;
  color: var(--muted);
}

.product-intro > p:not(.eyebrow, .lead, .price, .note) {
  max-width: 620px;
  color: var(--muted);
}

.price {
  margin: 1.8rem 0 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.price span {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 400;
}

.note,
.footer-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.note {
  margin-top: 0.85rem;
}

.product-summary {
  padding: 1.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.product-summary ol {
  padding-left: 1.25rem;
}

.product-summary li {
  padding: 0.35rem 0;
}

.product-summary p,
.contents-note,
.audience p,
.closing > p:not(.eyebrow) {
  color: var(--muted);
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.principles article {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.principles p {
  color: var(--muted);
}

.contents {
  background: var(--paper);
}

.file-list {
  max-width: var(--measure);
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.file-list li span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.contents-note {
  max-width: var(--measure);
  margin-top: 1.25rem;
}

.audience p {
  max-width: var(--measure);
}

.closing {
  background: var(--closing-bg);
  color: var(--closing-heading);
}

.closing .eyebrow {
  color: var(--closing-eyebrow);
}

.closing > p:not(.eyebrow) {
  color: var(--closing-text);
}

.closing .price span,
.closing .note {
  color: var(--closing-text);
}

.closing h2 {
  max-width: var(--measure);
}

.text-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent);
  font-weight: 700;
}

.closing .text-link {
  color: var(--closing-link);
}

.site-footer {
  align-items: flex-start;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.footer-note {
  flex-basis: 100%;
}

:focus-visible {
  outline: var(--focus-ring) solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem 1.25rem;
  }

  nav {
    gap: 1rem;
  }

  .site-header > nav {
    margin-left: 0;
  }

  .hero,
  .section,
  .closing {
    padding: var(--section-y-mobile) var(--row-y);
  }

  .hero {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }

  .product,
  .principles,
  .product-card {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .breadcrumbs {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .prose {
    width: calc(100% - 2.5rem);
  }

  .product-hero {
    padding-top: 4rem;
  }

  .product-card-action .button {
    margin-top: 0.5rem;
  }
}

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

/* Price and invoice */

.invoice-note {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.invoice-note a {
  color: var(--accent);
  font-weight: 700;
}

.closing .invoice-note,
.closing .invoice-note a {
  color: var(--closing-text);
}

/* File previews */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.preview {
  margin: 0;
}

.preview-wide {
  grid-column: 1 / -1;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.file-type {
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.file-type.xlsx { background: var(--filetype-xlsx); }
.file-type.docx { background: var(--filetype-docx); }
.file-type.pdf { background: var(--filetype-pdf); }

.preview-body {
  position: relative;
  max-height: 19rem;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--canvas);
  font-size: 0.78rem;
  line-height: 1.4;
}

.preview figcaption {
  max-width: 560px;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.sheet {
  width: 100%;
  border-collapse: collapse;
}

.sheet th {
  padding: 0.45rem 0.55rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.sheet td {
  padding: 0.45rem 0.55rem;
  border-right: 1px solid var(--sheet-rule);
  border-bottom: 1px solid var(--sheet-rule);
  vertical-align: top;
}

.sheet td:first-child {
  color: var(--muted);
  white-space: nowrap;
}

.sheet.numeric td:not(:first-child),
.sheet.numeric th:not(:first-child) {
  text-align: right;
}

.sheet .total td {
  border-top: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
}

.sheet .empty {
  background: var(--sheet-empty);
}

.pill {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  white-space: nowrap;
}

.pill.must { background: var(--pill-must); }
.pill.pref { background: var(--pill-pref); }
.pill.wish { background: var(--pill-wish); }
.pill.open { background: var(--pill-open); }

.flag {
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--pill-must);
  font-weight: 700;
}

.sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.45rem 0.55rem;
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
}

.sheet-tabs span {
  padding: 0.1rem 0.5rem;
}

.sheet-tabs .active {
  background: var(--canvas);
  color: var(--accent);
  font-weight: 700;
}

.preview-body.doc {
  padding: 1.4rem 1.5rem;
  font-size: 0.8rem;
}

.doc-h,
.doc-title {
  margin-bottom: 0.7rem;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 700;
}

.doc-title {
  font-size: 1.35rem;
}

.doc-kicker {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doc-text {
  color: var(--ink);
}

.doc-table {
  width: 100%;
  margin-bottom: 0.8rem;
  border-collapse: collapse;
}

.doc-table td {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  vertical-align: top;
}

.doc-table td:first-child {
  width: 58%;
}

.doc-table .placeholder {
  color: var(--placeholder);
  font-style: italic;
}

.doc-box {
  margin-bottom: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
}

.doc-box strong {
  display: block;
  margin-bottom: 0.15rem;
}

.doc-box span {
  display: block;
}

.doc-box.ai { background: var(--doc-ai); }
.doc-box.trap { background: var(--doc-trap); }
.doc-box.check { border: 1.5px solid var(--accent); }

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

  .sheet td:first-child {
    white-space: normal;
  }
}

/* Theme switch (theme.js): Auto follows the system setting, Ljust/Mörkt override it */

.theme-toggle {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--ink);
}
