/* Sakpris design system. Every page links this file; page CSS only adds layout specific to that page.
   Rules (see DESIGN.md):
   1. Use the tokens below, never raw colours, sizes or spacings.
   2. Components have NO outer margins. Space between things comes from the parent: .stack (vertical)
      or .cluster (horizontal). Text elements (p, h1-h4, ul) have margin 0 by default.
   3. Colour carries meaning: accent = action/recommended, warn = check this, err = failed, neutral = everything else. */

:root {
  /* colour */
  --bg: #f6f5f2; --card: #ffffff; --ink: #1d1d1b; --muted: #6b6a66; --line: #e4e2dc; --sunken: #f1efea;
  --accent: #1f6f4a; --accent-ink: #ffffff; --accent-soft: #e3f1e9;
  --warn: #8a5a00; --warn-soft: #fff4dc; --err: #a12a2a; --err-soft: #fde8e8;
  --sold: #1f6f4a; --active: #2b5d9b; --unsold: #8a8780; --chart: #13804c; --grid: #ecebe6;
  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* type scale */
  --t-xs: 12px; --t-sm: 14px; --t-base: 16px; --t-md: 18px; --t-lg: 22px; --t-xl: 28px; --t-price: 44px;
  --lh: 1.55; --lh-tight: 1.25;
  /* shape */
  --r-sm: 8px; --r: 12px; --r-lg: 14px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  /* interactive borders (buttons, inputs, choices) and floating surfaces (banner, menus) */
  --line-strong: #d3d0c8; --raised: #ffffff; --shadow-pop: 0 8px 28px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* surfaces step up in lightness (bg < card < raised) and every edge is visible: no shadows to lean on */
    --bg: #0e0e0d; --card: #1c1c1a; --ink: #f0efe9; --muted: #a8a69f; --line: #403f3a; --sunken: #141413;
    --line-strong: #5c5a53; --raised: #2a2a27; --shadow-pop: 0 12px 32px rgba(0,0,0,.75), 0 0 0 1px #5c5a53;
    --accent: #4cb582; --accent-ink: #0d1f16; --accent-soft: #1d3328;
    --warn: #e7b65a; --warn-soft: #33290f; --err: #f08a8a; --err-soft: #3a1c1c;
    --sold: #4cb582; --active: #7aa8e6; --unsold: #8f8d86; --chart: #3aa673; --grid: #2c2b28;
    --shadow: none;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: var(--t-base)/var(--lh) var(--font); }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul { padding-left: 1.3em; }
h1 { font-size: var(--t-xl); line-height: var(--lh-tight); letter-spacing: -.02em; }
h2 { font-size: var(--t-md); line-height: var(--lh-tight); letter-spacing: -.01em; }
h3, h4 { font-size: var(--t-sm); line-height: var(--lh-tight); }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */
.page { max-width: 640px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s7); }
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s4)); }
.stack-xs { --gap: var(--s1); } .stack-sm { --gap: var(--s2); } .stack-md { --gap: var(--s3); }
.stack-lg { --gap: var(--s5); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s2)); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.grow { flex: 1; }

/* ---------------------------------------------------------------- text */
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.fine { color: var(--muted); font-size: var(--t-xs); line-height: 1.5; }
.fine a { color: inherit; }
.center { text-align: center; }
.eyebrow { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }

/* ---------------------------------------------------------------- card */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: var(--s5) var(--s4); }
@media (min-width: 480px) { .card { padding: var(--s5); } }
.panel { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); }

/* ---------------------------------------------------------------- buttons */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 10px 22px; border: 1px solid transparent; border-radius: var(--r-pill);
  font: inherit; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line-strong); }
.btn-sm { min-height: 36px; padding: 6px 16px; font-size: var(--t-sm); }
.btn-block { display: flex; width: 100%; }
.link-btn { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--accent);
  font-weight: 600; cursor: pointer; }
.link-btn.underline { font-weight: 400; text-decoration: underline; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: var(--s1); }
.label { font-size: var(--t-sm); font-weight: 600; color: var(--muted); }
.input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 16px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
textarea.input { border-radius: var(--r-sm); min-height: 0; padding: 10px 12px; resize: vertical; font-size: 15px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); }
.inline-form .input { flex: 1 1 200px; }
.inline-form .btn { flex: 1 0 auto; }

/* ---------------------------------------------------------------- callouts (coloured boxes = meaning) */
.callout { border-radius: var(--r); padding: var(--s3) var(--s4); font-size: 15px; line-height: 1.5; }
.callout-info { background: var(--accent-soft); color: var(--ink); }     /* confirmation, recommendation */
.callout-warn { background: var(--warn-soft); color: var(--ink); }       /* check this / uncertain */
.callout-error { background: var(--err-soft); color: var(--err); }       /* something failed */

/* ---------------------------------------------------------------- pills */
.pill { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-pill); background: var(--sunken); color: var(--ink); }
.pill-good { background: var(--accent-soft); color: var(--accent); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--err-soft); color: var(--err); }

/* ---------------------------------------------------------------- disclosure */
details > summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; } details[open] > summary::before { content: "▾ "; }
.disclosure { border-top: 1px solid var(--line); padding-top: var(--s3); }
.disclosure > :not(summary) { margin-top: var(--s3); }   /* the one place a child gets a margin: details can't be a flex stack */

/* ---------------------------------------------------------------- numbered steps ("så funkar det") */
.steps-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--s4); counter-reset: step; }
.steps-list li { display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); align-items: start; counter-increment: step; }
.steps-list li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 15px; }
.steps-list strong { display: block; }
.steps-list p { color: var(--muted); font-size: 15px; }

/* ---------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th, .table td { text-align: left; vertical-align: top; padding: var(--s2) var(--s1); border-top: 1px solid var(--line); font-weight: 400; }
