:root {
  --bg: #F5F0E7;
  --surface: #FFFFFF;
  --sunken: #EAE3D6;
  --ink: #1C211E;
  --ink-brown: #3B2A22;
  --brown-soft: #5A4438;
  --muted: #5C635E;
  --line: #E2D9C8;
  --line-strong: #D5CCBC;
  --deep: #1F3A2E;
  --on-deep: #F5F0E7;
  --accent: #B4552F;
  --serif: Fraunces, Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--deep); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(120px + var(--safe-bottom));
  outline: none;
}
.loading, .error { padding: 120px 24px; text-align: center; color: var(--muted); }
.page { padding: calc(env(safe-area-inset-top, 0px) + 52px) 20px 0; display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 0; }

/* Fyrirsagnir */
.title { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 36px; line-height: 1.05; color: var(--ink-brown); }
.subtitle { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--brown-soft); }
.label-caps { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Haus með Akranesi */
.hero { position: relative; height: 300px; overflow: hidden; background: #EADCD1; color: var(--ink-brown); }
.hero svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-text { position: absolute; left: 24px; right: 120px; top: calc(env(safe-area-inset-top, 0px) + 64px); }
.hero h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 42px; line-height: 1; letter-spacing: -0.01em; }
.hero p { margin: 10px 0 0; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--brown-soft); }
.hero.small { height: 200px; }
.hero.small h1 { font-size: 36px; }

/* Leit */
.searchrow { display: flex; gap: 10px; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 999px; padding: 0 18px; height: 52px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.round { position: relative; flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }
.round.sm { width: 44px; height: 44px; border: 1px solid var(--line-strong); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Rofar og pillur */
.seg { display: flex; gap: 6px; background: var(--sunken); border-radius: 999px; padding: 4px; }
.seg button { flex: 1; height: 40px; border-radius: 999px; border: none; background: transparent; font-size: 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--deep); color: var(--on-deep); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.chip-btn[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: var(--on-deep); }
.chip-btn svg { width: 16px; height: 16px; stroke-width: 2.4; }

/* Vikuröð */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.week button { height: 62px; border: none; border-radius: 999px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; }
.week .wd { font-size: 11px; font-weight: 500; }
.week .n { font-size: 16px; font-weight: 600; }
.week .dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.week .has .dot { background: #B07A2A; }
.week button[aria-pressed="true"] { background: var(--deep); color: var(--on-deep); }
.week button[aria-pressed="true"] .dot { background: #E4B860; }

/* Listi */
.list { display: flex; flex-direction: column; }
.dayhead { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 2px; }
.dayhead h2 { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 500; }
.dayhead span { font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row-link { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.thumb { flex-shrink: 0; width: 72px; height: 72px; border-radius: 14px; color: var(--on-deep); display: flex; align-items: center; justify-content: center; }
.thumb svg { width: 28px; height: 28px; stroke-width: 1.4; }
.row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.row-info h3 { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.2; }
.row-info .meta { font-size: 13px; color: var(--muted); }
.cat { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); border-radius: 999px; padding: 3px 9px; }
.heart { flex-shrink: 0; width: 44px; height: 44px; border: none; background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }
.heart[aria-pressed="true"] { color: var(--accent); }
.heart[aria-pressed="true"] svg { fill: currentColor; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.more { display: block; text-align: center; padding: 18px 0 4px; font-weight: 600; text-decoration: none; }

/* Flokkalitir */
.k-bio { background: #2B3A55; } .c-bio { background: #DCE3EE; }
.k-ton { background: #7A3424; } .c-ton { background: #F0D9CF; }
.k-vid { background: #9A6F24; } .c-vid { background: #EFE1C2; }
.k-syn { background: #3F5B4A; } .c-syn { background: #DCE6DF; }
.k-lei { background: #5A3A5E; } .c-lei { background: #E7DCEA; }

/* Neðri valmynd */
.nav { position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translateX(-50%); z-index: 20; background: var(--deep); border-radius: 999px; padding: 6px; display: flex; gap: 6px; box-shadow: 0 10px 30px rgba(28, 33, 30, .28); }
.nav a { width: 56px; height: 56px; border-radius: 50%; color: var(--on-deep); display: flex; align-items: center; justify-content: center; }
.nav a[aria-current="page"] { background: var(--accent); color: #fff; }
.nav svg { width: 22px; height: 22px; }
.nav.hide { display: none; }

/* Blöð (síur) */
.sheet-bg { position: fixed; inset: 0; z-index: 30; background: rgba(28, 33, 30, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 28px 28px 0 0; padding: 10px 20px calc(28px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; }
.grabber { align-self: center; width: 40px; height: 5px; border-radius: 999px; background: var(--line-strong); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 500; color: var(--ink-brown); }
fieldset { border: none; margin: 0; padding: 0; }
legend { padding: 0; margin-bottom: 10px; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.toggle b { display: block; font-size: 15px; font-weight: 500; }
.toggle small { display: block; font-size: 13px; color: var(--muted); }
.switch { position: relative; flex-shrink: 0; width: 50px; height: 30px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--deep); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.linkish { height: 48px; padding: 0 4px; border: none; background: transparent; font-size: 15px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* Hnappar */
.btn { height: 54px; border-radius: 999px; border: none; background: var(--deep); color: var(--on-deep); font-size: 15px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 22px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn.wide { width: 100%; }
.btn.sm { height: 44px; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Viðburðablað */
.detail-top { position: relative; height: 300px; overflow: hidden; color: #F2D3B4; display: flex; align-items: center; justify-content: center; }
.detail-top .big { width: 96px; height: 96px; stroke-width: 1.2; }
.detail-top .back, .detail-top .heart-top { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 50px); width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--bg); color: var(--ink); display: flex; align-items: center; justify-content: center; text-decoration: none; padding: 0; }
.detail-top .back { left: 20px; }
.detail-top .heart-top { right: 20px; color: var(--accent); }
.detail-top .heart-top[aria-pressed="true"] svg { fill: currentColor; }
.detail-body { position: relative; margin-top: -28px; background: var(--bg); border-radius: 28px 28px 0 0; padding: 24px 20px 0; display: flex; flex-direction: column; gap: 18px; }
.detail-body h1 { margin: 6px 0 0; font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--ink-brown); }
.detail-body .desc { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-brown); }
.facts { margin: 0; background: var(--surface); border-radius: 18px; padding: 4px 16px; }
.facts div { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #EFE8DC; }
.facts div:last-child { border-bottom: none; }
.facts svg { color: var(--muted); }
.facts dt { width: 64px; flex-shrink: 0; font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-size: 15px; font-weight: 500; }
.facts small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* Uppáhald */
.next-card { background: var(--deep); color: var(--on-deep); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; }
.next-card .label-caps { color: var(--on-deep); opacity: .8; }
.datebox { flex-shrink: 0; width: 60px; height: 64px; border-radius: 14px; background: var(--bg); color: var(--ink-brown); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.datebox b { font-family: var(--serif); font-size: 26px; font-weight: 500; }
.datebox span { font-size: 11px; font-weight: 600; }

/* Aðgangur */
.lead { margin: 0; font-family: var(--serif); font-size: 20px; line-height: 1.35; color: var(--ink-brown); }
.perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.perks li { display: flex; gap: 12px; align-items: flex-start; }
.perks .ic { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.perks b { display: block; font-size: 15px; font-weight: 600; }
.perks span span { display: block; font-size: 13px; color: var(--muted); }
.sources { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sources div { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.sources .st { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.sources .st i { width: 8px; height: 8px; border-radius: 50%; }
.me { display: flex; align-items: center; gap: 14px; }
.avatar { flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; background: var(--deep); color: var(--on-deep); font-family: var(--serif); font-size: 24px; display: flex; align-items: center; justify-content: center; }
.owner { display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; background: #EFE1C2; border-radius: 999px; padding: 3px 9px; }
.card { background: var(--surface); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 4px 0 0; font-family: var(--serif); font-size: 17px; font-weight: 500; line-height: 1.2; }
.card .meta { font-size: 13px; color: var(--muted); }
.card .from { font-size: 12px; color: var(--muted); font-style: italic; }
.status { align-self: flex-start; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: var(--sunken); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; }
.sec-head h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* Form */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; }
.field > span small { font-weight: 400; color: var(--muted); font-size: 13px; }
.field input { height: 48px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 14px; font-size: 16px; width: 100%; }
.field textarea { border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); padding: 12px 14px; font-size: 16px; width: 100%; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--deep); outline-offset: 0; border-color: var(--deep); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--deep); }
.note { margin: 0; display: flex; gap: 10px; align-items: flex-start; background: var(--sunken); border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--ink-brown); }
.formerr { margin: 0; color: #9B2C1E; font-size: 14px; font-weight: 500; }
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 500; color: var(--ink-brown); }

/* Skilaboð */
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translate(-50%, 20px); z-index: 40; max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 520px) {
  .app { box-shadow: 0 0 0 1px var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
