/* Styling for the public condolence pages.
   Self-contained: the embed lands inside a newspaper's own page, so it must not
   depend on anything that page happens to load, and must not leak styles out.

   The look is the "VG1-S" direction chosen 2026-08-26: modern tabloid-web —
   white ground, near-black ink, heavy tight headlines, one confident red — with
   the protocol itself as the whole page. The memorial page is a fixed-height
   widget: the iframe never grows, the greetings scroll inside it. */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #ffffff;          /* ren hvit grunn */
  --ink: #1d1d1d;         /* nesten svart blekk */
  --muted: #595959;       /* metatekst */
  --faint: #8c8c8c;       /* svakeste tekst */
  --line: #e2e2e2;        /* hårlinjer */
  --rule: #1d1d1d;        /* tunge seksjonslinjer */
  --field-bg: #ffffff;
  --field-line: #b9b9b9;
  --accent: #d5121e;      /* tabloidrødt */
  --accent-ink: #c20f1a;  /* rødt som tåler tekst på hvit grunn */
  --btn-bg: #1d1d1d;      /* solid mørk primærknapp — verdig, aldri ropende */
  --btn-ink: #ffffff;
  --thumb: #c7c7c7;       /* tynn scrollbar */
  --ok-bg: #f0f7f1;
  --ok-ink: #1d5a2a;
  --warn-bg: #fdf3e6;
  --warn-ink: #7a4a12;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

h1, h2 { margin: 0; }
a { color: var(--accent-ink); }

/* Headlines and labels: heavy, tight, tabloid. */
.headline-font {
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
}

/* Visually hidden, still read aloud. */
.vh {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ The memorial widget (body.widget) ============
   Fills a fixed-height iframe: bar on top, everything else scrolls. */

html { height: 100%; }
body.widget { height: 100%; display: flex; flex-direction: column; }

/* ---- Top bar: count + about left, actions right. Never scrolls away. ---- */
.bar {
  flex: none;
  border-top: 3px solid var(--rule);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: .7rem 1.1rem .75rem;
}
.bar-inner {
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1.2rem;
  flex-wrap: wrap;
}
.stats {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
.stats strong {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stats .sep { color: var(--faint); }

.about-link {
  font: inherit;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .18em;
  white-space: nowrap;
}
.about-link:hover { color: var(--ink); }

.bar-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin: 0;
}
/* The candle form is just a button in the bar — no form layout of its own. */
.candle-form { display: inline-flex; margin: 0; }
.btn-bar {
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .01em;
  border-radius: 999px;
  padding: .5rem 1.05rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s ease;
}
.btn-bar:hover { opacity: .82; }
.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: 2px solid var(--btn-bg);
}
.btn-ghost {
  background: transparent;
  color: var(--accent-ink);
  border: 2px solid var(--accent);
}
.btn-bar:disabled {
  background: transparent;
  border-color: var(--line);
  color: var(--faint);
  cursor: default;
  opacity: 1;
}
.btn-bar:disabled .flame { stroke: var(--faint); }
.closed-line { margin: 0; font-size: .8125rem; color: var(--muted); }

.flame { stroke: var(--accent); fill: none; stroke-width: 1.6; stroke-linecap: round; vertical-align: -3px; }
.btn-ghost .flame { stroke: var(--accent-ink); margin-right: .4rem; }

/* ---- Notices: quiet, in the bar, never scrolled away. ---- */
.notices { max-width: 44rem; margin: 0 auto; }
.notice {
  display: block;
  margin: .45rem 0 0;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.notice.ok { color: var(--ok-ink); }
.notice.warn { color: var(--warn-ink); }
body:not(.widget) .notice.ok { background: var(--ok-bg); padding: .7rem .9rem; border-radius: 6px; }
body:not(.widget) .notice.warn { background: var(--warn-bg); padding: .7rem .9rem; border-radius: 6px; }

/* ---- The scroll area: the protocol lives here. ---- */
.scroll-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
.scroller {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--thumb) transparent;
  padding: 0 1.1rem 2.6rem;
}
.scroller::-webkit-scrollbar { width: 8px; }
.scroller::-webkit-scrollbar-track { background: transparent; }
.scroller::-webkit-scrollbar-thumb {
  background: var(--thumb);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
.scroller > .inner { max-width: 44rem; margin: 0 auto; }

/* Bottom fade: "there is more below" — hidden at the end of the list. */
.fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2.4rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  opacity: 1;
  transition: opacity .3s ease;
}
.fade.at-end { opacity: 0; }

/* ---- Module headings: bold, uppercase, red edge — tabloid section marks. ---- */
.module-h {
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 .95rem;
  padding-left: .65rem;
  border-left: 3px solid var(--accent);
}
.module-h strong { font-variant-numeric: tabular-nums; }

/* ---- About the protocol (folds out from the bar link). ---- */
.about { padding: 1.1rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.about[hidden] { display: none; }
.about p { font-size: .875rem; color: var(--muted); margin: 0 0 .35rem; max-width: 40rem; }
.about ul { list-style: none; margin: .55rem 0 0; padding: 0; display: grid; gap: .4rem; }
.about a {
  font-weight: 700;
  font-size: .875rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

/* ---- Form (opens from the bar, top of the scroll area). ---- */
.compose { padding: 1.3rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.compose[hidden] { display: none; }
form { display: grid; gap: 1.15rem; margin: 0; }
.row { display: grid; gap: 1.15rem; grid-template-columns: 1fr 1fr; }
label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.opt { color: var(--faint); text-transform: none; letter-spacing: 0; font-weight: 400; }
input[type="text"], input[type="email"], textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--field-line);
  border-radius: 4px;
  padding: .6rem .75rem;
  transition: border-color .2s ease;
}
input:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
textarea { min-height: 6.5rem; resize: vertical; }
.hint { margin: .35rem 0 0; font-size: .8125rem; color: var(--faint); }
.actions { margin: 0; }
button.primary {
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .01em;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: 2px solid var(--btn-bg);
  border-radius: 999px;
  padding: .5rem 1.3rem;
  cursor: pointer;
  transition: opacity .15s ease;
}
button.primary:hover { opacity: .82; }

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hp-inline { position: absolute; left: -9999px; width: 1px; }

/* ---- The candles: one small flame per candle lit. ---- */
.candles { padding: 1.1rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.candle-band {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  align-items: center;
  gap: .5rem .55rem;
}
.candle-band .flame { vertical-align: baseline; width: 12px; height: 16px; }
/* Deterministic variation: a quiet, organic edge without any randomness. */
.candle-band .flame:nth-child(2n) { opacity: .62; }
.candle-band .flame:nth-child(3n) { width: 11px; height: 14px; opacity: .78; }
.candle-band .flame:nth-child(5n) { width: 13px; height: 17px; opacity: .92; }
/* The reader's own candle: filled, full strength, first in the row. */
.candle-band .flame.mine {
  fill: var(--accent);
  width: 14px; height: 18px;
  opacity: 1 !important;
}
.candle-band .more {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--muted);
  margin-left: .2rem;
  white-space: nowrap;
}

/* ---- Greetings: hairline modules, bold bylines. ---- */
.entries { padding-top: .35rem; }
.entry { padding: 1.25rem 0 1.35rem; border-top: 1px solid var(--line); }
.entry:first-of-type { border-top: none; }
.message {
  margin: 0 0 .7rem;
  max-width: 40rem;
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-line;
}
.byline { margin: 0; font-size: .8125rem; color: var(--muted); max-width: 40rem; }
.byline .name { font-weight: 700; color: var(--ink); }
.empty { color: var(--muted); font-style: italic; padding: 1.2rem 0; }

.pager {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
  padding: 1.1rem 0 .4rem;
  border-top: 1px solid var(--line);
}
.pager a { font-size: .875rem; font-weight: 700; letter-spacing: .01em; }

/* Plain page frame — used by the not-found page. */
.wrap { max-width: 44rem; margin: 0 auto; padding: 1.1rem 1rem 1.6rem; }

/* ============ Front-page card (fixed-height iframe, one book) ============
   VG front-page grammar: red plate and centred text on the left, the whole
   portrait on the right. object-fit: contain means the portrait is never
   cropped, whatever its aspect ratio — the snippet is a plain iframe with
   no script, so the card fills the iframe's fixed height (100vh). */
.ov-card { text-align: center; border-top: 3px solid var(--rule); }
.ov-card:not(.noimg) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42%;
  min-height: calc(100vh - 3px);
}
.ov-main { align-self: center; }
.plate-row { padding-top: 1rem; line-height: 1; }
.plate {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--accent);
  color: #ffffff;
  padding: .3em .75em .32em;
}
.plate .flame { stroke: #ffffff; width: 10px; height: 13px; }
/* Absolutely positioned inside its grid cell: the cell's height comes from
   the card, never from the image, so containing can't stretch the card. */
.ov-photobox { position: relative; }
.photolink { position: absolute; inset: 0; display: block; }
.ov-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.ov-body { padding: .95rem 1.1rem 1.25rem; }
.ov-name {
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.04;
  color: var(--ink);
  text-wrap: balance;
}
.layout-kompakt .ov-name { font-size: 1.45rem; }
.namelink { text-decoration: none; color: inherit; }
.namelink:hover .ov-name {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: .1em;
}
.ov-meta {
  margin-top: .45rem;
  font-size: .8125rem;
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ov-meta strong { color: var(--ink); font-weight: 800; }
.ov-meta .years { color: var(--faint); }
.ov-meta .sep { color: var(--faint); margin: 0 .3rem; }
.ov-quote {
  margin: .65rem auto 0;
  max-width: 21rem;
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--muted);
}
.ov-cta { margin-top: .9rem; }
.btn-pill {
  font-family: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .01em;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: 2px solid var(--btn-bg);
  border-radius: 999px;
  padding: .45rem 1.15rem;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  transition: opacity .15s ease;
}
.btn-pill:hover { opacity: .82; }
/* Narrow host column: stack, portrait on top — still the whole portrait. */
@media (max-width: 400px) {
  .ov-card:not(.noimg) { display: flex; flex-direction: column; min-height: 0; }
  .ov-main { align-self: stretch; }
  .ov-photobox { order: -1; height: 200px; }
}

@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; }
}
@media (max-width: 340px) {
  .ov-name { font-size: 1.55rem; }
}

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