:root {
  --red: #c8102e;
  --red-dark: #8f0b21;
  --accent: #f2c14e;
  --bg: #faf5f2;
  --surface: #f0e7e3;
  --card: #fff;
  --line: #e6d9d3;
  --text: #2b1518;
  --muted: #7d6a6c;
  --dark: #1d0b0e;
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; }
code { background: var(--surface); padding: 2px 6px; border-radius: 6px; font-size: .9em; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 76px);
  line-height: 1;
  font-weight: 850;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.stats { margin: 18px 0 0; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.stats b { color: var(--text); font-weight: 650; }
.stats i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: .5; display: inline-block; }

/* ---------- Startsida ---------- */

.hero {
  position: relative;
  color: #fff;
  padding: clamp(40px, 8vw, 96px) 0 calc(clamp(32px, 5vw, 56px) + clamp(20px, 3vw, 36px));
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400' fill='none' stroke='white' stroke-opacity='.11' stroke-width='4'%3E%3Ccircle cx='200' cy='200' r='120'/%3E%3Cpath d='M200 0V400M0 90H80V310H0M400 90H320V310H400'/%3E%3Ccircle cx='200' cy='200' r='7' fill='white' fill-opacity='.11' stroke='none'/%3E%3C/svg%3E") right -60px center / auto 170% no-repeat,
    radial-gradient(700px 360px at 90% -20%, rgba(255, 255, 255, .14), transparent 70%),
    linear-gradient(160deg, var(--red) 0%, var(--red-dark) 100%);
}
/* Snedskuren nederkant med guldlist */
.hero::before, .hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: clamp(20px, 3vw, 36px);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}
.hero::before { background: var(--accent); transform: translateY(-5px); }
.hero::after { background: var(--bg); }
.hero .stats, .hero .back { color: rgba(255, 255, 255, .78); }
.hero .stats b, .hero .back:hover { color: #fff; }
.hero .stats i { background: #fff; }
.hero-in { display: flex; align-items: center; gap: clamp(20px, 4vw, 44px); }
.crest {
  flex: none; display: grid; place-items: center;
  width: clamp(84px, 12vw, 132px); aspect-ratio: 1; border-radius: 50%;
  background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 0 0 4px rgba(255, 255, 255, .25);
}
.crest img { width: 52%; height: auto; }

.month { margin-top: 36px; }
.month h2 {
  margin: 0 0 16px;
  font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 22px; }

.card { display: block; border-radius: var(--radius); outline-offset: 4px; }
.card .thumb {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 4 / 3; border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 2px 10px rgba(80, 20, 30, .12);
}
.card .thumb img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.card .thumb::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(to top, rgba(40, 8, 14, .4), transparent 40%);
  pointer-events: none;
}
.card:hover .thumb img { transform: scale(1.045); }
.card { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.card .thumb { transition: transform .25s, box-shadow .25s; }
.card:hover .thumb { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(80, 20, 30, .22); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.tag {
  position: absolute; z-index: 1; left: 12px; top: 12px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #3a1b00; background: var(--accent);
}

.card em {
  position: absolute; z-index: 1; right: 10px; bottom: 10px;
  font-style: normal; font-size: 12px; font-weight: 650;
  padding: 4px 10px; border-radius: 999px;
  color: #fff; background: rgba(143, 11, 33, .82); backdrop-filter: blur(8px);
}
.card .info { display: grid; gap: 2px; padding: 14px 4px 0; }
.card strong { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.card small { color: var(--muted); font-size: 14px; }
.card time { color: var(--muted); font-size: 14px; }
.card:hover strong { color: var(--red); }

.empty { padding: 80px 0; text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); margin: 0 0 6px; }

/* ---------- Kommande matcher ---------- */

.next { margin-top: 32px; }
.next-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; }
.next-head h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.next-head a { font-size: 14px; font-weight: 600; color: var(--red); }
.next-head a:hover { text-decoration: underline; }

.next-list {
  list-style: none; margin: 0; padding: 4px 2px 10px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
}
.next-list::-webkit-scrollbar { display: none; }
.next-list li { scroll-snap-align: start; display: flex; }

.match {
  position: relative; flex: 1; display: flex; gap: 14px; align-items: center;
  padding: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.match:hover { border-color: var(--red); box-shadow: 0 4px 16px rgba(80, 20, 30, .12); }
.match.first { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }

.match .date {
  flex: none; width: 54px; padding: 8px 0; border-radius: 10px; text-align: center; line-height: 1.1;
  color: #fff; background: var(--red);
}
.match .date b { display: block; font-size: 22px; font-weight: 800; }
.match .date small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #fff; }
.match .what { display: grid; gap: 1px; min-width: 0; }
.match em { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.match strong { font-size: 16px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.match small { font-size: 13px; color: var(--muted); }
.match .when { font-size: 13px; color: var(--muted); }

/* ---------- Albumsida ---------- */

.head { padding-top: 0; padding-bottom: 0; }
.hero:has(.head) { padding-top: clamp(20px, 3vw, 32px); }
.grid { margin-top: clamp(20px, 3vw, 32px); }
.back {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 0 clamp(20px, 3vw, 32px) -4px; padding: 4px 8px 4px 2px;
  color: var(--muted); font-size: 14px; font-weight: 600; border-radius: 8px;
}
.text { max-width: 60ch; color: rgba(255, 255, 255, .85); margin: 14px 0 0; }
.actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 650;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  color: var(--text); background: var(--card); border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--muted); }
.hero .btn { color: #fff; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .4); }
.hero .btn:hover { background: rgba(255, 255, 255, .24); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }

/* Rader med samma höjd, utan JavaScript. Padding-hacket i ::before gör att höjden följer bredden. */
.grid {
  --row: 230px;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 var(--gutter); max-width: 1640px; margin: 0 auto;
}
.grid::after { content: ""; flex-grow: 1e6; }
.ph {
  position: relative; display: block; overflow: hidden; min-width: 0;
  flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row));
  background: var(--surface); border-radius: 4px; cursor: zoom-in;
}
.ph::before { content: ""; display: block; padding-bottom: calc(100% / var(--r)); }
.ph[hidden] { display: none; }
.ph a { position: absolute; inset: 0; display: block; }
.js .ph img, .js .card .thumb img { opacity: 0; }
.js .ph img.in, .js .card .thumb img.in { opacity: 1; }

.heart {
  position: absolute; z-index: 2; top: 8px; right: 8px;
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  color: #fff; background: rgba(40, 8, 14, .55); backdrop-filter: blur(6px);
  border: 0; border-radius: 50%; cursor: pointer;
  opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s, background .15s;
}
.heart svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph:hover .heart, .heart:focus-visible, .ph.fav .heart { opacity: 1; transform: none; }
.heart:hover { background: rgba(40, 8, 14, .8); }
.ph.fav .heart svg, .lb .on svg { fill: #ff5a70; stroke: #ff5a70; }
@media (hover: none) { .heart { opacity: .9; transform: none; } }
#favtoggle b { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .25); font-size: 12px; text-align: center; }
#favtoggle.on { background: #fff; color: var(--red); border-color: #fff; }
#favtoggle.on b { background: var(--red); color: #fff; }
.ph img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s cubic-bezier(.2, .7, .2, 1), opacity .3s;
}
.ph:hover img { transform: scale(1.03); }
.ph a:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

@media (max-width: 640px) {
  .grid { --row: 110px; gap: 4px; padding: 0 4px; }
}

.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding-top: 56px; padding-bottom: 40px; color: var(--muted); font-size: 14px;
}
.foot a:hover { color: var(--text); }

/* ---------- Inloggning ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.login form { width: min(100%, 380px); display: grid; gap: 14px; text-align: center; }
.login h1 { font-size: 32px; }
.login p { margin: 0; color: var(--muted); }
.login .err { color: var(--red); }
.login h1 { color: var(--red); }
.login input {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; text-align: center;
}
.login input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.login .btn { justify-content: center; padding: 13px 18px; }

/* ---------- Lightbox ---------- */

body.lb-open { overflow: hidden; }

.lb {
  position: fixed; inset: 0; z-index: 100;
  background: var(--dark);
  color: #fff;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
  touch-action: none; /* zoom och svep hanteras av app.js */
}
.lb.show { opacity: 1; visibility: visible; }

.lb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  color: rgba(255, 255, 255, .7); font-size: 14px; font-variant-numeric: tabular-nums;
}
.lb-actions { display: flex; gap: 6px; }

.lb button, .lb a.ib {
  display: grid; place-items: center; width: 44px; height: 44px;
  color: #fff; background: transparent; border: 0; border-radius: 50%; cursor: pointer;
  transition: background .15s;
}
.lb button:hover, .lb a.ib:hover { background: rgba(255, 255, 255, .1); }
.lb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lb-stage { position: relative; min-height: 0; overflow: hidden; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 0 clamp(0px, 6vw, 84px) max(16px, env(safe-area-inset-bottom)); }
.lb-stage img {
  max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none;
  transition: opacity .2s, filter .3s;
}
.lb-stage img.loading { opacity: .9; }
.lb-stage img { cursor: zoom-in; }
.lb.zoomed .lb-stage img { cursor: grab; }

.lb .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, .1); }
.toast {
  position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--dark); background: #fff; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lb .prev { left: 14px; }
.lb .next { right: 14px; }
@media (max-width: 720px), (hover: none) { .lb .nav { display: none; } }

/* Smal skärm: bilden går kant i kant (pilarna är ändå dolda här) */
@media (max-width: 720px) {
  .lb-stage { padding: 0 env(safe-area-inset-right) max(8px, env(safe-area-inset-bottom)) env(safe-area-inset-left); }
}

/* Liggande mobil: hela höjden till bilden, knapparna ligger ovanpå (tryck på bilden för att dölja dem) */
@media (max-height: 520px) and (orientation: landscape) {
  .lb { grid-template-rows: minmax(0, 1fr); }
  .lb-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 2;
    padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 18px;
    background: linear-gradient(to bottom, rgba(29, 11, 14, .8), transparent);
    transition: opacity .2s;
  }
  .lb.bare .lb-top { opacity: 0; pointer-events: none; }
  .lb button, .lb a.ib { width: 40px; height: 40px; }
  .lb-stage { grid-row: 1; padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .toast { bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
