/* melalda.is: hönnun eftir forskrift Sögu (_vinna/honnun.md) */

:root {
  color-scheme: light dark;

  --bg: #F6F4EF;
  --surface: #ECE8DF;
  --text: #1C2529;
  --muted: #4D5B60;
  --accent: #1D5A68;
  --aurora: #2D6A52;
  --melur: #7A6234;
  --line: #B9C3C2;
  --on-accent: #FFFFFF;

  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;

  --fs-xs: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --fs-sm: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
  --fs-base: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --fs-h3: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  --fs-h2: clamp(1.75rem, 1.5rem + 1.1vw, 2.5rem);
  --fs-h1: clamp(2.5rem, 1.9rem + 3vw, 4.5rem);

  --max: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --s1: .25rem;
  --s2: .5rem;
  --s3: 1rem;
  --s4: 1.5rem;
  --s5: 2.5rem;
  --s6: 4rem;
  --s7: clamp(4rem, 10vw, 8rem);
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F171B;
    --surface: #172328;
    --text: #E4E8E5;
    --muted: #A3B1B2;
    --accent: #7CC3CB;
    --aurora: #8ED2AE;
    --melur: #D2B88A;
    --line: #2E3E44;
    --on-accent: #0F171B;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

p, li { text-wrap: pretty; }
p { margin: 0 0 var(--s3); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover, a:focus-visible { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
main:focus { outline: none; }
main:focus-visible { outline: 2px solid var(--accent); }

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose { max-width: 65ch; }

/* Hoppa í efni */
.skip {
  position: absolute;
  left: var(--s3);
  top: var(--s3);
  z-index: 10;
  padding: var(--s2) var(--s3);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Aldan */
.wave {
  display: block;
  width: 100%;
  overflow: visible;
}
.wave path {
  fill: none;
  stroke: var(--aurora);
  stroke-width: 1.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.wave-lg { height: 40px; margin-top: var(--s5); }
.wave-sm { height: 24px; opacity: .6; }
main > .wave-sm { width: calc(100% - 2 * var(--gutter)); max-width: var(--max); margin-inline: auto; }

@media (prefers-color-scheme: dark) {
  .wave path {
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--aurora) 50%, transparent));
  }
}

/* Haus */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding-block: var(--s3);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.brand-mark { width: 1.75rem; height: 1.75rem; }
.brand-mark path {
  fill: none;
  stroke: var(--aurora);
  stroke-width: 3;
  stroke-linecap: round;
}
.site-header nav { display: none; }
.site-header nav ul {
  display: flex;
  gap: var(--s1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--s2);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a:focus-visible { color: var(--accent); text-decoration: underline; }

.hero { padding-top: var(--s6); }
.hero h1 {
  font-size: var(--fs-h1);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.lede {
  font-family: var(--font-head);
  font-size: var(--fs-h3);
  color: var(--muted);
  margin-top: var(--s3);
  max-width: 40ch;
}
.intro { max-width: 65ch; margin-top: var(--s4); }

/* Kaflar */
main { display: block; }
.section { padding-block: var(--s7); }
.section h2 {
  font-size: var(--fs-h2);
  margin-bottom: var(--s4);
}
.section h3 { font-size: var(--fs-h3); }
.prose h3 { margin: var(--s5) 0 var(--s3); }

.eyebrow,
.role {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--melur);
  margin-bottom: var(--s2);
}

/* Íbúarnir */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
.card {
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s4);
  overflow-wrap: anywhere;
}
.card h3 { margin-bottom: var(--s2); }
.card p:not(.role) { font-size: var(--fs-sm); margin: 0; }

.human {
  max-width: 65ch;
  margin-top: var(--s5);
  padding-left: var(--s4);
  border-left: 2px solid var(--line);
}
.human h3 { margin-bottom: var(--s2); }
.human p:last-child { margin: 0; }

.names { margin-top: var(--s5); }
.names h3 { margin-top: 0; }

/* Reglur */
.rules {
  list-style: none;
  counter-reset: regla;
  margin: var(--s5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s4) var(--s5);
}
.rules li {
  counter-increment: regla;
  position: relative;
  padding-left: 2.75rem;
  max-width: 65ch;
}
.rules li::before {
  content: counter(regla);
  position: absolute;
  left: 0;
  top: -0.2em;
  font-family: var(--font-head);
  font-variation-settings: "SOFT" 50, "WONK" 0;
  font-size: var(--fs-h2);
  line-height: 1;
  color: var(--melur);
}
.rules li.key {
  border-left: 2px solid var(--accent);
  padding-left: calc(2.75rem + var(--s3));
}
.rules li.key::before { left: var(--s3); }

.footnote {
  max-width: 65ch;
  margin-top: var(--s5);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.sub { margin: var(--s6) 0 var(--s4); }

.ladder {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s2);
}
.ladder li {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  background: var(--surface);
  border-top: 2px solid var(--aurora);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: var(--s3);
}
.ladder li:nth-child(2) { margin-left: var(--s3); }
.ladder li:nth-child(3) { margin-left: calc(2 * var(--s3)); }
.ladder li:nth-child(4) { margin-left: calc(3 * var(--s3)); }
.ladder li:nth-child(5) { margin-left: calc(4 * var(--s3)); }
.ladder .num {
  font-family: var(--font-head);
  font-size: var(--fs-h3);
  color: var(--melur);
  line-height: 1;
}
.ladder .name { font-weight: 600; }
.ladder-note {
  margin-top: var(--s4);
  font-family: var(--font-head);
  font-style: italic;
  font-size: var(--fs-h3);
  max-width: 40ch;
}

/* Leið verksins */
.path {
  list-style: none;
  margin: var(--s5) 0 0;
  padding: 0;
  max-width: 65ch;
}
.path li {
  position: relative;
  padding: 0 0 var(--s5) var(--s6);
}
.path li::before { /* lóðrétt lína */
  content: "";
  position: absolute;
  left: 5px;
  top: 0.5rem;
  bottom: -0.5rem;
  width: 2px;
  background: var(--line);
}
.path li:last-child::before { display: none; }
.path li::after { /* hringur */
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.path li.gate::after { background: var(--accent); }
.path .num {
  position: absolute;
  left: 1.5rem;
  top: 0.1rem;
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--melur);
}
.path h3 { margin-bottom: var(--s1); }
.path p { margin: 0; }
.tag {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Lærdómur */
.essays {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s5);
}
.essays article {
  border-top: 1px solid var(--line);
  padding-top: var(--s3);
  max-width: 65ch;
}
.essays h3 { margin-bottom: var(--s3); }

/* Samband */
.contact {
  max-width: 65ch;
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--s5) var(--s4);
}
.contact h3 { margin-bottom: var(--s2); }
.contact h3 + p { margin-bottom: var(--s5); }
.contact p:last-child { margin: 0; }
.mail {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-head);
  font-size: var(--fs-h3);
  overflow-wrap: anywhere;
}
.small { font-size: var(--fs-sm); color: var(--muted); }

/* Fótur */
.site-footer {
  padding-bottom: var(--s5);
}
.site-footer .wave { margin-bottom: var(--s4); }
.site-footer p {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: 0;
}
.site-footer a { color: var(--muted); overflow-wrap: anywhere; }

/* 404 */
.notfound { padding-block: var(--s7); min-height: 60vh; }
.notfound h1 { font-size: var(--fs-h1); font-weight: 400; margin-bottom: var(--s4); }

/* Brotpunktar */
@media (min-width: 48rem) {
  .site-header nav { display: block; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .contact { padding: var(--s5); }
}

@media (min-width: 56rem) {
  .rules { grid-template-columns: 1fr 1fr; }

  .ladder {
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    gap: var(--s2);
  }
  .ladder li {
    flex-direction: column;
    gap: var(--s1);
    min-height: 0;
  }
  .ladder li:nth-child(n) { margin-left: 0; }
  .ladder li:nth-child(1) { padding-top: var(--s3); }
  .ladder li:nth-child(2) { padding-top: calc(var(--s3) + 1.25rem); }
  .ladder li:nth-child(3) { padding-top: calc(var(--s3) + 2.5rem); }
  .ladder li:nth-child(4) { padding-top: calc(var(--s3) + 3.75rem); }
  .ladder li:nth-child(5) { padding-top: calc(var(--s3) + 5rem); }
  .ladder .num { font-size: var(--fs-h2); }

  .path {
    max-width: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    column-gap: var(--s5);
  }
  .path li:nth-child(4)::before { display: none; }

  .essays { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
}

@media (min-width: 72rem) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

/* Hreyfing: aðeins ef notandi hefur ekki beðið um minni hreyfingu */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  a { transition: text-decoration-thickness .15s ease, color .15s ease; }
  .skip { transition: transform .15s ease; }
  .wave-lg path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: teikna 1.6s ease-out .2s forwards;
  }
  @keyframes teikna { to { stroke-dashoffset: 0; } }
}

/* Endurskoðun 2026-11-16: lýsing á hverju sjálfstæðisstigi, listi í meginmáli, lokalína í fæti */
.ladder li { flex-wrap: wrap; }
.ladder .desc { flex-basis: 100%; color: var(--muted); font-size: var(--fs-sm); }
.prose ul { padding-left: 1.2em; margin: 0 0 var(--s4); }
.prose ul li { margin-bottom: var(--s2); }
.colophon { color: var(--muted); font-size: var(--fs-xs); margin-top: var(--s2); }
