:root {
  --ink: #163538;
  --muted: #5f7475;
  --paper: #f7f7f2;
  --card: #ffffff;
  --line: #dce5e2;
  --brand: #0b5d62;
  --brand-dark: #073f43;
  --accent: #f0c966;
  --shadow: 0 18px 45px rgba(18, 58, 59, 0.11);
  --radius: 24px;
  --font-scale: 1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; font-size: calc(16px * var(--font-scale)); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Avenir, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
.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; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; padding: 12px 18px; border-radius: 10px; background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 12px clamp(20px, 4vw, 64px);
  background: rgba(247, 247, 242, 0.91);
  border-bottom: 1px solid rgba(22, 53, 56, 0.09);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.12; }
.brand strong { font-family: Georgia, serif; font-size: 1.22rem; letter-spacing: -0.02em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 13px); gap: 3px; width: 31px; height: 31px; transform: rotate(-2deg); }
.brand-mark i { display: block; border-radius: 3px; background: var(--brand); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--accent); }
.brand-mark.small { grid-template-columns: repeat(2, 10px); width: 24px; height: 24px; gap: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn, .teacher-btn, .schedule-btn, .add-btn, .text-btn, .primary-btn, .secondary-btn, .close-btn {
  border: 0;
  cursor: pointer;
}
.icon-btn { min-width: 42px; min-height: 42px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; }
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--brand); transform: translateY(-1px); }
.teacher-btn { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-left: 5px; padding: 0 17px; border-radius: 13px; background: var(--brand); color: #fff; font-weight: 800; box-shadow: 0 8px 20px rgba(11, 93, 98, 0.2); }
.teacher-btn.active { background: var(--accent); color: #274547; }

main { overflow: hidden; }
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  align-items: center;
  gap: clamp(35px, 6vw, 90px);
  min-height: 620px;
  padding: 72px clamp(24px, 7vw, 112px) 78px;
  background:
    radial-gradient(circle at 70% 16%, rgba(240, 201, 102, 0.17), transparent 26%),
    linear-gradient(135deg, #edf5f0 0%, #f8f7ef 55%, #e9f1ec 100%);
}
.hero::before { content: ""; position: absolute; inset: 0; opacity: 0.28; background-image: radial-gradient(#638082 0.7px, transparent 0.7px); background-size: 21px 21px; mask-image: linear-gradient(to right, #000, transparent 58%); }
.hero-copy { position: relative; z-index: 2; max-width: 720px; }
.eyebrow, .section-kicker { margin: 0 0 14px; color: var(--brand); font-size: 0.76rem; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow span { width: 24px; height: 3px; border-radius: 4px; background: var(--accent); }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.5rem, 6vw, 6.5rem); font-weight: 500; line-height: 0.93; letter-spacing: -0.055em; }
h1 em { color: var(--brand); font-weight: 500; }
.hero-lead { max-width: 610px; margin: 28px 0 29px; color: #4f696a; font-size: 1.12rem; line-height: 1.72; }
.search-wrap { display: flex; align-items: center; max-width: 670px; min-height: 62px; padding: 0 16px 0 20px; border: 1px solid rgba(11, 93, 98, 0.2); border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 15px 36px rgba(29, 73, 72, 0.1); }
.search-wrap > span { margin-right: 12px; color: var(--brand); font-size: 1.8rem; line-height: 1; transform: rotate(-18deg); }
.search-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.search-wrap kbd { padding: 6px 8px; border: 1px solid #dbe3df; border-bottom-width: 2px; border-radius: 7px; background: #f7f8f5; color: #718181; font-size: 0.68rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 28px; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.hero-stats span { display: flex; align-items: baseline; gap: 6px; }
.hero-stats strong { color: var(--brand); font-family: Georgia, serif; font-size: 1.35rem; }
.hero-visual { position: relative; width: min(540px, 42vw); aspect-ratio: 1; justify-self: center; }
.orbit { position: absolute; border: 1px dashed rgba(11, 93, 98, 0.23); border-radius: 50%; }
.orbit-one { inset: 7%; }
.orbit-two { inset: 23%; }
.hero-center { position: absolute; inset: 36%; display: grid; place-content: center; text-align: center; border: 7px solid rgba(255,255,255,.72); border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 25px 60px rgba(8, 71, 75, .23); }
.hero-center span { font-family: Georgia, serif; font-size: clamp(2.2rem, 4vw, 4rem); line-height: .9; }
.hero-center small { margin-top: 4px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.hero-card { position: absolute; display: grid; grid-template-columns: 42px auto; column-gap: 10px; align-items: center; min-width: 180px; padding: 15px 17px; border: 1px solid rgba(22,53,56,.09); border-radius: 18px; background: rgba(255,255,255,.93); box-shadow: var(--shadow); }
.hero-card > span { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #eef5f2; font-size: 1.35rem; }
.hero-card b { font-size: .88rem; }
.hero-card small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.card-a { top: 4%; left: 4%; transform: rotate(-3deg); }
.card-b { top: 20%; right: -3%; transform: rotate(3deg); }
.card-c { bottom: 5%; left: 8%; transform: rotate(2deg); }
.card-d { right: 0; bottom: 17%; transform: rotate(-2deg); }

.quick-section, .subjects-section, .resources-section, .teacher-panel { padding: 76px clamp(24px, 7vw, 112px); }
.quick-section { padding-top: 45px; padding-bottom: 10px; background: #fff; }
.subjects-section { background: #fff; }
.section-heading, .resource-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.section-heading.compact { margin-bottom: 20px; }
.section-heading h2, .resource-toolbar h2, .teacher-panel h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.1rem, 3.4vw, 3.35rem); font-weight: 500; letter-spacing: -.035em; }
.section-heading p:not(.section-kicker), .resource-toolbar p:not(.section-kicker), .teacher-panel-copy > p:last-child { max-width: 650px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.schedule-btn, .add-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 0 18px; border: 1px solid #cddbd6; border-radius: 14px; background: #f5f8f5; color: var(--brand); font-weight: 850; white-space: nowrap; }
.schedule-btn:hover, .add-btn:hover { border-color: var(--brand); background: #eaf3ef; }

.subject-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.subject-tile { position: relative; min-height: 178px; padding: 18px; overflow: hidden; border: 2px solid transparent; border-radius: 22px; background: var(--subject-soft); text-align: left; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.subject-tile:hover, .subject-tile:focus-visible { transform: translateY(-4px); border-color: var(--subject); box-shadow: 0 18px 32px rgba(26,55,55,.11); outline: 0; }
.subject-tile.active { border-color: var(--subject); box-shadow: 0 14px 28px rgba(26,55,55,.12); }
.subject-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 26px; border-radius: 15px; background: rgba(255,255,255,.75); font-size: 1.55rem; box-shadow: 0 8px 20px rgba(33,60,59,.06); }
.subject-tile h3 { margin: 0; font-size: .98rem; line-height: 1.2; }
.subject-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: #5e7371; font-size: .72rem; font-weight: 750; }
.subject-arrow { position: absolute; right: 15px; top: 16px; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: rgba(255,255,255,.68); color: var(--subject); }
.subject-empty::after { content: "Efni væntanlegt"; position: absolute; right: 12px; bottom: 11px; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.7); color: #667775; font-size: .61rem; font-weight: 800; }

.resources-section { background: var(--paper); }
.resource-toolbar { align-items: center; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.sort-label { color: var(--muted); font-size: .8rem; font-weight: 750; }
select { min-height: 44px; padding: 0 38px 0 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.add-btn { border-color: var(--brand); background: var(--brand); color: #fff; }
.active-filter { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: -8px 0 22px; padding: 11px 14px; border-left: 4px solid var(--brand); border-radius: 8px; background: #eaf2ef; color: var(--brand-dark); font-size: .84rem; font-weight: 750; }
.active-filter button { border: 0; background: transparent; color: var(--brand); cursor: pointer; font-weight: 850; }
.resource-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.resource-card { position: relative; display: flex; flex-direction: column; min-height: 300px; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: 0 8px 24px rgba(27,55,54,.045); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.resource-card:hover { transform: translateY(-4px); border-color: var(--subject); box-shadow: var(--shadow); }
.resource-card::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 5px; background: var(--subject); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.resource-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--subject-soft); color: var(--subject); font-size: 1.55rem; font-weight: 900; }
.favorite-btn, .edit-card-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.favorite-btn { margin-left: auto; color: #8b9998; font-size: 1.3rem; }
.favorite-btn.active { border-color: #e5c35a; background: #fff8dd; color: #c08f00; }
.edit-card-btn { color: var(--brand); font-size: 1rem; }
.resource-card h3 { margin: 20px 0 8px; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.resource-card > p { flex: 1; margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.62; }
.resource-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 17px 0; }
.resource-tags span { padding: 4px 8px; border-radius: 999px; background: #f1f4f1; color: #657775; font-size: .63rem; font-weight: 800; }
.resource-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 15px; border-top: 1px solid #edf0ed; }
.subject-label { display: inline-flex; align-items: center; gap: 6px; color: var(--subject); font-size: .68rem; font-weight: 900; }
.subject-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.open-link { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--brand); font-size: .78rem; font-weight: 900; }
.open-link::after { content: "↗"; transition: transform .2s ease; }
.open-link:hover::after { transform: translate(2px,-2px); }
.quick-grid { display: flex; gap: 10px; overflow-x: auto; padding: 3px 2px 20px; scrollbar-width: thin; }
.quick-card { display: flex; align-items: center; gap: 11px; min-width: 235px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; text-decoration: none; }
.quick-card:hover { border-color: var(--subject); }
.quick-card span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--subject-soft); }
.quick-card b { display: block; font-size: .79rem; }
.quick-card small { color: var(--muted); font-size: .65rem; }
.text-btn { padding: 7px; background: transparent; color: var(--brand); font-weight: 850; }
.empty-state { max-width: 520px; margin: 50px auto; text-align: center; }
.empty-state > span { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: #e7f0ec; color: var(--brand); font-size: 2.5rem; }
.empty-state h3 { margin: 18px 0 8px; font-family: Georgia, serif; font-size: 1.6rem; }
.empty-state p { color: var(--muted); }

.teacher-panel { margin: 0 clamp(24px, 7vw, 112px) 70px; padding: 42px; border: 1px solid #b9d0ca; border-radius: 30px; background: linear-gradient(120deg, #e4f0eb, #f5f4e8); }
.teacher-panel-copy { max-width: 750px; }
.teacher-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0 20px; }
.teacher-tools button { display: grid; grid-template-columns: 44px auto; column-gap: 11px; align-items: center; padding: 14px; border: 1px solid #c7dad5; border-radius: 16px; background: rgba(255,255,255,.78); text-align: left; cursor: pointer; }
.teacher-tools button:hover { border-color: var(--brand); background: #fff; }
.teacher-tools span { grid-row: 1/3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: #e3efeb; color: var(--brand); font-size: 1.3rem; }
.teacher-tools b { font-size: .85rem; }
.teacher-tools small { color: var(--muted); font-size: .68rem; }
.gap-report { padding: 16px 18px; border-radius: 15px; background: rgba(255,255,255,.7); }
.gap-report > strong { display: block; margin-bottom: 10px; font-size: .82rem; }
#gapList { display: flex; flex-wrap: wrap; gap: 7px; }
#gapList button { padding: 7px 11px; border: 1px solid #d2dfdb; border-radius: 999px; background: #fff; color: var(--brand); cursor: pointer; font-size: .73rem; font-weight: 800; }
.local-note { display: flex; gap: 8px; margin: 18px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }

footer { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 34px clamp(24px, 7vw, 112px); border-top: 1px solid #dce4e1; background: #eef1ec; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand div { display: flex; flex-direction: column; gap: 3px; }
.footer-brand strong { font-family: Georgia, serif; }
.footer-brand small { color: var(--muted); font-size: .7rem; }

.modal { width: min(680px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 28px; overflow: auto; border: 1px solid var(--line); border-radius: 26px; background: #fff; color: var(--ink); box-shadow: 0 40px 100px rgba(14,42,43,.3); }
.modal::backdrop { background: rgba(8,31,33,.58); backdrop-filter: blur(5px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.modal-head h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.modal-head p:not(.section-kicker) { margin: 7px 0 0; color: var(--muted); }
.close-btn { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #eef2ef; font-size: 1.5rem; }
.schedule-list { display: grid; gap: 8px; margin-bottom: 24px; }
.schedule-row { display: grid; grid-template-columns: 43px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--subject-soft); }
.schedule-row > span:first-child { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.8); font-size: 1.25rem; }
.schedule-row b { font-size: .84rem; }
.schedule-row strong { color: var(--subject); font-family: Georgia, serif; font-size: 1.1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { position: relative; display: grid; gap: 7px; color: #385254; font-size: .77rem; font-weight: 850; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid textarea, .form-grid select { width: 100%; padding: 12px 13px; border: 1px solid #ccdad7; border-radius: 12px; outline: 0; background: #fbfcfa; color: var(--ink); resize: vertical; font-weight: 500; }
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,93,98,.1); }
.form-grid label > small { position: absolute; right: 8px; bottom: 7px; color: #899493; font-size: .64rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.primary-btn, .secondary-btn { min-height: 46px; padding: 0 18px; border-radius: 13px; font-weight: 850; }
.primary-btn { background: var(--brand); color: #fff; }
.primary-btn.full { width: 100%; }
.secondary-btn { border: 1px solid var(--line); background: #f4f6f3; }
.toast { position: fixed; z-index: 120; right: 22px; bottom: 22px; max-width: min(380px, calc(100% - 44px)); padding: 13px 17px; border-radius: 13px; background: #173f41; color: #fff; font-size: .82rem; font-weight: 750; box-shadow: 0 14px 38px rgba(0,0,0,.2); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.high-contrast { --paper: #fff; --ink: #071313; --muted: #314647; --line: #8ba09d; --brand: #004f54; }
.high-contrast .resource-card, .high-contrast .subject-tile, .high-contrast .search-wrap { border-width: 2px; }

@media (max-width: 1180px) {
  .subject-grid { grid-template-columns: repeat(4, 1fr); }
  .resource-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr .85fr; }
  .hero-card { min-width: 155px; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 58px; }
  .hero-visual { width: min(560px, 82vw); }
  .resource-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
  .teacher-tools { grid-template-columns: 1fr; }
  .teacher-tools button { min-height: 72px; }
}
@media (max-width: 650px) {
  .topbar { min-height: 68px; }
  .brand small { display: none; }
  .teacher-btn { width: 44px; padding: 0; justify-content: center; font-size: 0; }
  .teacher-btn span { font-size: 1rem; }
  .contrast-btn { display: none; }
  .hero { min-height: auto; padding: 48px 20px 54px; }
  h1 { font-size: clamp(3rem, 14vw, 4.6rem); }
  .hero-lead { font-size: 1rem; }
  .search-wrap kbd { display: none; }
  .hero-visual { width: 94vw; max-width: 490px; margin-left: -8px; }
  .hero-card { min-width: 142px; padding: 10px; grid-template-columns: 34px auto; }
  .hero-card > span { width: 34px; height: 34px; font-size: 1.05rem; }
  .card-b { right: 0; }
  .card-d { right: 1%; }
  .quick-section, .subjects-section, .resources-section { padding: 55px 20px; }
  .section-heading, .resource-toolbar { align-items: flex-start; flex-direction: column; gap: 18px; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .subject-tile { min-height: 155px; }
  .subject-icon { margin-bottom: 18px; }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 280px; }
  .toolbar-actions { width: 100%; flex-wrap: wrap; }
  .toolbar-actions select { flex: 1; }
  .add-btn { flex: 1 0 100%; }
  .teacher-panel { margin: 0 20px 55px; padding: 28px 20px; }
  footer { align-items: flex-start; padding: 28px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
}
@media (max-width: 390px) {
  .icon-btn { min-width: 38px; min-height: 38px; }
  .top-actions { gap: 4px; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-tile { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
