/* PEAK – the suite's frame (docs/peak/brand.md): the logo lock-up and the product switcher.
   Loaded on the PEAK suite host only, after app.css and the experience's own tokens (a product keeps its colours and
   art; PEAK adds the family's header). Mobile first; every movement waits for prefers-reduced-motion: no-preference. */

:root {
  --pk-ski: #4fc3f7; --pk-ski-2: #1e63d6;
  --pk-sun: #ffb300; --pk-sun-2: #ff6f3c;
  --pk-party: #ff3d9a; --pk-party-2: #8e44ff;
  --pk-home: #ffc94d; --pk-home-2: #ff3d9a;
  --pk-font: "Unbounded", "Bricolage Grotesque", system-ui, sans-serif;
  --pk-ease: cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

/* ---------- The lock-up: mark + label over "PEAK." ---------- */
.peak-logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
.peak-logo .peak-mark { flex: none; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.25)); }
.peak-lockup { display: grid; line-height: 1; }
.peak-label { font: 700 0.62rem/1 var(--pk-font); letter-spacing: 0.22em; color: var(--pk-c, var(--accent)); margin-bottom: 3px; }
.peak-word { font: 800 1.28rem/1 var(--pk-font); letter-spacing: 0.02em; }
.peak-word i { font-style: normal; color: var(--pk-c, var(--accent)); }
[data-peak="home"] { --pk-c: var(--pk-home); --pk-c2: var(--pk-home-2); }
[data-peak="ski"] { --pk-c: var(--pk-ski); --pk-c2: var(--pk-ski-2); }
[data-peak="sun"] { --pk-c: var(--pk-sun); --pk-c2: var(--pk-sun-2); }
[data-peak="party"] { --pk-c: var(--pk-party); --pk-c2: var(--pk-party-2); }
:root[data-theme="light"] [data-peak="home"] { --pk-c: #b06d00; }
:root[data-theme="light"] [data-peak="ski"] { --pk-c: #0b6fb8; }
:root[data-theme="light"] [data-peak="sun"] { --pk-c: #a35200; }
:root[data-theme="light"] [data-peak="party"] { --pk-c: #c2185b; }

/* ---------- The switcher: the whole logo is the button ---------- */
.peak-switch { position: relative; flex: none; }
.peak-switch > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; margin-left: -6px;
  border-radius: 16px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.peak-switch > summary::-webkit-details-marker { display: none; }
.peak-switch > summary:hover { background: color-mix(in srgb, var(--pk-c, var(--accent)) 12%, transparent); }
.peak-switch > summary:focus-visible { outline: 2px solid var(--pk-c, var(--accent)); outline-offset: 2px; }
.peak-caret { width: 16px; height: 16px; color: var(--muted); transition: transform 0.25s var(--pk-ease); }
.peak-switch[open] .peak-caret { transform: rotate(180deg); }
/* The app's logo (PB36): PEAK Ski only, not a button – same place as the switcher's summary */
.peak-switch.is-static { display: inline-flex; align-items: center; padding: 6px 10px 6px 6px; margin-left: -6px; }

.peak-sheet { position: absolute; z-index: 80; top: calc(100% + 10px); left: -6px; width: min(400px, calc(100vw - 24px)); padding: 10px;
  border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.peak-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px 10px; }
.peak-sheet-head b { font: 800 0.8rem var(--pk-font); letter-spacing: 0.18em; color: var(--muted); }
.peak-sheet-close { display: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 1.2rem; cursor: pointer; }
.peak-options { display: grid; gap: 6px; }
.peak-option { --i: 0; position: relative; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 18px;
  color: var(--text); text-decoration: none; overflow: hidden; border: 1px solid transparent;
  background: linear-gradient(100deg, color-mix(in srgb, var(--pk-c) 14%, var(--surface-2)), var(--surface-2) 70%); }
.peak-option::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5; }
.peak-option[data-peak="ski"]::after { background: radial-gradient(circle at 85% 20%, #fff 0 1px, transparent 1.5px) 0 0 / 22px 18px; opacity: 0.18; }
.peak-option[data-peak="sun"]::after { background: radial-gradient(120% 70% at 100% 120%, color-mix(in srgb, var(--pk-sun) 35%, transparent), transparent 60%); }
.peak-option[data-peak="party"]::after { background: radial-gradient(circle at 80% 30%, var(--pk-party) 0 1.5px, transparent 2px) 0 0 / 26px 20px, radial-gradient(circle at 30% 70%, var(--pk-sun) 0 1.2px, transparent 1.8px) 0 0 / 30px 24px; opacity: 0.35; }
.peak-option[data-peak="home"]::after { background: linear-gradient(90deg, transparent 60%, color-mix(in srgb, var(--pk-ski) 12%, transparent), color-mix(in srgb, var(--pk-party) 14%, transparent)); }
.peak-option:hover, .peak-option:focus-visible { border-color: color-mix(in srgb, var(--pk-c) 55%, transparent); outline: none; }
.peak-option[aria-current="page"] { border-color: var(--pk-c); box-shadow: inset 0 0 0 1px var(--pk-c); }
.peak-option-mark { position: relative; z-index: 1; display: grid; place-items: center; }
.peak-option-text { position: relative; z-index: 1; display: grid; gap: 2px; min-width: 0; }
.peak-option-text b { font: 700 1rem var(--pk-font); }
.peak-option-text b span { color: var(--pk-c); }
.peak-option-text small { color: var(--muted); font-size: 0.82rem; }
.peak-option-text em { font-style: normal; font-size: 0.78rem; font-weight: 700; color: var(--pk-c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peak-option-check { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 800;
  color: var(--accent-ink); background: var(--pk-c); opacity: 0; transform: scale(0.6); }
.peak-option[aria-current="page"] .peak-option-check { opacity: 1; transform: none; }
.peak-sheet-foot { margin: 10px 8px 4px; color: var(--faint); font-size: 0.78rem; }

/* Mobile: a bottom sheet over a dimmed page. */
@media (max-width: 640px) {
  .peak-active .theme-toggle { display: none; } /* room for the switcher; the theme stays under Indstillinger */
  .peak-switch[open]::before { content: ""; position: fixed; inset: 0; z-index: 79; background: rgba(5, 5, 15, 0.55); backdrop-filter: blur(3px); }
  .peak-sheet { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 86vh; overflow-y: auto; border-radius: 28px 28px 0 0;
    padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); border-bottom: 0; }
  .peak-sheet::before { content: ""; display: block; width: 44px; height: 5px; margin: 2px auto 8px; border-radius: 3px; background: var(--border); }
  .peak-sheet-close { display: grid; place-items: center; }
  .peak-option { grid-template-columns: 52px 1fr auto; padding: 12px 14px; min-height: 70px; }
  .peak-word { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .peak-switch[open] .peak-sheet { animation: peak-pop 0.32s var(--pk-ease); transform-origin: 30px 0; }
  .peak-switch[open] .peak-option { animation: peak-rise 0.42s var(--pk-ease) both; animation-delay: calc(var(--i) * 45ms + 40ms); }
  .peak-switch.is-closing .peak-sheet { animation: peak-out 0.18s ease-in forwards; }
  .peak-switch > summary:hover .peak-mark-sun rect, .peak-option:hover .peak-mark-sun rect { transform-box: view-box; }
  .peak-switch > summary:hover .peak-mark, .peak-option:hover .peak-mark { animation: peak-mark-bob 0.6s var(--pk-ease); }
  .peak-mark-party path:nth-of-type(2) { transform-box: fill-box; transform-origin: center; animation: peak-twinkle 2.8s ease-in-out infinite; }
  .peak-mark-sun circle { animation: peak-glow 4s ease-in-out infinite alternate; }
  @media (max-width: 640px) {
    .peak-switch[open] .peak-sheet { animation: peak-sheet-up 0.36s var(--pk-ease); }
    .peak-switch.is-closing .peak-sheet { animation: peak-sheet-down 0.2s ease-in forwards; }
    .peak-switch[open]::before { animation: peak-fade 0.25s ease-out; }
  }
}
@keyframes peak-pop { from { opacity: 0; transform: translateY(-6px) scale(0.96); } }
@keyframes peak-out { to { opacity: 0; transform: translateY(-6px) scale(0.97); } }
@keyframes peak-sheet-up { from { transform: translateY(100%); } }
@keyframes peak-sheet-down { to { transform: translateY(100%); } }
@keyframes peak-fade { from { opacity: 0; } }
@keyframes peak-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes peak-mark-bob { 40% { transform: translateY(-3px) rotate(-4deg); } }
@keyframes peak-twinkle { 50% { transform: scale(0.75) rotate(20deg); opacity: 0.75; } }
@keyframes peak-glow { to { opacity: 0.8; } }

/* ---------- PEAK's admin (admin.php, admin_konti.php, admin_promo.php, admin_dok.php – app/peak/admin.php) ----------
   Direction B of docs/peak/admin-koncepter/: tables on a computer, labelled rows on a phone. Only app.css's semantic
   tokens, so it follows the frame's (c2.css) look. */
.admin-tabs { display: flex; gap: 4px; margin: 0 0 20px; padding: 4px; overflow-x: auto; scrollbar-width: none; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 10px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.admin-tabs a:hover { color: var(--text); background: var(--surface-2); }
.admin-tabs a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
@media (max-width: 420px) { .admin-tabs a { padding: 0 10px; font-size: 0.875rem; } } /* all four fit on a 375 px phone */
.admin-tabs a:focus-visible, .admin-chips a:focus-visible, .admin-docs a:focus-visible, .stat-tile-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.stat-tile-link { color: inherit; text-decoration: none; }
.stat-tile-link:hover { background: var(--surface-2); }

/* Konti: the class filter and the search */
.admin-filter { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .admin-filter { grid-template-columns: 1fr minmax(220px, 300px); align-items: center; } }
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chips a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.admin-chips a[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.admin-chips .count { margin: 0; }

/* The tables: a row per account or code; under 760 px each row is a block of labelled lines */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.admin-table thead th { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.admin-table tbody th { font-weight: 400; }
.admin-table tbody th .small, .admin-block { display: block; overflow-wrap: break-word; }
.admin-table tbody tr:last-child > * { border-bottom: 0; }
.admin-table td:last-child { text-align: right; }
.admin-table tr.is-off > * { color: var(--muted); }
.admin-table .badge { margin-left: 0; }
.admin-table .badge, .admin-table .tier-badge { white-space: nowrap; }

/* Folded actions: one "Ændr" per row, the class and Business buttons open under it */
.admin-more { position: relative; display: inline-block; }
.admin-more > summary { list-style: none; }
.admin-more > summary::-webkit-details-marker { display: none; }
.admin-more > summary::after { content: "▾"; margin-left: 2px; font-size: 0.8em; }
.admin-more[open] > summary::after { content: "▴"; }
.admin-more[open] { display: block; }
/* Unfolds in its cell, not over the table: the table's scroll box would clip a floating panel */
.admin-more-panel { display: flex; flex-wrap: wrap; gap: 6px; width: 240px; max-width: 100%; margin: 8px 0 0 auto; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.admin-more-panel form { flex: 1 1 100%; margin: 0; }
.admin-more-panel .btn { width: 100%; }
@media (max-width: 759px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table th, .admin-table td { display: block; }
  .admin-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .admin-table tbody tr:last-child { border-bottom: 0; }
  .admin-table th, .admin-table td { padding: 3px 0; border: 0; text-align: left; }
  .admin-table td[data-label]::before { content: attr(data-label) " "; display: inline-block; min-width: 92px; color: var(--muted); font-size: 0.8rem; }
  .admin-table td:last-child { text-align: left; padding-top: 8px; }
  .admin-more { display: block; }
  .admin-more-panel { width: auto; margin-left: 0; }
}

/* Promokoder: the form beside the codes on a wide screen */
.admin-form-row { display: grid; gap: 14px; align-items: start; }
@media (min-width: 560px) { .admin-form-row { grid-template-columns: 1fr 1fr; } }
.admin-promo-form input[name="code"] { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-promo-form input[name="code"]::placeholder { text-transform: none; font-family: "Inter", sans-serif; letter-spacing: 0; }
.admin-promo-form [aria-invalid="true"] { border-color: var(--danger); }
.admin-promo-form .seg label { min-height: 44px; }
.admin-code { display: inline-block; font: 700 0.95rem ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: 0.04em; }
@media (min-width: 1360px) { .admin-split { display: grid; grid-template-columns: minmax(360px, 4fr) 7fr; gap: 20px; align-items: start; } .admin-split > .card { margin: 0; } }

/* Dokumenter: the list beside the document from 980 px */
.admin-docs ul { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.admin-docs a { display: grid; gap: 2px; padding: 14px 16px; min-height: 44px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.admin-docs a:hover { background: var(--surface-2); }
.admin-docs a[aria-current="page"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
@media (min-width: 980px) { .admin-docs-split { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; } .admin-docs-split .admin-docs { position: sticky; top: 16px; } }
.admin-doc { max-width: 76ch; line-height: 1.6; }
.admin-doc h2 { margin: 0 0 12px; font-size: 1.6rem; }
.admin-doc h3 { margin: 28px 0 8px; font-size: 1.15rem; }
.admin-doc h4 { margin: 20px 0 6px; font-size: 1rem; }
.admin-doc p, .admin-doc ul, .admin-doc ol { margin: 0 0 12px; }
.admin-doc ul, .admin-doc ol { padding-left: 1.3em; }
.admin-doc li + li { margin-top: 4px; }
.admin-doc code { padding: 1px 5px; border-radius: 6px; background: var(--surface-2); font-size: 0.88em; overflow-wrap: anywhere; }
.admin-doc a { color: var(--accent); }
.admin-doc-table { width: 100%; border-collapse: collapse; margin: 4px 0 16px; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.admin-doc-table th, .admin-doc-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-doc-table thead th { color: var(--muted); font-size: 0.78rem; font-weight: 700; }

/* ---------- The bubble (peak.js): one selection that glides between choices – Dagens, the propaganda filter, Om rejsen,
   the packing list's view, the piste map's list, the chat's background sets and the mission form. 'under': the pill is the
   selected choice's background and the labels sit on it; 'over': chips that keep their own look get the pill on top.
   PEAK only (this file); without script the rows look as before. ---------- */
.has-bubble { position: relative; isolation: isolate; }
.pk-bubble { position: absolute; top: 0; left: 0; z-index: 0; pointer-events: none; transform-origin: 0 50%; will-change: transform; }
.bubble-under > :not(.pk-bubble) { position: relative; z-index: 1; }
/* the pill is the only highlight: no choice keeps its own background (the old one keeps aria-current until the next page);
   only the choices (.pk-bubble-item) – a button beside them (the timer's sound) keeps its look */
.bubble-under > .pk-bubble-item { background: none !important; box-shadow: none !important; }
.bubble-under > [data-bubble-on] { border-color: transparent !important; }
/* No hover patch over the pill: a tap on a phone leaves the choice in :hover */
.bubble-under > .pk-bubble-item:hover { background: none; }
.bubble-over > .pk-bubble { z-index: 2; }
.bubble-over > .pk-bubble-item { border-color: var(--border) !important; background: var(--surface-2) !important; }
/* the selected colour at once as the pill arrives; back to the quiet one softly */
.has-bubble.is-moving > * { transition-duration: 0s, 90ms; }
@media (prefers-reduced-motion: no-preference) {
  .has-bubble > :not(.pk-bubble) { transition: color 90ms ease, transform 100ms ease-out; }
  .has-bubble > :not(.pk-bubble):active { transform: scale(0.96); }
}

/* ---------- The page change (PB40): content moves, the frame stands still ----------
   Cross-document view transitions (Safari 18.2+, Chrome 126+; without them the page simply changes). The header, the
   rail and the tab bar keep their place; the page's content fades out quickly and the new one fades in and rises 8 px.
   html[data-vt="push"]/"pop" (peak.js, a link with data-vt-dir) on a phone: the iOS push – the new page slides in from
   the right while the old one moves a third to the left and dims; back the other way. Skipped on back/forward (WebKit's
   own swipe), a reload and a bubble's hop (peak.js). Reduced motion: none. */
@view-transition { navigation: auto; }
.pk2-head { view-transition-name: pk-head; }
.pk2-tabs { view-transition-name: pk-tabs; }
.peak-c2 #main { view-transition-name: pk-page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(pk-page) { animation: none; }
::view-transition-image-pair(pk-page) { isolation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(pk-page) { animation: pk-vt-out 160ms ease both; }
  ::view-transition-new(pk-page) { animation: pk-vt-in 300ms cubic-bezier(0.23, 1, 0.32, 1) both; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 959px) {
  html[data-vt="push"]::view-transition-old(pk-page) { animation: pk-vt-push-out 420ms cubic-bezier(0.32, 0.72, 0, 1) both; }
  html[data-vt="push"]::view-transition-new(pk-page) { animation: pk-vt-push-in 420ms cubic-bezier(0.32, 0.72, 0, 1) both; }
  html[data-vt="pop"]::view-transition-old(pk-page) { animation: pk-vt-pop-out 420ms cubic-bezier(0.32, 0.72, 0, 1) both; z-index: 2; }
  html[data-vt="pop"]::view-transition-new(pk-page) { animation: pk-vt-pop-in 420ms cubic-bezier(0.32, 0.72, 0, 1) both; }
}
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
/* The push and pop slide one page over the other: each page needs its own ground, or the one underneath shines through
   while they cross (a page's snapshot only holds what it paints). The edge of the page on top casts a faint shadow. */
@media (max-width: 959px) {
  body.peak-c2:not([data-fest-type]) #main { background: var(--pk-ground); }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 959px) {
  html[data-vt="push"]::view-transition-new(pk-page), html[data-vt="pop"]::view-transition-old(pk-page) { box-shadow: -10px 0 28px rgb(0 0 0 / 0.22); }
}
@keyframes pk-vt-out { to { opacity: 0; } }
@keyframes pk-vt-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pk-vt-push-out { to { transform: translateX(-30%); opacity: 0.55; } }
@keyframes pk-vt-push-in { from { transform: translateX(100%); } }
@keyframes pk-vt-pop-out { to { transform: translateX(100%); } }
@keyframes pk-vt-pop-in { from { transform: translateX(-30%); opacity: 0.55; } }
