/* Kennsluvefur Á ferðinni */

:root {
  --ink: #101215;
  --ink-soft: #3a3f46;
  --muted: #63686f;
  --line: #e4e6e9;
  --bg: #f8f9fa;
  --card: #ffffff;
  --accent: #16181c;
  --accent-dark: #000000;
  --accent-soft: #ecedf0;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  --font: ui-sans-serif, -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.btn:hover { background: var(--accent-dark); }

/* ---------- Gátt ---------- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #ecedf0, transparent 70%),
    var(--bg);
}

.gate-card {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 30px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.gate-back {
  display: inline-block;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.gate-back:hover { color: var(--accent); }

.lang-toggle {
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
  min-height: 34px;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent-dark); }

.lock-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate h1 { font-size: 1.5rem; margin-bottom: 8px; }
.gate-lead { color: var(--muted); font-size: 15.5px; margin-bottom: 22px; }

#gateForm { display: grid; gap: 12px; }

#password {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fbfbfc;
}
#password:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}

.gate-error {
  margin: 0;
  color: #b42318;
  font-size: 14px;
}

.gate-help {
  margin: 20px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}
.gate-help a { color: var(--accent-dark); white-space: nowrap; }

.gate[hidden] { display: none !important; }

/* ---------- Lesari ---------- */

.reader { min-height: 100vh; }

.reader-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(248, 249, 250, .94);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.reader-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
}
.reader-logo {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.reader-brand em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  font-size: 14px;
  margin-left: 4px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout {
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 44px;
}
.logout:hover { border-color: var(--accent); color: var(--accent-dark); }

.reader-body {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 40px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 22px 80px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 84px;
  min-width: 0;
  border-right: 1px solid var(--line);
  padding-right: 20px;
}

.toc-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 12px;
}

#tocNav { display: grid; gap: 2px; }

#tocNav button {
  text-align: left;
  background: none;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1.35;
}
#tocNav button:hover { background: var(--accent-soft); color: var(--accent-dark); }
#tocNav button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.toc-nav { display: grid; gap: 2px; }

.toc-group { display: grid; gap: 2px; margin-bottom: 14px; }
.toc-group:last-child { margin-bottom: 0; }

.toc-section {
  margin: 0 0 4px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-select {
  display: none;
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

.article {
  max-width: 700px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 36px;
  box-shadow: var(--shadow);
  scroll-margin-top: 84px;
}
.article:focus { outline: none; }

.chapter-kicker {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.article h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin-bottom: 18px; }
.article h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.article p { color: var(--ink-soft); }

.article ul { padding-left: 0; list-style: none; display: grid; gap: 8px; margin: 0 0 8px; }
.article ul li { position: relative; padding-left: 26px; color: var(--ink-soft); }
.article ul li::before {
  content: "";
  position: absolute;
  left: 3px; top: 8px;
  width: 11px; height: 7px;
  border-left: 2.5px solid var(--accent);
  border-bottom: 2.5px solid var(--accent);
  transform: rotate(-45deg);
}

.note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 26px 0 6px;
}
.note h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-dark); margin-bottom: 6px; }
.note p { margin: 0; color: var(--ink-soft); font-size: 15.5px; }

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.pager {
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 15px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  max-width: 48%;
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.pager:hover { border-color: var(--accent); color: var(--accent-dark); }
.pager.next { text-align: right; margin-left: auto; }

.loading { color: var(--muted); }

@media (max-width: 860px) {
  .reader-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 20px 16px 60px;
    scroll-margin-top: 76px;
  }
  .toc {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 16px;
    overflow: visible;
  }
  .page-select { display: block; }
  #tocNav { display: none; }
  .article {
    max-width: 700px;
    margin: 0 auto;
    padding: 26px 20px;
    border-radius: 18px;
    scroll-margin-top: 76px;
  }
  .gate-card { padding: 28px 22px 24px; }
}

@media (max-width: 480px) {
  .reader-brand em { display: none; }
  .pager { font-size: 13.5px; padding: 12px 13px; max-width: 47%; }
  .chapter-nav { gap: 10px; }
}

/* ---------- Upplestur ---------- */

.article-tools {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 6px;
}

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.read-btn svg { flex: 0 0 auto; }
.read-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.read-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Flettispjöld ---------- */

.cards-progress {
  margin: -4px 0 16px;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.flash-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  padding: 34px 26px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  animation: cardIn .18s ease;
}
.flash-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 179, 61, .55), var(--shadow);
}
.flash-card[data-flipped="true"] {
  background: var(--accent-soft);
  border-color: #cbdcef;
}

.flash-card-tag {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--accent);
}

.flash-card-text {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
}

.flash-card-hint {
  font-size: 13px;
  color: var(--muted);
}

.flash-card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.cards-btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 11px 14px;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.cards-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

@keyframes cardIn {
  from { opacity: .35; transform: scale(.985); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .flash-card { min-height: 180px; padding: 26px 20px; }
  .flash-card-text { font-size: 1.05rem; }
}

/* ---------- Myndbönd ---------- */

.video-list { display: grid; gap: 26px; }

.video-item h2 { font-size: 1.1rem; margin-bottom: 10px; }

.video-frame {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
}
.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-item p { margin: 10px 0 0; color: var(--ink-soft); font-size: 15px; }

/* ---------- Heimildir ---------- */

.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.source-list li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.source-list a { color: var(--accent-dark); text-decoration: none; }
.source-list a:hover { text-decoration: underline; }
.source-list p { margin: 8px 0 0; color: var(--ink-soft); font-size: 15px; }
.source-publisher {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Mynd á spjaldi ---------- */

.flash-card-image {
  margin: 0 0 6px;
  display: flex;
  justify-content: center;
}
.flash-card-image img {
  max-width: 180px;
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

