:root {
  --bg: #0b0a1a;
  --ink: #f4f1ff;
  --muted: #a49fc4;
  --faint: #5d5884;
  --glass: rgba(24, 22, 44, 0.78);
  --glass-2: rgba(36, 33, 62, 0.85);
  --line: rgba(255, 255, 255, 0.1);

  --pink: #ff3d81;
  --orange: #ffa62b;
  --cyan: #2de2e6;
  --violet: #8b5cff;
  --lime: #c6ff3d;

  --hot: linear-gradient(135deg, var(--pink), var(--orange));
  --cool: linear-gradient(135deg, var(--violet), var(--cyan));

  --radius: 22px;
  --display: "Unbounded", "Space Grotesk", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- bakgrunn ---------- */
.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; filter: blur(120px) saturate(.8); opacity: .25; }
.blob { position: absolute; border-radius: 50%; animation: drift 40s ease-in-out infinite alternate; }
.b1 { width: 55vw; height: 55vw; background: var(--pink); top: -20vw; left: -15vw; }
.b2 { width: 45vw; height: 45vw; background: var(--violet); top: 30vh; right: -15vw; animation-delay: -8s; }
.b3 { width: 40vw; height: 40vw; background: var(--cyan); bottom: -20vw; left: 25vw; opacity: .6; animation-delay: -16s; }
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vw, 4vh) scale(1.1); }
  100% { transform: translate(-4vw, 8vh) scale(.95); }
}

/* ---------- topp ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.6rem clamp(1rem, 4vw, 3rem) .5rem;
}

.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: .02em; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 18px var(--pink); }
.brand-sub { color: var(--muted); font-weight: 400; }

.year-nav { position: relative; display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1.5rem); }
.year-head { margin: 0; font-size: inherit; }
.year-btn {
  position: relative; display: block; padding: 0 .1em; border: 0; background: none; cursor: pointer;
  border-radius: 18px; color: var(--ink); font: inherit;
}
.year-caret {
  position: absolute; left: 50%; bottom: -1.1rem; width: 22px; height: 22px; translate: -50% 0;
  fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  opacity: .55; transition: opacity .2s, transform .2s, stroke .2s;
}
.year-btn:hover .year-caret, .year-btn[aria-expanded="true"] .year-caret { opacity: 1; stroke: var(--orange); }
.year-btn[aria-expanded="true"] .year-caret { transform: rotate(180deg); }
.year-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; }

.year-picker {
  position: absolute; top: calc(100% + 1.4rem); left: 50%; translate: -50% 0; z-index: 20;
  width: min(560px, calc(100vw - 2rem)); padding: .8rem;
  background: rgba(20, 18, 38, .96); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 61, 129, .12);
  animation: picker-in .18s ease-out;
}
.year-picker[hidden] { display: none; }
@keyframes picker-in { from { opacity: 0; transform: translateY(-6px); } }
.year-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: .3rem;
  max-height: min(340px, 55vh); overflow-y: auto; padding: .2rem; scrollbar-width: thin;
}
.yp-year {
  padding: .55rem 0; border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  background: none; color: var(--muted); font: 500 .9rem var(--body); font-variant-numeric: tabular-nums;
  transition: background .15s, color .15s;
}
.yp-year:hover, .yp-year:focus-visible { background: var(--glass-2); color: var(--ink); outline: none; border-color: var(--line); }
.yp-year.is-now { color: var(--cyan); border-color: rgba(45, 226, 230, .45); }
.yp-year.is-selected { background: var(--hot); color: #120c22; font-weight: 700; border-color: transparent; }
.yp-year.is-selected:focus-visible { box-shadow: 0 0 0 3px rgba(45, 226, 230, .5); }
.year {
  display: block;
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.5rem, 11vw, 8.5rem);
  line-height: .9;
  letter-spacing: -.04em;
  background: linear-gradient(120deg, #fff 10%, var(--orange) 45%, var(--pink) 70%, var(--violet));
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
  animation: shimmer 8s linear infinite;
  min-width: 4.2ch; text-align: center;
}
.year.pop { animation: shimmer 8s linear infinite, pop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pop { 0% { transform: scale(.85) rotate(-2deg); opacity: .3; } 100% { transform: none; opacity: 1; } }

.nav-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(12px);
  color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s, background .2s, box-shadow .2s;
}
.nav-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn:hover { background: var(--hot); border-color: transparent; transform: scale(1.08); box-shadow: 0 10px 30px -8px var(--pink); }
.nav-btn:active { transform: scale(.95); }
.nav-btn[aria-disabled="true"] { opacity: .3; cursor: default; pointer-events: none; }

.tools { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; }

.pill {
  padding: .65rem 1.2rem; border-radius: 999px; border: 0; cursor: pointer;
  font: 700 .95rem var(--body); color: #120c22; background: var(--lime);
  transition: transform .2s, box-shadow .2s;
}
.pill:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -8px var(--lime); }

/* ---------- land/region ---------- */
.place { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: 0 0 1.2rem; }
.select { position: relative; display: inline-flex; }
.select select {
  appearance: none; -webkit-appearance: none;
  font: 500 1rem var(--body); color: var(--ink);
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  padding: .6rem 2.6rem .6rem 1.1rem; cursor: pointer; max-width: 80vw;
  transition: border-color .2s, box-shadow .2s;
}
.select select[hidden] { display: none; }
.select:has(select[hidden]) { display: none; }
.select::after {
  content: ""; position: absolute; right: 1.1rem; top: 50%; width: 7px; height: 7px; pointer-events: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg);
}
.select select:hover { border-color: rgba(255, 255, 255, .25); }
.select select:focus-visible { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(45, 226, 230, .2); }
.select option { background: #17152b; color: var(--ink); }

/* ---------- hero ---------- */
main { padding: 1rem clamp(1rem, 4vw, 3rem) 2rem; max-width: 1600px; margin: 0 auto; }

.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

.next-card {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--radius); padding: 1.4rem 1.6rem;
  color: #1a0a1f; background: var(--hot);
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; column-gap: 1rem;
  font-family: var(--body);
  box-shadow: 0 24px 60px -24px var(--pink);
  transition: transform .25s;
}
.next-card::before {
  content: ""; position: absolute; width: 260px; height: 260px; right: -60px; top: -110px;
  border-radius: 50%; border: 40px solid rgba(255, 255, 255, .18);
}
.next-card:hover { transform: translateY(-3px) rotate(-.3deg); }
.next-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; opacity: .7; }
.next-name { font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 3vw, 2.2rem); line-height: 1.1; margin-top: .3rem; }
.next-date { font-weight: 500; opacity: .8; margin-top: .25rem; }
.next-count {
  grid-column: 2; grid-row: 1 / 4; align-self: center; text-align: center; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
}
.next-count b { font-family: var(--display); font-size: clamp(2.8rem, 6vw, 4.5rem); line-height: 1; }
.next-count small { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat {
  border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(14px); padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .2rem;
}
.stat b { font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 2.2rem); line-height: 1; white-space: nowrap; }
.stat:nth-child(1) b { color: var(--orange); }
.stat:nth-child(2) b { color: var(--cyan); }
.stat:nth-child(3) b { color: var(--lime); }
.stat span { color: var(--muted); font-size: .85rem; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }

.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.months.anim .month { animation: rise .5s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 28ms); }
.months.anim[data-dir="back"] .month { animation-name: rise-back; }
@keyframes rise { from { opacity: 0; transform: translate(30px, 14px) scale(.96); } }
@keyframes rise-back { from { opacity: 0; transform: translate(-30px, 14px) scale(.96); } }

.month {
  position: relative;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px);
  padding: 1rem 1rem 1.1rem;
  transition: transform .25s, border-color .25s, background .25s;
}
.month:hover { z-index: 3; transform: translateY(-4px); border-color: rgba(255, 255, 255, .22); background: var(--glass-2); }
.month.is-current { border-color: transparent; background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--cool) border-box; border: 2px solid transparent; }
.month.is-current .month-head h3::after { content: attr(data-now); margin-left: .5rem; font: 700 .65rem var(--body); text-transform: uppercase; letter-spacing: .12em; color: var(--cyan); vertical-align: middle; }

.month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.month-head h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.05rem; text-transform: capitalize; letter-spacing: -.01em; }
.badge {
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: var(--hot); color: #1a0a1f;
}

.days { display: grid; grid-template-columns: 1.6rem repeat(7, 1fr); gap: 3px; font-variant-numeric: tabular-nums; }
.days.no-weeks { grid-template-columns: repeat(7, 1fr); }
.wd, .wk-h { font-size: .66rem; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .04em; padding-bottom: .3rem; }
.wk-h { color: var(--faint); }
.wd.sun { color: var(--pink); }
.wk { font-size: .66rem; color: var(--faint); display: grid; place-items: center; }

.day {
  position: relative;
  aspect-ratio: 1; display: grid; place-items: center;
  font-size: .85rem; border-radius: 10px;
  transition: transform .15s, background .15s;
}
.day:not(.empty):hover { background: rgba(255, 255, 255, .1); transform: scale(1.12); }
.day.sat { color: #d5d0ee; }
.day.sun { color: var(--pink); font-weight: 700; }

.day.holiday {
  background: var(--hot); color: #1a0a1f; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(255, 61, 129, .8);
}
.day.holiday:hover { transform: scale(1.18) rotate(-4deg); }

.day.today { outline: 2px solid var(--cyan); outline-offset: 1px; box-shadow: 0 0 18px rgba(45, 226, 230, .6); color: var(--cyan); font-weight: 700; }
.day.today.holiday { color: #1a0a1f; }
.day.spot { transform: scale(1.25) rotate(-4deg); z-index: 2; box-shadow: 0 0 0 3px var(--lime), 0 10px 30px -6px var(--lime); }
.day.flash { animation: flash 1.2s ease-out; z-index: 2; }
@keyframes flash {
  0%, 30% { transform: scale(1.5) rotate(-8deg); box-shadow: 0 0 0 4px var(--lime), 0 0 40px var(--lime); }
  100% { transform: none; }
}

/* tooltip */
.day[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translate(-50%, 4px); opacity: 0; pointer-events: none;
  white-space: nowrap; padding: .4rem .65rem; border-radius: 8px;
  background: #fff; color: #1a0a1f; font: 700 .75rem var(--body);
  box-shadow: 0 10px 30px -10px #000;
  transition: opacity .15s, transform .15s; z-index: 5;
}
.day[data-tip]:hover::after, .day.spot[data-tip]::after { opacity: 1; transform: translate(-50%, 0) rotate(4deg); }

/* ---------- sidepanel ---------- */
.side {
  position: sticky; top: 1rem;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); padding: 1.2rem;
}
.side h2 { margin: 0 0 1rem; font-family: var(--display); font-size: 1.1rem; font-weight: 600; }
.side h2 .side-year { color: var(--orange); }

.holiday-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.hl {
  display: flex; gap: .8rem; align-items: center;
  padding: .5rem .6rem; border-radius: 14px; cursor: pointer;
  transition: background .2s, transform .2s;
  outline: none;
}
.hl:hover, .hl:focus-visible { background: var(--glass-2); transform: translateX(4px); }
.hl:focus-visible { box-shadow: 0 0 0 2px var(--cyan); }
.hl-date {
  flex: none; width: 48px; height: 48px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--hot); color: #1a0a1f; line-height: 1;
}
.hl-date b { font-family: var(--display); font-size: 1.1rem; }
.hl-date small { font-size: .65rem; font-weight: 700; text-transform: uppercase; margin-top: 2px; }
.hl.k-påske .hl-date { background: linear-gradient(135deg, #ffe14d, var(--orange)); }
.hl.k-pinse .hl-date { background: linear-gradient(135deg, var(--lime), #3dffa8); }
.hl.k-jul .hl-date { background: linear-gradient(135deg, #ff4d4d, var(--pink)); }
.hl.k-nasjonal .hl-date { background: linear-gradient(135deg, #4d8bff, var(--pink)); }
.hl.k-fast .hl-date { background: var(--cool); }
.hl-body { display: flex; flex-direction: column; min-width: 0; }
.hl-name { font-weight: 700; }
.hl-meta { font-size: .8rem; color: var(--muted); }
.hl-local { font-size: .75rem; color: var(--faint); font-style: italic; }
.hl.past { opacity: .6; }
.hl.past .hl-date { filter: saturate(.35); }
.hl.past:hover { opacity: 1; }
.hl.now .hl-name::after { content: " 🎉"; }

/* farger per type også i kalenderen */
.day.k-påske { background: linear-gradient(135deg, #ffe14d, var(--orange)); }
.day.k-pinse { background: linear-gradient(135deg, var(--lime), #3dffa8); box-shadow: 0 6px 16px -6px rgba(198, 255, 61, .7); }
.day.k-jul { background: linear-gradient(135deg, #ff4d4d, var(--pink)); }
.day.k-nasjonal { background: linear-gradient(135deg, #4d8bff, var(--pink)); color: #fff; }
.day.k-fast { background: var(--cool); color: #0b0a1a; }

/* julaften/nyttårsaften: vanlig fridag, ikke offisiell – stiplet ramme */
.day.k-aften {
  background: rgba(255, 77, 109, .14); color: #ffb3c4; font-weight: 700;
  box-shadow: inset 0 0 0 2px transparent; outline: 2px dashed rgba(255, 120, 150, .75); outline-offset: -3px;
}
.day.k-aften.today { outline: 2px solid var(--cyan); outline-offset: 1px; }
.hl.k-aften .hl-date { background: rgba(255, 77, 109, .12); color: #ffb3c4; outline: 2px dashed rgba(255, 120, 150, .75); outline-offset: -2px; }
.tag {
  font-style: normal; font-weight: 500; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .4rem; margin-left: .3rem;
  vertical-align: middle; white-space: nowrap;
}

.legend { display: flex; flex-wrap: wrap; gap: .9rem; margin: 1.2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.sw-holiday { background: var(--hot); }
.sw-unofficial { border: 2px dashed rgba(255, 120, 150, .85); }
.sw-sunday { border: 2px solid var(--pink); }
.sw-today { border: 2px solid var(--cyan); box-shadow: 0 0 8px var(--cyan); }

/* ---------- bunn ---------- */
.foot { text-align: center; color: var(--faint); font-size: .8rem; line-height: 1.6; padding: 1rem 1rem 2.5rem; }
.foot a { color: var(--muted); }
.foot .about { margin: 0 auto .6rem; max-width: 60ch; }
.explore { display: grid; gap: .5rem; margin: 0 auto 1.4rem; max-width: 70ch; }
.explore h2 { margin: 0; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.explore ul { list-style: none; margin: 0 0 .4rem; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem .9rem; }
.explore a { text-decoration: none; }
.explore a:hover, .explore a[aria-current] { color: var(--ink); }
.explore a[aria-current] { font-weight: 700; }
kbd { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 0 .35rem; color: var(--muted); }

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

/* ---------- responsivt ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .holiday-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 860px) {
  .top { grid-template-columns: 1fr auto; }
  .year-nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .brand-sub { display: none; }
  .year-grid { grid-template-columns: repeat(5, 1fr); }
  .nav-btn { width: 46px; height: 46px; }
  .stats { gap: .6rem; }
  .stat { padding: .9rem; }
}

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