/* FLOGVIT.menighet — tokens copied from portal/design/tokens.css (STYLE.md),
   accent «furu». Chrome rules follow portal/SETTINGS.md and are copied from
   eventphotos: no px floors on chrome elements, min-width: 0 on rows, nowrap
   only on the wordmark itself. Every screen is designed for 320 px at 150 %
   text first (README.md). */

:root {
  --paper: #faf9f6;
  --surface: #ffffff;
  --ink: #1b1b18;
  --ink-2: #67665f;
  --line: #dcdacf;
  --bad: #c03b2e;
  --accent: #2d6a5a;
  --accent-dark: #7fc9b0;
  --radius: 10px;
  --radius-pill: 999px;
  --maxw: 1120px;
  /* The page's side gutter: 12 px, or the notch's inset where that is wider.
     The header, main and footer all read these, so they cannot disagree. */
  --gutter-left: max(12px, env(safe-area-inset-left));
  --gutter-right: max(12px, env(safe-area-inset-right));
  --font-ui: 'Schibsted Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  /* The current product's row in the family menu. */
  --well: color-mix(in oklab, var(--ink) 6%, var(--surface));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-fv-theme="light"]) {
    --paper: #161614; --surface: #1e1e1b; --ink: #edece6; --ink-2: #99978d; --line: #2e2d29; --bad: #e0604f;
    --accent: var(--accent-dark);
  }
}
:root[data-fv-theme="dark"] {
  --paper: #161614; --surface: #1e1e1b; --ink: #edece6; --ink-2: #99978d; --line: #2e2d29; --bad: #e0604f;
  --accent: var(--accent-dark);
  color-scheme: dark;
}
/* A forced theme says so to the browser too, or date pickers and checkboxes
   are drawn in the OS's scheme on the other one's paper. */
:root[data-fv-theme="light"] { color-scheme: light; }

/* min-width: 0 on everything, once. The default, auto, means "never narrower
   than my content": a grid or flex child pushes its track out past the
   viewport as the text grows, and a <fieldset> carries min-content in the
   browser's own stylesheet. No rule below repeats it. */
*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.5;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.4em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.7em, 5vw, 2.4em); font-weight: 800; }
h2 { font-size: 1.25em; font-weight: 700; }
p { margin: 0 0 1em; overflow-wrap: anywhere; }
img, svg { max-width: 100%; }
/* `hidden` wins over a class that sets display (a .btn the island shows later). */
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -999px; top: 0; padding: 8px 12px; background: var(--surface); color: var(--ink); }
.skip-link:focus { left: 8px; z-index: 100; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.hdr-row {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--gutter-right) 0 var(--gutter-left);
  display: flex; align-items: center; gap: 0.75em; flex-wrap: wrap;
}
.hdr-nav { display: flex; gap: 0.1em; flex-wrap: wrap; }
.hdr-nav a {
  padding: 0.4em 0.7em; border-radius: var(--radius-pill);
  font-size: 0.9em; font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.hdr-nav a.active, .hdr-nav a:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 6%, transparent); }
.hdr-controls { margin-left: auto; display: flex; align-items: center; gap: 0.5em; }

/* Wordmark (STYLE.md): nowrap on the mark itself, never on the row. */
.wordmark { display: inline-flex; align-items: baseline; font-size: 1.05em; color: var(--ink); }
.wordmark a { color: var(--ink); text-decoration: none; }
.wordmark a:focus-visible, .fv-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.wm-product { font-family: var(--font-mono); font-weight: 500; font-size: 0.95em; white-space: nowrap; }
.wm-product-dot { color: var(--accent); font-family: var(--font-ui); font-weight: 800; }

.fv-menu { position: relative; display: inline-block; }
.fv-summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: baseline; gap: 0.3em;
  font-weight: 800; letter-spacing: -0.02em; white-space: nowrap;
}
.fv-summary::-webkit-details-marker { display: none; }
.fv-caret { color: var(--ink-2); transition: transform 0.15s ease-out; }
.fv-menu[open] .fv-caret { transform: rotate(180deg); }
/* `left: 0` — never a negative offset in `em`: an `em` grows with the text and
   puts the panel off the left edge at 150 %. See test/layout.test.ts. */
.fv-menu-panel {
  position: absolute; left: 0; top: calc(100% + 0.6em); z-index: 80;
  display: flex; flex-direction: column;
  min-width: min(14em, calc(100vw - 24px)); max-width: calc(100vw - 24px);
  padding: 0.35em; white-space: normal;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.fv-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.8em; flex-wrap: wrap;
  padding: 0.5em 0.75em; border-radius: 6px;
  font-size: 0.95em; font-weight: 400; letter-spacing: 0; text-decoration: none; color: var(--ink);
}
.fv-item[aria-current] { background: var(--well); }
.fv-wm { display: inline-flex; align-items: baseline; white-space: nowrap; }
.fv-brand-b { font-weight: 800; letter-spacing: -0.02em; }
.fv-dot { font-weight: 800; color: var(--ink); --fv-dot: var(--ink); --fv-dot-dark: var(--ink); }
.fv-prod { font-family: var(--font-mono); font-weight: 500; font-size: 0.95em; }
.fv-soon .fv-wm { opacity: 0.5; }
.fv-chip { font-family: var(--font-mono); font-size: 0.7em; color: var(--ink-2); }
.fv-kontoitem { font-size: 0.85em; border-top: 1px solid var(--line); margin-top: 0.25em; padding-top: 0.6em; }
/* Each product's dot colour comes from src/ui/family-menu.json, set on the
   element as --fv-dot / --fv-dot-dark; no list of products lives here. */
.fv-dot[style] { color: var(--fv-dot); }
@media (prefers-color-scheme: dark) {
  :root:not([data-fv-theme="light"]) .fv-dot[style] { color: var(--fv-dot-dark); }
}
:root[data-fv-theme="dark"] .fv-dot[style] { color: var(--fv-dot-dark); }

.account-chip {
  display: inline-flex; align-items: center; gap: 0.4em; min-height: 2.4em; max-width: 12em; padding: 0 0.8em;
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink);
  font-size: 0.85em; font-weight: 600; text-decoration: none;
}
.account-chip:hover { border-color: var(--ink-2); }
.account-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip-plus {
  flex: none; padding: 0.1em 0.5em; border-radius: var(--radius-pill); background: var(--accent); color: var(--paper);
  font-family: var(--font-mono); font-size: 0.7em; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.settings-gear {
  display: inline-flex; align-items: center; justify-content: center; width: 2.4em; height: 2.4em;
  border-radius: 50%; color: var(--ink-2); text-decoration: none; font-size: 1em;
}
.settings-gear.active, .settings-gear:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 6%, transparent); }

/* ---------- page ---------- */
.page {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 1.5em var(--gutter-right) 3em var(--gutter-left);
}
.hero { padding: 1em 0 1.5em; }
.hero--center { text-align: center; padding-top: 3em; }
.lead { font-size: 1.1em; color: var(--ink-2); max-width: 40em; }
.hero--center .lead { margin-inline: auto; }
.eyebrow { font-family: var(--font-mono); font-size: 0.85em; color: var(--accent); margin: 0 0 0.4em; }
.eyebrow a { text-decoration: none; }
.empty { color: var(--ink-2); }

/* A section's name, with the rule drawn NEXT to it rather than under it. */
.section-head {
  display: flex; align-items: center; gap: 0.7em;
  margin-top: 1.6em; margin-bottom: 0.7em;
  font-family: var(--font-mono); font-size: 0.8em; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* A congregation, or a module: one big target each, in a grid that is one
   column on a phone. The size is in em, so it grows with the text. */
.tiles { list-style: none; margin: 0 0 1.5em; padding: 0; display: grid; gap: 0.6em; grid-template-columns: repeat(auto-fill, minmax(min(18em, 100%), 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 0.2em; height: 100%; padding: 1em 1.1em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); text-decoration: none;
}
.tile:hover, .tile:focus-visible { border-color: var(--accent); }
.tile-title { font-weight: 700; font-size: 1.1em; }
.tile-meta { font-size: 0.9em; color: var(--ink-2); }

.plain { list-style: none; margin: 0; padding: 0; }
.links { display: flex; flex-wrap: wrap; gap: 0.5em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2em; margin: 0 0 1em; }
.card--accent { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.card p:last-child { margin-bottom: 0; }
/* Text and its one button side by side where there is room, stacked where
   there is not. `1 1 20em` rather than a min-width, so the text column wraps
   instead of pushing the button off the screen at 150 %. */
.card--split { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8em 1.2em; }
.card-split-text { flex: 1 1 20em; margin: 0; }
.form-after { margin-top: 0.8em; }

.btn {
  display: inline-block; padding: 0.6em 1.1em; border-radius: var(--radius-pill); border: 1px solid var(--accent);
  background: var(--accent); color: var(--paper); text-decoration: none; cursor: pointer; font: inherit; font-weight: 600;
}
.btn--outline { background: transparent; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5em; }
.chip {
  padding: 0.4em 0.9em; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  text-decoration: none;
}
.chip--on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------- forms ---------- */
.form { max-width: 40em; }
.field { margin: 0 0 1em; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 0.3em; }
.field input[type="text"], .field input[type="email"] {
  width: 100%; padding: 0.55em 0.7em; background: var(--surface);
  font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
}
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field--bad input { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 0.9em; margin: 0.3em 0 0; }
.field-help { color: var(--ink-2); font-size: 0.9em; font-weight: 400; }
p.field-help { margin: 0.3em 0 0.8em; }
.field-row { display: grid; gap: 0 1em; grid-template-columns: repeat(auto-fit, minmax(min(14em, 100%), 1fr)); }
.checkbox { display: flex; gap: 0.5em; align-items: flex-start; font-weight: 400 !important; margin: 0 0 0.4em; }
.checkbox input { margin-top: 0.35em; flex: none; }
fieldset.field { border: 0; padding: 0; margin-inline: 0; }
.flash { color: var(--accent); font-weight: 600; }
.field-label { font-weight: 600; margin: 0 0 0.3em; }
.field input[type="date"], .field input[type="number"], .field select {
  padding: 0.55em 0.7em; background: var(--surface); font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; max-width: 100%;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- trosopplæring-økonomi ---------- */
/* At the till: one hand, a bag in the other. The main action and the
   choices are big targets, sized in em so they grow with the text. */
.hero--tight { padding-bottom: 0.8em; }
.btn--big { padding: 0.8em 1.4em; font-size: 1.1em; }
.btn--danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.flash--big { font-size: 1.15em; }
.pending {
  padding: 0.6em 0.8em; border-radius: 8px; font-weight: 600;
  background: color-mix(in oklab, var(--bad) 12%, var(--surface)); color: var(--ink);
}

.choice-grid { display: grid; gap: 0.5em; grid-template-columns: repeat(auto-fill, minmax(min(10em, 100%), 1fr)); }
.choice { position: relative; display: block; margin: 0 !important; font-weight: 600; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: flex; align-items: center; min-height: 3.2em; height: 100%; padding: 0.6em 0.9em;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow-wrap: anywhere;
}
.choice input:checked + span { border: 2px solid var(--accent); color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, var(--surface)); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field .input-amount { font-size: 1.4em; font-weight: 700; max-width: 9em; }
.photo-button { display: inline-flex; align-items: center; gap: 0.4em; }

.thumbs { display: flex; flex-wrap: wrap; gap: 0.4em; list-style: none; margin: 0.5em 0 0; padding: 0; }
.thumbs li { position: relative; }
.thumbs img { display: block; width: 4em; height: 4em; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumb-remove {
  position: absolute; top: -0.4em; right: -0.4em; width: 1.6em; height: 1.6em; border-radius: 50%;
  border: 0; background: var(--ink); color: var(--paper); font: inherit; line-height: 1; cursor: pointer;
}

.money-list { display: grid; gap: 0.6em; margin-bottom: 1.5em; }
.money-row {
  display: grid; gap: 0.15em 1em; grid-template-columns: 1fr auto; align-items: baseline; padding: 0.9em 1em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none;
}
.money-row:hover, .money-row:focus-visible { border-color: var(--accent); }
.money-row--overall { border-width: 2px; }
.money-name { font-weight: 700; overflow-wrap: anywhere; }
.money-left { font-size: 1.5em; font-weight: 800; text-align: right; }
.money-left--hero { font-size: 2.2em; text-align: left; margin: 0 0 0.5em; }
.money-left--minus { color: var(--bad); }
.money-left-label { font-size: 0.5em; font-weight: 600; color: var(--ink-2); }
.money-meta { grid-column: 1 / -1; font-size: 0.9em; color: var(--ink-2); }
.bar { grid-column: 1 / -1; display: block; height: 0.4em; border-radius: 1em; background: var(--well); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
/* Too narrow for name and amount side by side: the amount goes under. */
@media (max-width: 26em) {
  .money-row { grid-template-columns: 1fr; }
  .money-left { text-align: left; }
}

.ledger { display: grid; gap: 0.5em; }
.ledger-line { padding: 0.8em 1em; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.ledger-main, .ledger-meta, .ledger-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2em 1em; }
.ledger-what { font-weight: 600; overflow-wrap: anywhere; }
.ledger-amount { font-weight: 700; }
.ledger-meta { font-size: 0.9em; color: var(--ink-2); }
.ledger-foot { align-items: center; margin-top: 0.4em; }
.ledger-foot .thumbs { margin: 0; }
.ledger-foot .thumbs img { width: 3em; height: 3em; }
.receipt-list { display: grid; gap: 0.6em; margin-bottom: 1em; }
.receipt-list img { display: block; width: 6em; height: 6em; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* The report for Søndagsskolen: the sums, then every line. On a phone the
   table scrolls on its own, edge to edge; on paper it is one project per A4. */
.report-sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9em, 100%), 1fr)); gap: 0.4em 1em; margin: 0 0 1em; }
.report-sums dt { font-size: 0.85em; color: var(--ink-2); }
.report-sums dd { margin: 0; font-weight: 700; }
.report-left dd { font-size: 1.3em; }
.table-scroll { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.report-table th, .report-table td { text-align: left; padding: 0.4em 0.5em; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-table th { font-size: 0.85em; color: var(--ink-2); font-weight: 600; }
.report-table td:nth-child(2) { overflow-wrap: anywhere; min-width: 12em; }
.report-table .num { text-align: right; }
.nowrap { white-space: nowrap; }
.receipt-link { display: inline-block; margin-right: 0.6em; white-space: nowrap; }

/* Import and reconciliation: the work lists stay open, what agrees folds away. */
.field input[type="file"] { max-width: 100%; font: inherit; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 0.8em; }
.inline-heading { display: inline; margin: 0; font-size: 1.1em; }
@media (max-width: 26em) {
  .report-project { padding-inline: 0; border-inline: 0; border-radius: 0; }
  .report-project > h2, .report-project > p, .report-project > dl { padding-inline: 0.75em; }
}

@media print {
  @page { size: A4; margin: 15mm; }
  :root { --ink: #000; --ink-2: #444; --paper: #fff; --surface: #fff; --line: #bbb; --accent: #000; }
  body { background: #fff; font-size: 10pt; }
  .site-header, .site-footer, .skip-link, .no-print { display: none !important; }
  .page { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; background: none; }
  .report-project + .report-project { break-before: page; }
  .table-scroll { overflow: visible; }
  .report-table thead { display: table-header-group; }
  .report-table tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-row {
  max-width: var(--maxw); margin: 0 auto; padding: 1.5em var(--gutter-right) 1.5em var(--gutter-left);
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.6em 1.2em; font-size: 0.85em; color: var(--ink-2);
}
.footer-row a { color: var(--ink-2); text-decoration: none; }
.footer-row a:hover { color: var(--accent); }
.footer-wm { display: inline-flex; align-items: baseline; white-space: nowrap; color: var(--ink); }
.footer-wm-brand { font-weight: 800; letter-spacing: -0.02em; color: var(--ink) !important; }
.footer-wm-prod { font-family: var(--font-mono); font-weight: 500; font-size: 0.95em; color: var(--ink) !important; }
.footer-wm-dot { color: var(--accent); font-family: var(--font-ui); font-weight: 800; }
.footer-copy { margin-left: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
