/* VatneBy - the city board.
   Warm paper and fjord green: a village notice board, not a social network. */

:root {
    --bg: #f4f1ea;
    --bg-grain: #efe9dd;
    --surface: #fffdf9;
    --surface-2: #f8f4ec;
    --ink: #1f2a24;
    --ink-2: #4c5650;
    --ink-3: #7c847f;
    --line: #e4ddd0;
    --line-2: #d6cdbd;
    --accent: #1f4d3a;          /* fjord green */
    --accent-ink: #ffffff;
    --accent-soft: #e2ece5;
    --accent-2: #2f6b52;
    --warm: #c8682a;            /* sign-up */
    --warm-soft: #fbeadd;
    --heart: #d1435b;
    --heart-soft: #fbe4e8;
    --sun: #f2b263;
    --danger: #b3261e;
    --shadow: 0 1px 2px rgba(48, 38, 20, .06), 0 6px 22px -10px rgba(48, 38, 20, .18);
    --shadow-lift: 0 2px 4px rgba(48, 38, 20, .07), 0 16px 34px -14px rgba(48, 38, 20, .28);
    --radius: 18px;
    --radius-sm: 11px;
    --font: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Fraunces', Georgia, serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121a16;
        --bg-grain: #151e19;
        --surface: #1a241f;
        --surface-2: #202c26;
        --ink: #e8ece8;
        --ink-2: #b4bdb7;
        --ink-3: #87918b;
        --line: #2a3731;
        --line-2: #35443c;
        --accent: #7cc4a0;
        --accent-ink: #0f1a15;
        --accent-soft: #23362d;
        --accent-2: #9ad4b6;
        --warm: #f0a46b;
        --warm-soft: #3a2a1f;
        --heart: #f27b8f;
        --heart-soft: #3b2328;
        --danger: #f2877f;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
        --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 36px -14px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    background-image: radial-gradient(circle at 1px 1px, var(--bg-grain) 1px, transparent 0);
    background-size: 22px 22px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.site-main { flex: 1; padding-bottom: 64px; }

/* ---------- Header ---------- */
.site-head {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line);
}
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { color: var(--accent); display: flex; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 1.28rem; letter-spacing: -.01em; }
.brand-text small { font-size: .74rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent);
    font-weight: 700; border: 1px solid var(--line-2);
}
.usermenu-pop {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 210px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow-lift);
}
.usermenu-who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.usermenu-who small { color: var(--ink-3); }
.usermenu-pop a, .usermenu-pop button {
    display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px;
    background: none; border: 0; color: var(--ink); text-decoration: none; cursor: pointer; font-size: .95rem;
}
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--surface-2); }
.usermenu-pop form { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 18px; border-radius: 999px;
    border: 1px solid transparent; cursor: pointer;
    font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
    transition: background .15s, transform .1s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible, .act:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .88rem; }
.btn .i { width: 18px; height: 18px; }
.btn-danger-text { background: none; color: var(--danger); border: 0; }
.btn-danger-text:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* The link button on a post: a wide, obvious "go there" with the arrow at the far end. */
.btn-link {
    display: flex; width: 100%; justify-content: flex-start;
    margin-top: 14px; border-radius: var(--radius-sm);
    background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 18%, transparent);   /* same light green as the avatar */
    min-height: 48px; padding: 0 16px;
}
.btn-link span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.btn-link .i-link { color: var(--accent); }
.btn-link .i-arrow { color: var(--accent-2); transition: transform .15s; }
.btn-link:hover { border-color: var(--accent); }
.btn-link:hover .i-arrow { transform: translateX(3px); color: var(--accent); }

/* ---------- Front page ---------- */
.hero { padding: 34px 0 10px; }
.hero h1 {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(1.9rem, 6vw, 2.7rem); line-height: 1.08; letter-spacing: -.02em;
    margin: 0 0 8px;
}
.hero p { margin: 0; color: var(--ink-2); font-size: 1.03rem; max-width: 34em; }

.section-label {
    font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
    color: var(--ink-3); margin: 26px 0 10px; display: flex; align-items: center; gap: 8px;
}
.section-label .count {
    background: var(--accent-soft); color: var(--accent); border-radius: 999px;
    padding: 1px 8px; font-size: .74rem; letter-spacing: 0;
}

/* The "Snart" strip: swipeable on a phone. */
.upcoming-row {
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 2px 16px 10px; scrollbar-width: none;
}
.upcoming-row::-webkit-scrollbar { display: none; }
.up-card {
    flex: 0 0 auto; width: 240px; scroll-snap-align: start;
    display: flex; gap: 12px; align-items: center;
    padding: 12px; border-radius: 16px;
    background: var(--surface); border: 1px solid var(--line);
    text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}
.up-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.up-text { display: flex; flex-direction: column; min-width: 0; }
.up-text strong { font-size: .93rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.up-text small { color: var(--ink-3); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.datetile {
    flex: none; width: 52px; height: 56px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--line-2);
    display: flex; flex-direction: column; align-items: center; overflow: hidden;
    box-shadow: 0 1px 0 var(--line);
}
.dt-m {
    width: 100%; text-align: center; background: var(--warm); color: #fff;
    font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 2px 0;
}
.dt-d { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; line-height: 1.35; }

.board-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 22px 0 14px; flex-wrap: wrap;
}
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs a {
    padding: 7px 16px; border-radius: 999px; text-decoration: none;
    color: var(--ink-2); font-weight: 600; font-size: .9rem;
}
.tabs a.on { background: var(--accent); color: var(--accent-ink); }
.search input {
    height: 42px; width: 200px; max-width: 100%;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
    padding: 0 16px 0 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%237c847f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 13px center;
}
.search input:focus { outline: none; border-color: var(--accent); }

.board { display: grid; gap: 18px; }
.more { display: flex; justify-content: center; margin-top: 22px; }
.empty { text-align: center; padding: 56px 16px; color: var(--ink-2); }
.empty p { font-size: 1.05rem; margin: 0 0 18px; }

/* ---------- Post ---------- */
.post {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.post.is-pinned { border-color: color-mix(in srgb, var(--sun) 60%, var(--line)); }
.post.is-past .datetile { filter: grayscale(1); opacity: .65; }
.post-img-link { display: block; }
.post-img { width: 100%; max-height: 440px; object-fit: cover; background: var(--surface-2); }
.post-full .post-img { max-height: none; }
.post-inner { padding: 16px 18px 12px; }
@media (min-width: 600px) { .post-inner { padding: 20px 24px 14px; } }

.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: .84rem; color: var(--ink-3); margin-bottom: 10px; }
.post-author { font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.post-author .i { width: 15px; height: 15px; color: #1877f2; }
.dot { opacity: .6; }
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 2px 9px;
    text-transform: uppercase; letter-spacing: .04em;
}
.tag .i { width: 12px; height: 12px; }
.tag-pin { background: color-mix(in srgb, var(--sun) 28%, transparent); color: #8a5310; }
.tag-upd { background: var(--accent-soft); color: var(--accent); }
.tag-new { background: var(--warm); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag-pin { color: var(--sun); } }

.post-head { display: flex; gap: 14px; align-items: flex-start; }
.post-head-text { min-width: 0; flex: 1; }
.post-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: 1.36rem; line-height: 1.2; letter-spacing: -.01em; margin: 0;
    overflow-wrap: anywhere;
}
.post-full .post-title { font-size: clamp(1.55rem, 5vw, 2rem); }
.post-title a { color: inherit; text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-facts { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; color: var(--ink-2); font-size: .92rem; }
.post-facts li { display: flex; gap: 7px; align-items: flex-start; }
.post-facts .i { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--warm); }
.post-facts em { color: var(--ink-3); font-style: normal; }

.post-body { margin-top: 12px; color: var(--ink); overflow-wrap: anywhere; }
.post-body.is-clamped { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.post-full .post-body { font-size: 1.05rem; line-height: 1.65; }
.readmore { display: inline-block; margin-top: 4px; font-weight: 600; font-size: .92rem; text-decoration: none; }

.latest-update {
    display: grid; gap: 3px; margin-top: 14px; padding: 12px 14px;
    border-radius: var(--radius-sm); text-decoration: none; color: var(--ink);
    background: var(--warm-soft); border-left: 4px solid var(--warm);
}
.lu-label { font-size: .78rem; font-weight: 700; color: var(--warm); display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .04em; }
.lu-label .i { width: 15px; height: 15px; }
.lu-text { font-size: .94rem; }
.lu-more { font-size: .82rem; color: var(--ink-3); font-weight: 600; }

/* The action row: three wide, thumb-sized targets. */
.post-actions {
    display: flex; gap: 6px; margin-top: 14px; padding-top: 10px;
    border-top: 1px solid var(--line);
}
.act {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 44px; padding: 0 14px; border-radius: 999px;
    background: transparent; border: 1px solid transparent; color: var(--ink-2);
    font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
}
.act:hover { background: var(--surface-2); }
.act .n { font-variant-numeric: tabular-nums; }
.act-like.on { color: var(--heart); background: var(--heart-soft); }
.act-like.on .i-heart { fill: currentColor; }
.act-like.pop .i-heart { animation: pop .4s ease; }
@keyframes pop { 30% { transform: scale(1.35); } 60% { transform: scale(.9); } }
.act-signup { border-color: var(--line-2); }
.act-signup .n { background: var(--surface-2); border-radius: 999px; padding: 0 8px; font-size: .82rem; }
.act-signup.on { background: var(--warm); border-color: var(--warm); color: #fff; }
.act-signup.on .n { background: rgba(255, 255, 255, .22); }
.act-share { margin-left: auto; }
.act-edit { padding: 0 12px; }
@media (max-width: 420px) {
    .act { padding: 0 11px; }
    .act-share .lbl { display: none; }
}

/* ---------- Post page + updates timeline ---------- */
.back { display: inline-block; margin: 20px 0 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; }
.back:hover { color: var(--accent); }
.post-page .post { animation: none; }
.report-link { display: block; text-align: right; margin-top: 8px; font-size: .8rem; color: var(--ink-3); }

.updates { margin-top: 8px; }
.update-form-wrap > summary { list-style: none; cursor: pointer; width: fit-content; }
.update-form-wrap > summary::-webkit-details-marker { display: none; }
.update-form-wrap[open] > summary { display: none; }
.update-form { margin-top: 0; }

.timeline { list-style: none; margin: 18px 0 0; padding: 0 0 0 8px; position: relative; }
.timeline::before {
    content: ''; position: absolute; left: 15px; top: 10px; bottom: 14px;
    width: 2px; background: linear-gradient(var(--warm), var(--line-2) 40%);
    border-radius: 2px;
}
.tl-item { position: relative; padding-left: 32px; margin-bottom: 14px; }
.tl-dot {
    position: absolute; left: 1px; top: 16px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface); border: 3px solid var(--line-2);
}
.tl-item.is-latest .tl-dot { border-color: var(--warm); box-shadow: 0 0 0 5px var(--warm-soft); }
.tl-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    padding: 12px 16px 14px; box-shadow: var(--shadow);
}
.tl-item.is-latest .tl-card { border-color: color-mix(in srgb, var(--warm) 45%, var(--line)); }
.tl-meta { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-3); margin-bottom: 6px; }
.tl-body { overflow-wrap: anywhere; }
.tl-img { margin-top: 10px; border-radius: 12px; max-height: 420px; object-fit: cover; width: 100%; }
.tl-del { margin: 0 0 0 auto; }
.tl-del button { background: none; border: 0; color: var(--ink-3); cursor: pointer; padding: 4px; border-radius: 8px; display: flex; }
.tl-del button:hover { color: var(--danger); background: var(--surface-2); }
.tl-del .i { width: 16px; height: 16px; }
.tl-origin { margin-bottom: 0; }
.tl-origin .tl-dot { top: 4px; width: 10px; height: 10px; left: 3px; border-width: 2px; }
.tl-origin-text { font-size: .82rem; color: var(--ink-3); }

/* ---------- Forms ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form { display: grid; gap: 16px; }
.card.form { padding: 20px; }
@media (min-width: 600px) { .card.form { padding: 28px 30px; } }
.form-title { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -.01em; margin: 0; line-height: 1.15; }
.form-sub { margin: -8px 0 0; color: var(--ink-2); }
.form-error {
    background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 500;
}
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small, legend small, .switch small { color: var(--ink-3); font-weight: 400; }
.field input, .field textarea, .field select {
    width: 100%; min-height: 46px; padding: 10px 14px;
    border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .field-row { grid-template-columns: 1fr 1fr; } }
.group { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0; display: grid; gap: 14px; }
.group legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.group-body { display: grid; gap: 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; color: var(--ink-2); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui {
    flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line-2);
    position: relative; transition: background .2s;
}
.switch-ui::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* Image picker: a big friendly target with the chosen photo shown in place. */
.imgpick { display: grid; gap: 8px; }
.imgpick-drop {
    position: relative; display: grid; place-items: center; min-height: 132px;
    border: 2px dashed var(--line-2); border-radius: 14px; background: var(--surface-2);
    cursor: pointer; overflow: hidden; transition: border-color .15s;
}
.imgpick-drop:hover { border-color: var(--accent); }
.imgpick-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.imgpick-empty { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 600; pointer-events: none; }
.imgpick-empty small { display: block; font-weight: 400; color: var(--ink-3); font-size: .8rem; }
.imgpick-empty .i { width: 28px; height: 28px; color: var(--accent); }
.imgpick-preview { display: none; width: 100%; max-height: 300px; object-fit: cover; }
.imgpick.has-img .imgpick-preview { display: block; }
.imgpick.has-img .imgpick-empty { display: none; }
.imgpick.has-img .imgpick-drop { border-style: solid; min-height: 0; }

.compose { margin-top: 4px; }
.danger-zone { display: flex; justify-content: center; margin-top: 18px; }

.auth { display: grid; place-items: start center; padding-top: 32px; }
.auth-card { width: 100%; max-width: 440px; padding: 28px 24px; display: grid; gap: 16px; }
.auth-wide { max-width: 600px; }
.auth-foot { margin: 0; font-size: .9rem; color: var(--ink-2); text-align: center; }
.code-input { font-family: Consolas, ui-monospace, monospace; font-size: 1.6rem !important; letter-spacing: .35em; text-align: center; }

.flash {
    margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--accent-soft); color: var(--accent); font-weight: 600;
    animation: rise .3s ease both;
}

/* ---------- Floating button, toast, share sheet ---------- */
.fab {
    position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink);
    display: none; place-items: center; box-shadow: var(--shadow-lift); z-index: 15;
}
.fab .i { width: 26px; height: 26px; }
@media (max-width: 600px) {
    .fab { display: grid; }
    .btn-new span { display: none; }
    .btn-new { padding: 0 12px; }
}

.toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px;
    font-weight: 600; font-size: .92rem; transition: opacity .2s, transform .2s; z-index: 50;
    max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 17, .45); z-index: 40; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    background: var(--surface); border-radius: 22px 22px 0 0;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    max-width: 520px; margin: 0 auto; box-shadow: var(--shadow-lift);
    animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(100%); } }
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 14px; font-size: 1rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sheet-grid a, .sheet-grid button {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px;
    border-radius: 14px; background: none; border: 0; cursor: pointer;
    color: var(--ink); text-decoration: none; font-size: .78rem; font-weight: 600;
}
.sheet-grid a:hover, .sheet-grid button:hover { background: var(--surface-2); }
.sheet-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.sheet-ico svg { width: 22px; height: 22px; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 22px 0 calc(28px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: .88rem; }
.foot-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.foot-row span { margin-right: auto; }
.foot-row a { color: var(--ink-2); text-decoration: none; }
.foot-row a:hover { color: var(--accent); }

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

/* While the browser shrinks the photo: a soft veil and a spinner over the preview. */
.imgpick.is-working .imgpick-drop::after {
    content: ''; position: absolute; inset: 0;
    background: color-mix(in srgb, var(--surface) 55%, transparent)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='14' fill='none' stroke='%231f4d3a' stroke-width='4' stroke-dasharray='60 30'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 18 18' to='360 18 18' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E")
        center / 36px no-repeat;
}

/* ---------- Messages (Page admin) ---------- */
.avatar { position: relative; }
.avatar-dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--warm); border: 2px solid var(--bg); }
.count-badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warm); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; }

.inbox-list { display: grid; gap: 10px; }
.inbox-row { display: grid; gap: 3px; padding: 14px 16px; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.inbox-row:hover { border-color: var(--accent); }
.inbox-row.is-done { opacity: .6; }
.inbox-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inbox-row-top time { margin-left: auto; font-size: .82rem; color: var(--ink-3); }
.inbox-row-subj { font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.inbox-row-prev { font-size: .9rem; color: var(--ink-3); }

.inbox-thread { padding: 20px; display: grid; gap: 18px; }
@media (min-width: 600px) { .inbox-thread { padding: 26px 28px; } }
.inbox-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.inbox-head form { margin: 0; }
.inbox-msgs { display: grid; gap: 10px; }
.bubble { max-width: 88%; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface-2); border: 1px solid var(--line); }
.bubble.ours { justify-self: end; border-radius: 16px 16px 4px 16px; background: var(--accent-soft); border-color: transparent; }
.bubble-meta { font-size: .78rem; color: var(--ink-3); margin-bottom: 4px; font-weight: 600; }
.bubble-text { overflow-wrap: anywhere; }
.inbox-reply { border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Sign-up: how many are coming ---------- */
.signup-panel {
    display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
    margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--warm-soft); animation: rise .2s ease both;
}
.sp-q { font-weight: 600; font-size: .92rem; }
.stepper { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.step {
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    background: transparent; color: var(--warm); font-size: 1.4rem; font-weight: 700; line-height: 1;
    -webkit-tap-highlight-color: transparent; transition: background .15s;
}
.step:hover:not(:disabled) { background: var(--warm-soft); }
.step:disabled { color: var(--line-2); cursor: default; }
.step-n { min-width: 34px; text-align: center; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-actions { display: flex; gap: 6px; margin-left: auto; }
@media (max-width: 420px) { .sp-actions { margin-left: 0; width: 100%; } .sp-actions .btn-primary { flex: 1; } }
/* The thread header is not a form: give the sender line its own room under the title. */
.inbox-head .form-title { line-height: 1.2; }
.inbox-head .form-sub { margin: 8px 0 0; }

/* ---------- Sidebar: right-hand column on wide screens, ☰ drawer on phones ---------- */
.menu-btn, .sidebar-close {
    display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
    border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.menu-btn:hover, .sidebar-close:hover { border-color: var(--ink-3); }
.has-side .head-row { gap: 10px; }
.has-side .brand { margin-right: auto; }
@media (min-width: 1400px) { .menu-btn { display: none !important; } }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sidebar-head strong { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: -.01em; }

.side-box {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px 10px 8px; margin-bottom: 14px;
}
.side-title {
    font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
    color: var(--ink-3); margin: 0 8px 6px;
}
.side-links { list-style: none; margin: 0; padding: 0; }
.side-link {
    display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 12px;
    text-decoration: none; color: var(--ink); transition: background .15s;
}
a.side-link:hover { background: var(--surface-2); }
a.side-link:hover .side-go { transform: translateX(3px); color: var(--accent); }
.side-ico {
    flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent);
}
.side-ico .i { width: 19px; height: 19px; }
.ico-facebook { background: #e7f0fe; color: #1877f2; }
.ico-recycle { background: #e3f3e6; color: #2e7d3a; }
.ico-phone { background: var(--heart-soft); color: var(--heart); }
.ico-bus, .ico-calendar, .ico-clock { background: var(--warm-soft); color: var(--warm); }
.side-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.side-text strong { font-size: .94rem; font-weight: 600; }
.side-text small { font-size: .82rem; color: var(--ink-3); overflow-wrap: anywhere; }
.side-go { color: var(--ink-3); transition: transform .15s, color .15s; display: flex; }
.side-go .i { width: 16px; height: 16px; }

/* The board stays centred exactly as without a sidebar; the sidebar lives in the empty space to the
   right of it. That only fits on wide screens (760 board + 2 x ~300 gutters) - below that it is the ☰
   drawer, also on laptops, rather than squeezing the board. */
@media (min-width: 1400px) {
    .has-side .layout {
        max-width: none; display: grid; align-items: start; column-gap: 32px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 728px) minmax(0, 1fr);
    }
    .has-side .layout > .site-main { grid-column: 2; }
    .sidebar {
        grid-column: 3; width: 100%; max-width: 300px;
        position: sticky; top: 65px; padding-top: 34px; max-height: calc(100vh - 65px); overflow-y: auto; scrollbar-width: thin;
    }
    .menu-btn, .sidebar-close, .side-backdrop { display: none !important; }
}

@media (max-width: 1399px) {
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 45;
        width: min(340px, 88vw); overflow-y: auto; overscroll-behavior: contain;
        padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
        background: var(--bg); box-shadow: var(--shadow-lift);
        transform: translateX(-102%); visibility: hidden;
        transition: transform .25s ease, visibility 0s linear .25s;   /* hide only after sliding out */
    }
    .side-open .sidebar { transform: none; visibility: visible; transition: transform .25s ease, visibility 0s; }
    .side-backdrop { position: fixed; inset: 0; z-index: 44; background: rgba(15, 20, 17, .45); animation: fade .2s ease; }
    .side-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- Sidebar editing (Page admin) ---------- */
.side-edit { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; margin-right: 8px; font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--accent); }
.side-edit .i { width: 15px; height: 15px; }
@media (min-width: 1400px) { .side-edit { margin-right: 0; } }
.side-empty { padding: 16px; font-size: .92rem; color: var(--ink-2); }

.ed-box { padding: 16px 16px 10px; margin-bottom: 16px; }
.ed-box.is-off { opacity: .65; }
.ed-box-head { display: flex; align-items: center; gap: 8px; }
.ed-box-head h2 { font-family: var(--font-display); font-size: 1.25rem; margin: 0; flex: 1; }
.ed-tools { display: inline-flex; gap: 2px; flex: none; }
.ed-mini { margin: 0; }
.ed-mini button {
    width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; cursor: pointer;
    color: var(--ink-2); font-size: 1rem; display: grid; place-items: center;
}
.ed-mini button:hover { background: var(--surface-2); color: var(--ink); }
.ed-mini button .i-trash { width: 16px; height: 16px; }
.ed-mini button:hover .i-trash { color: var(--danger); }
.ed-links { margin: 8px 0 4px; }
.ed-links > li { border-top: 1px solid var(--line); padding: 4px 0; }
.ed-links > li.is-off .side-link { opacity: .55; }
.ed-details > summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--accent); padding: 4px 8px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.ed-details > summary::-webkit-details-marker { display: none; }
.ed-details > summary .i { width: 16px; height: 16px; }
.ed-form { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; margin: 6px 0 10px; gap: 12px; }
.ed-add { border-top: 1px solid var(--line); padding-top: 6px; }
.ed-new { padding: 18px 20px; }

/* ---------- Sign-up: "Meld meg på", then − n + ---------- */
.signup { display: inline-flex; align-items: center; gap: 8px; }
.signup .su-stepper { display: none; }
.signup.on .act-signup { display: none; }
.signup.on .su-stepper {
    display: inline-flex; align-items: center; height: 44px; padding: 0 3px; border-radius: 999px;
    background: var(--warm); color: #fff; animation: rise .2s ease both;
}
.su-stepper .step { width: 38px; height: 38px; color: #fff; }
.su-stepper .step:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }
.su-stepper .step:disabled { color: rgba(255, 255, 255, .4); }
.su-mid { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; justify-content: center; font-weight: 700; }
.su-mid .i { width: 16px; height: 16px; }
.su-mid .step-n { font-size: 1.05rem; min-width: 0; color: #fff; }
.su-total { font-size: .85rem; color: var(--ink-3); white-space: nowrap; }
.su-total .n { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .su-total .w { display: none; } .signup { gap: 6px; } }

/* ---------- Weather ---------- */
.wx-pill {
    display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px 0 8px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
    font-weight: 700; font-size: .95rem; color: var(--ink); cursor: pointer; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.wx-pill:hover { border-color: var(--line-2); }
.wx-ico { display: block; flex: none; }

.wx-box { padding-bottom: 10px; }
.wx-now { display: flex; align-items: center; gap: 14px; padding: 4px 8px 10px; }
.wx-now-text { display: flex; flex-direction: column; line-height: 1.2; }
.wx-temp { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; color: var(--warm); }
.wx-temp.is-cold, .wx-t.is-cold { color: #3b7bc4; }
.wx-desc { font-weight: 600; font-size: .95rem; }
.wx-meta { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
.wx-later {
    list-style: none; margin: 0; padding: 10px 4px 2px; display: grid; grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line); text-align: center;
}
.wx-later li { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wx-h { font-size: .75rem; color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.wx-t { font-weight: 700; font-size: .92rem; }
.wx-credit { margin: 8px 8px 0; font-size: .72rem; color: var(--ink-3); }
.wx-credit a { color: inherit; }
@media (max-width: 380px) { .wx-pill { padding: 0 9px 0 6px; } .head-actions { gap: 6px; } }

/* "Logg inn" lives in the footer only - visitors never need it, posters know where it is. */
.foot-login { font-weight: 600; }
.foot-row .foot-credit { font-size: .78rem; color: var(--ink-3); }

/* ---------- Calendar ---------- */
.hero-sm { padding-bottom: 0; }
.hero-sm h1 { font-size: clamp(1.7rem, 5vw, 2.2rem); }
.cal-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.cal-title { font-family: var(--font-display); font-size: 1.5rem; margin: 0 6px; min-width: 9ch; text-align: center; }
.cal-nav {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
    text-decoration: none; font-size: 1.5rem; line-height: 1; padding-bottom: 3px;
}
.cal-nav:hover { border-color: var(--accent); color: var(--accent); }
.cal-today { margin-left: auto; }

.cal { padding: 6px; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: 30px repeat(7, minmax(0, 1fr)); }
.cal-dow span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); text-align: center; padding: 6px 0 8px; }
.cal-wk { font-size: .7rem; color: var(--ink-3); display: flex; align-items: flex-start; justify-content: center; padding-top: 10px; font-variant-numeric: tabular-nums; }
.cal-dow .cal-wk { padding-top: 6px; }
.cal-day {
    min-height: 96px; padding: 6px 4px 4px; border-top: 1px solid var(--line); border-left: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.cal-row > .cal-day:nth-child(2) { border-left: 0; }
.cal-day.is-other { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.cal-day.is-other .cal-num { color: var(--line-2); }
.cal-num {
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; align-self: flex-start;
    font-size: .85rem; font-weight: 600; color: var(--ink-2); text-decoration: none; font-variant-numeric: tabular-nums;
}
a.cal-num:hover { background: var(--accent-soft); color: var(--accent); }
.cal-day.is-today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-day.is-past:not(.is-today) .cal-ev { opacity: .6; }
.cal-evs { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; min-width: 0; }
.cal-ev {
    display: block; padding: 3px 6px; border-radius: 6px; font-size: .76rem; line-height: 1.3;
    background: var(--warm-soft); color: var(--ink); text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--warm);
}
.cal-ev b { font-weight: 700; color: var(--warm); }
.cal-ev.is-cont { border-left-style: dashed; }
.cal-ev:hover { background: color-mix(in srgb, var(--warm) 22%, var(--surface)); }
.cal-more a { font-size: .74rem; font-weight: 600; color: var(--ink-3); padding-left: 6px; text-decoration: none; }
.cal-dots { display: none; }

.cal-list { margin-top: 22px; display: grid; gap: 12px; }
.cal-dayblock { display: flex; gap: 14px; align-items: flex-start; scroll-margin-top: 80px; }
.cal-dayblock.is-past { opacity: .6; }
.cal-dayblock:target .cal-dayevs { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.cal-dayevs { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.cal-dayevs h3 { margin: 2px 4px 6px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.cal-item { display: flex; flex-direction: column; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.cal-item + .cal-item { border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
.cal-item:hover { background: var(--surface-2); }
.cal-item strong { font-size: .98rem; }
.cal-item-meta { font-size: .84rem; color: var(--ink-3); }

/* Phones: the grid becomes a compact month with dots; the list below carries the titles. */
@media (max-width: 700px) {
    .cal-row { grid-template-columns: 22px repeat(7, minmax(0, 1fr)); }
    .cal-day { min-height: 48px; align-items: center; padding: 4px 0; }
    .cal-num { align-self: center; width: 32px; height: 32px; }
    .cal-evs { display: none; }
    .cal-dots { display: flex; gap: 3px; justify-content: center; }
    .cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--warm); }
    .cal-day.has-ev:not(.is-other) .cal-num { font-weight: 800; color: var(--ink); }
    .cal-day.is-today .cal-num { color: var(--accent-ink) !important; }
    .cal-title { font-size: 1.3rem; }
}
.su-hidden { font-size: .78rem; color: var(--ink-3); font-style: italic; }

/* ---------- Bus departures ---------- */
.bus-dir + .bus-dir { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.bus-dir h3 { margin: 4px 8px 4px; font-size: .86rem; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.bus-dir h3 .i { width: 16px; height: 16px; color: var(--warm); }
.bus-dir ul { list-style: none; margin: 0; padding: 0 8px 4px; display: grid; gap: 2px; }
.bus-dir li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; }
.bus-line {
    flex: none; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; display: grid; place-items: center;
    background: #00694f; color: #fff; font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums;
}
.bus-to { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.bus-when { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Real-time: a small live dot, like the signs at the stop. */
.bus-when.is-live::before {
    content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2e9e5b;
    margin-right: 5px; vertical-align: 1px; animation: livepulse 2s ease-in-out infinite;
}
@keyframes livepulse { 50% { opacity: .35; } }
.bus-dir li.is-cancelled .bus-to { text-decoration: line-through; }
.bus-dir li.is-cancelled .bus-when { color: var(--danger); }
.bus-none { margin: 2px 8px 6px; font-size: .85rem; color: var(--ink-3); }
/* A grid row grows to its longest content by default; pin it to the box width so a long destination
   ("Hommersåk via Maudland-Riskafeltet") is shortened with … instead of pushing the time out. */
.bus-dir ul { grid-template-columns: minmax(0, 1fr); }
.bus-dir li { min-width: 0; }
.bus-when { white-space: nowrap; }

/* ---------- "Snart" as a left column on wide screens ---------- */
/* Mirrors "Nyttig i Vatne" on the right: same breakpoint, same sticky behaviour. Everything sits in
   row 1 explicitly, or the grid would push the later columns down a row. */
.leftbar { display: none; }
@media (min-width: 1400px) {
    .has-side .layout > .site-main, .has-side .layout > .sidebar, .has-side .layout > .leftbar { grid-row: 1; }
    .has-side .leftbar {
        display: block; grid-column: 1; justify-self: end; width: 100%; max-width: 260px;
        position: sticky; top: 65px; padding-top: 34px;
    }
    .has-side .upcoming-strip { display: none; }
    .upcoming-col .section-label { margin-top: 0; }
    .upcoming-col .upcoming-row { flex-direction: column; overflow: visible; margin: 0; padding: 0; gap: 10px; }
    .upcoming-col .up-card { width: 100%; }
}
/* The side columns stick at 65px - exactly where they sit unscrolled, right under the 64px header.
   A larger value pushed them down as soon as the page was tall enough to allow it (a six-week month),
   so they jumped 19px out of line with the board on some pages and not others. */

/* ---------- Tags, age and filters ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chip {
    display: inline-flex; align-items: center; height: 34px; padding: 0 13px; border-radius: 999px;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
    font-size: .86rem; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-sm { height: 26px; padding: 0 10px; font-size: .78rem; background: var(--surface-2); border-color: var(--line); }

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fact-age .i { color: var(--accent) !important; }

/* Post form */
.age-picks, .tag-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-check:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.chip-check.is-disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Weather pop-up from the header pill ---------- */
/* Mouse: opens on hover. Touch: opens on tap (app.js toggles .open), closes on a tap outside or Escape. */
.wx-wrap { position: relative; }
.wx-pop {
    position: absolute; top: calc(100% + 8px); right: -60px; z-index: 30; width: 300px;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .15s, transform .15s, visibility 0s linear .15s;
}
.wx-pop .wx-box { margin: 0; box-shadow: var(--shadow-lift); }
.wx-wrap.open .wx-pop { opacity: 1; visibility: visible; transform: none; transition: opacity .15s, transform .15s, visibility 0s; }
@media (hover: hover) and (pointer: fine) {
    .wx-wrap:hover .wx-pop, .wx-wrap:focus-within .wx-pop { opacity: 1; visibility: visible; transform: none; transition: opacity .15s, transform .15s, visibility 0s; }
    /* A small bridge, so moving the mouse from the pill down to the box does not close it. */
    .wx-pop::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
}
.wx-wrap.open .wx-pill, .wx-wrap:hover .wx-pill { border-color: var(--line-2); }
@media (max-width: 900px) { .wx-pop { right: 0; } }   /* the -60px nudge pushed it off narrow screens */
@media (max-width: 600px) {
    /* On a phone the pill sits mid-header; centre the box on the screen instead of hanging off the pill. */
    .wx-wrap { position: static; }
    .wx-pop { left: 12px; right: 12px; width: auto; top: 58px; }
}

/* ---------- Filter row: tag menu (mouse) / dropdowns (touch) ---------- */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 16px; }
.filters select {
    height: 36px; padding: 0 32px 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237c847f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none; appearance: none; font-weight: 600; font-size: .88rem; color: var(--ink-2); cursor: pointer;
}
.filters select:focus { outline: none; border-color: var(--accent); }
.filter-clear { font-size: .84rem; font-weight: 600; color: var(--ink-3); margin-left: 4px; }

.tag-menu { position: relative; display: none; }
.tag-menu-btn { gap: 6px; height: 36px; }
.tag-menu-pop {
    position: absolute; top: 100%; left: 0; z-index: 25; width: min(520px, 80vw);
    margin-top: 8px; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .15s, transform .15s, visibility 0s linear .15s;
}
/* Bridge over the gap, so the mouse can travel from the chip to the panel without closing it. */
.tag-menu-pop::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.tag-menu:hover .tag-menu-pop, .tag-menu:focus-within .tag-menu-pop {
    opacity: 1; visibility: visible; transform: none; transition: opacity .15s, transform .15s, visibility 0s;
}

/* Mouse: the hover menu replaces the tag dropdown. Touch: dropdowns for both, side by side. */
@media (hover: hover) and (pointer: fine) {
    .tag-menu { display: block; }
    .tag-select, .age-select { display: none; }
}
.age-menu .tag-menu-pop { width: max-content; flex-direction: column; align-items: stretch; }   /* six options: a short column, never off-screen */
.age-menu .tag-menu-btn:not(.on) { color: var(--ink-2); }
@media (hover: none), (pointer: coarse) {
    .filters select { flex: 1; min-width: 0; }
}

/* ---------- "Snart" inside the ☰ menu (phones and laptops) ---------- */
.side-snart { padding: 14px 10px 10px; }
.upcoming-side .section-label { margin: 0 8px 8px; font-size: .74rem; letter-spacing: .09em; }
.upcoming-side .upcoming-row { flex-direction: column; overflow: visible; margin: 0; padding: 0; gap: 4px; }
.upcoming-side .up-card { width: 100%; box-shadow: none; border-color: transparent; padding: 8px; }
.upcoming-side .up-card:hover { background: var(--surface-2); transform: none; box-shadow: none; }
@media (min-width: 1400px) { .has-side .side-snart { display: none; } }   /* the left column shows it there */

/* ---------- Post form: repeats ---------- */
.day-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.day-picks .chip { min-width: 52px; justify-content: center; }
.recur-days { display: grid; gap: 8px; }
.recur-days-label { font-weight: 600; font-size: .9rem; }
.recur-days-label small { color: var(--ink-3); font-weight: 400; }
.fact-recur .i { color: var(--accent) !important; }

/* ---------- Calendar: roomier days, labels that stay inside them ---------- */
/* A grid track grows to its longest content unless told otherwise - that is what let a title run out
   of its day and over the next one. Pin the day and its list to the column, and let a title wrap onto
   two lines (then …) instead of being cut after a few letters. */
.cal-row { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); }
.cal-day { min-height: 112px; padding: 8px 5px 6px; overflow: hidden; }
.cal-evs { grid-template-columns: minmax(0, 1fr); }
.cal-evs li { min-width: 0; }
.cal-ev {
    white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    padding: 4px 6px; font-size: .77rem; line-height: 1.3; overflow-wrap: anywhere;
}
.cal-ev b { display: block; font-size: .72rem; }
@media (max-width: 700px) {
    .cal-row { grid-template-columns: 22px repeat(7, minmax(0, 1fr)); }
    .cal-day { min-height: 48px; padding: 4px 0; }
}

/* ---------- Time picker (mouse screens) ---------- */
.timepick { position: relative; display: block; }
.timepick input { width: 100%; font-variant-numeric: tabular-nums; }
.timepick input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }


/* Wording that depends on the device: a phone takes or picks a photo, a PC clicks or drags one in. */
.on-mouse { display: none; }
@media (hover: hover) and (pointer: fine) {
    .on-mouse { display: block; }
    .on-touch { display: none !important; }
}
/* Dragging a picture over the box: show that it will land there. */
.imgpick-drop:has(input:hover), .imgpick-drop.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.imgpick-empty .on-mouse { display: none; }
@media (hover: hover) and (pointer: fine) {
    .imgpick-empty .on-mouse { display: block; }
    .imgpick-empty .on-touch { display: none; }
}
/* Two-step time list: hours 00-23 in a grid, then the four quarters. */
.timepick-list {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 264px; padding: 10px;
    display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.timepick.open .timepick-list { display: block; }
.tp-label { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 2px 8px; }
.tp-label b { font-size: .95rem; color: var(--ink); letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.tp-back { border: 0; background: var(--surface-2); border-radius: 8px; padding: 3px 8px; cursor: pointer; font: inherit; font-size: .74rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.tp-grid { display: grid; gap: 4px; }
.tp-grid-h { grid-template-columns: repeat(6, 1fr); }
.tp-grid-m { grid-template-columns: repeat(4, 1fr); }
.tp-grid button {
    border: 0; background: var(--surface-2); padding: 8px 0; border-radius: 8px; cursor: pointer;
    font: inherit; font-size: .92rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
}
.tp-grid-m button { padding: 12px 0; font-size: 1rem; }
.tp-grid button:hover { background: var(--accent-soft); color: var(--accent); }
.tp-grid button.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- Errors at the field ---------- */
.field-error {
    margin: 6px 0 0; font-size: .86rem; font-weight: 600; color: var(--danger);
    display: flex; align-items: center; gap: 6px; animation: rise .2s ease both;
}
.field-error::before { content: '!'; flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 800; }
.has-error input, .has-error textarea, .has-error select,
.has-error .imgpick-drop { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.tag-picks.has-error { padding: 6px; border-radius: 12px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 40%, transparent); }

/* Two fields side by side: an error message under one must not stretch the other. */
.field-row { align-items: start; }
.field { align-content: start; }

/* Live search: the old results fade a little while the new ones load. */
#board-live { transition: opacity .15s; }
#board-live.is-loading { opacity: .55; }
.search input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Photo library ---------- */
.imgpick-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.imgpick-picked { font-size: .86rem; font-weight: 600; color: var(--accent); }
.libdlg {
    width: min(880px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0;
    border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift);
}
.libdlg::backdrop { background: rgba(15, 20, 17, .5); }
.libdlg[open] { display: flex; flex-direction: column; animation: rise .2s ease both; }
.libdlg-head {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.libdlg-head strong { font-family: var(--font-display); font-size: 1.25rem; white-space: nowrap; }
.libdlg-search {
    flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
    background: var(--surface-2); font: inherit;
}
.libdlg-search:focus { outline: none; border-color: var(--accent); }
.libdlg-close { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.libdlg-grid { overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.libdlg-item {
    border: 2px solid transparent; border-radius: 14px; padding: 0; overflow: hidden; cursor: pointer;
    background: var(--surface-2); text-align: left; font: inherit; color: var(--ink);
    transition: border-color .15s, transform .1s;
}
.libdlg-item:hover { border-color: var(--accent); }
.libdlg-item:active { transform: scale(.98); }
.libdlg-item.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.libdlg-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.libdlg-item span { display: block; padding: 7px 10px; font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.libdlg-none { grid-column: 1 / -1; text-align: center; color: var(--ink-3); padding: 30px 0; }
@media (max-width: 600px) {
    .libdlg { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
    .libdlg-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }
    .libdlg-head strong { display: none; }
}

/* ---------- Icon picker: five-wide grid, like the hour picker ---------- */
.iconpick { position: relative; }
.iconpick-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 4px 12px 4px 6px;
    border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface);
    font: inherit; color: var(--ink); cursor: pointer; text-align: left;
}
.iconpick-btn:hover, .iconpick.open .iconpick-btn { border-color: var(--accent); }
.iconpick-btn .side-ico { width: 34px; height: 34px; }
.iconpick-label { flex: 1; font-weight: 600; font-size: .92rem; }
.iconpick-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 10px; margin-top: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.iconpick.js .iconpick-grid { display: none; position: absolute; top: 100%; left: 0; z-index: 25; width: 300px; max-width: 86vw; }
.iconpick.js.open .iconpick-grid { display: grid; }
.iconpick-opt { position: relative; display: grid; place-items: center; padding: 4px; border-radius: 10px; cursor: pointer; }
.iconpick-opt input { position: absolute; opacity: 0; pointer-events: none; }
.iconpick-opt .side-ico { width: 40px; height: 40px; transition: transform .1s; }
.iconpick-opt:hover { background: var(--surface-2); }
.iconpick-opt:hover .side-ico { transform: scale(1.08); }
.iconpick-opt:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.iconpick-opt:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
/* A few more colours, so different kinds of links are easy to tell apart at a glance. */
.ico-alert, .ico-tools { background: #fdf0d6; color: #a86a00; }
.ico-health, .ico-heart { background: var(--heart-soft); color: var(--heart); }
.ico-bike, .ico-car, .ico-parking { background: var(--warm-soft); color: var(--warm); }
.ico-tree, .ico-water, .ico-dog { background: #e3f3e6; color: #2e7d3a; }
.ico-school, .ico-book, .ico-child { background: #e8eefb; color: #3b5bb3; }
.ico-bulb, .ico-money { background: #fdf6d6; color: #9a7a00; }

/* ---------- Sign-up per date ---------- */
.su-date { flex-basis: 100%; font-size: .78rem; color: var(--ink-3); margin-top: -2px; }
.signup { flex-wrap: wrap; }
.signup-dates { margin-top: 14px; padding: 16px 18px; }
.signup-dates .section-label { margin: 0 0 4px; }
.signup-dates-sub { margin: 0 0 10px; font-size: .88rem; color: var(--ink-3); }
.signup-dates ul { list-style: none; margin: 0; padding: 0; }
.signup-dates li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.sd-date { display: flex; align-items: center; gap: 12px; }
.sd-date strong { display: block; }
.sd-date small { color: var(--ink-3); font-size: .84rem; }

/* Photo library: never more than two pictures side by side, title under each, and the whole picture
   shown (no cropping) - big enough to see what it actually shows before choosing it.
   The rows are kept at their full height: inside the height-limited dialog a grid would otherwise squeeze
   them into thin strips, and the list scrolls instead. */
.libdlg { width: min(980px, calc(100vw - 24px)); }
.libdlg-grid {
    flex: 1 1 auto; min-height: 0; overscroll-behavior: contain;
    grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; align-items: start; gap: 16px;
}
.libdlg-item { display: flex; flex-direction: column; }
.libdlg-item img { flex: none; width: 100%; height: auto; aspect-ratio: auto; object-fit: contain; background: var(--surface-2); }
.libdlg-item span { padding: 9px 12px; font-size: .92rem; white-space: normal; }
@media (max-width: 600px) {
    .libdlg { width: 100vw; }
    .libdlg-grid { gap: 8px; }
}

/* ---------- Formatted post text: paragraphs, lists, bold, italic ---------- */
.post-body p, .tl-body p, .bubble-text p { margin: 0 0 .7em; }
.post-body p:last-child, .tl-body p:last-child, .bubble-text p:last-child { margin-bottom: 0; }
.post-body ul, .post-body ol, .tl-body ul, .tl-body ol, .bubble-text ul, .bubble-text ol { margin: .2em 0 .8em; padding-left: 1.4em; }
.post-body li, .tl-body li, .bubble-text li { margin: .15em 0; }
.post-body strong, .tl-body strong { font-weight: 700; }
/* The shortened text on the board: five lines, faded out - line-clamp does not work across paragraphs and lists. */
.post-body.is-clamped {
    display: block; -webkit-line-clamp: unset; max-height: calc(1.55em * 7 + .7em); overflow: hidden;   /* 7 lines + a paragraph gap */
    -webkit-mask-image: linear-gradient(#000 calc(100% - 1.4em), transparent); mask-image: linear-gradient(#000 calc(100% - 1.4em), transparent);
}

/* ---------- Formatting buttons ---------- */
.fmt-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: -2px; }
.fmt-bar button {
    width: 36px; height: 34px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; color: var(--ink); font: inherit; font-size: 1rem;
}
.fmt-bar button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.fmt-hint { margin-left: 6px; font-size: .78rem; color: var(--ink-3); }
@media (max-width: 420px) { .fmt-hint { display: none; } }

/* ---------- Veiledninger ---------- */
.guide-link {
    display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 14px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--accent-soft);
    color: var(--ink); text-decoration: none;
}
.guide-link:hover { border-color: var(--accent); }
.guide-link-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface); color: var(--accent); flex: none; }
.guide-link-text { flex: 1; min-width: 0; display: grid; }
.guide-link-text small { color: var(--accent-2); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.guide-link-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-link .i-arrow { color: var(--ink-3); transition: transform .15s; }
.guide-link:hover .i-arrow { transform: translateX(3px); color: var(--accent); }

.guide { padding: 26px 28px; }
.guide-kicker { display: flex; align-items: center; gap: 6px; color: var(--accent-2); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.guide-kicker svg { width: 16px; height: 16px; }
.guide-title { font-family: var(--font-display); font-size: 1.8rem; line-height: 1.2; margin: 8px 0 6px; }
.guide-summary { color: var(--ink-2); font-size: 1.08rem; margin: 0 0 14px; }
.guide-img { display: block; width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius-sm); margin: 6px 0 16px; }
.guide-body { font-size: 1.05rem; line-height: 1.65; }
.guide-body ol li, .guide-body ul li { margin-bottom: 6px; }
.guide-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-3); }
.guide-actions { display: flex; gap: 8px; }
.guide-posts { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.guide-posts li { padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.guide-posts a { font-weight: 600; text-decoration: none; color: var(--ink); }
.guide-posts small { color: var(--ink-3); margin-left: 6px; }

.guide-list { display: grid; gap: 10px; margin-top: 6px; }
.guide-item { display: flex; align-items: center; gap: 14px; padding: 12px; text-decoration: none; color: var(--ink); }
.guide-item:hover { box-shadow: var(--shadow-lift); }
.guide-item.is-off { opacity: .6; }
.guide-item img, .guide-item-icon { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.guide-item-icon { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.guide-item-icon svg { width: 28px; height: 28px; }
.guide-item-text { display: grid; gap: 3px; min-width: 0; }
.guide-item-text strong { font-size: 1.05rem; }
.guide-item-text small { color: var(--ink-2); }
@media (max-width: 600px) { .guide { padding: 20px 18px; } .guide-title { font-size: 1.5rem; } }

/* "Les mer" slides the text open in the card (app.js sets the pixel heights). */
.post-body.is-anim { overflow: hidden; transition: max-height .35s ease; }
@media (prefers-reduced-motion: reduce) { .post-body.is-anim { transition: none; } }

/* Phone-only message: call / SMS buttons above the note box. */
.phone-only { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); margin-bottom: 12px; }
.phone-only p { margin: 0 0 10px; }
.phone-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-note { margin: 14px 0 0; font-size: .88rem; color: var(--ink-3); text-align: center; }

/* Innsendte innlegg (Page admins) */
.pending-list { display: grid; gap: 12px; }
.pending-item { padding: 18px 20px; }
.pending-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .86rem; color: var(--ink-3); }
.pending-meta a { color: var(--accent); font-weight: 600; }
.pending-title { font-family: var(--font-display); font-size: 1.3rem; margin: 6px 0 4px; }
.pending-when { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; color: var(--ink-2); font-size: .92rem; }
.pending-when svg { width: 16px; height: 16px; color: var(--accent); }
.pending-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pending-actions form { margin: 0; }
.pending-banner { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warm-soft); margin: 0 0 14px; font-size: .92rem; }
.pending-banner a { font-weight: 600; }

/* Month calendar under date fields (mouse) - app.js builds it; phones keep their own date wheel. */
.datepick { position: relative; display: block; }
.datepick input { width: 100%; font-variant-numeric: tabular-nums; }
.datepick input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent); }
.datepick-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 300px; padding: 12px;
    display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift);
}
.datepick.open .datepick-pop { display: block; animation: rise .15s ease both; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.dp-head b { font-family: var(--font-display); font-size: 1.08rem; text-transform: capitalize; }
.dp-nav {
    width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
    cursor: pointer; font-size: 1.2rem; line-height: 1; color: var(--ink-2);
}
.dp-nav:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-wd { text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 2px 0 6px; }
.dp-day {
    aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
    font: inherit; font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
}
.dp-we { color: var(--warm); }
.dp-day.dp-out { color: var(--ink-3); opacity: .45; font-weight: 500; }
.dp-day:hover { background: var(--accent-soft); color: var(--accent); }
.dp-day.dp-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.dp-day.on { background: var(--accent); color: var(--accent-ink); opacity: 1; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dp-foot button {
    border: 0; background: var(--surface-2); border-radius: 999px; padding: 6px 14px; cursor: pointer;
    font: inherit; font-size: .84rem; font-weight: 600; color: var(--accent);
}
.dp-foot button:hover { background: var(--accent-soft); }

/* ---------- Dagens ord (ord.php, assets/ord.js) ---------- */
.wg { max-width: 520px; margin: 0 auto; }
.wg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.wg-title { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; margin: 0; }
.wg-no { color: var(--ink-3); font-size: 1.1rem; font-weight: 600; }
.wg-sub { margin: 6px 0 0; color: var(--ink-2); }
.wg-help-btn {
    flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface);
    font: inherit; font-weight: 700; font-size: 1.05rem; color: var(--accent); cursor: pointer;
}
.wg-help-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.wg-help { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; font-size: .94rem; }
.wg-help p { margin: 0 0 10px; }
.wg-help p:last-child { margin: 10px 0 0; color: var(--ink-2); }
.wg-help-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.wg-help .wg-tile { width: 34px; height: 34px; font-size: 1rem; flex: none; }

.wg-board { display: grid; gap: 6px; justify-content: center; margin: 4px 0 10px; }
.wg-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wg-row.shake { animation: wg-shake .4s; }
.wg-tile {
    width: clamp(48px, 15vw, 60px); height: clamp(48px, 15vw, 60px);
    display: grid; place-items: center; border-radius: 12px;
    border: 2px solid var(--line); background: var(--surface);
    font-family: var(--font-display); font-size: clamp(1.4rem, 6vw, 1.9rem); font-weight: 700; text-transform: uppercase; color: var(--ink);
}
.wg-tile.filled { border-color: var(--ink-3); animation: wg-pop .1s; }
.wg-tile.g { background: var(--accent); border-color: var(--accent); color: #fff; }
.wg-tile.y { background: var(--warm); border-color: var(--warm); color: #fff; }
.wg-tile.x { background: var(--ink-3); border-color: var(--ink-3); color: #fff; opacity: .75; }
.wg-tile.flip { animation: wg-flip .5s ease both; }
@keyframes wg-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes wg-pop { 50% { transform: scale(1.08); } }
@keyframes wg-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .wg-tile.flip, .wg-row.shake, .wg-tile.filled { animation: none; } }

.wg-msg {
    min-height: 1.6em; text-align: center; font-weight: 600; font-size: .92rem; color: var(--ink-2);
    opacity: 0; transition: opacity .2s; margin-bottom: 8px;
}
.wg-msg.show { opacity: 1; }

.wg-keys { display: grid; gap: 6px; margin-bottom: 18px; user-select: none; }
.wg-krow { display: flex; justify-content: center; gap: 5px; }
.wg-key {
    flex: 1; max-width: 44px; height: 52px; border: 0; border-radius: 10px; background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
    font: inherit; font-weight: 700; font-size: 1rem; text-transform: uppercase; color: var(--ink);
    touch-action: manipulation;
}
.wg-key.wide { max-width: 68px; flex: 1.5; font-size: .78rem; }
.wg-key:hover { background: var(--accent-soft); }
.wg-key:active { transform: scale(.95); }
.wg-key.g { background: var(--accent); color: #fff; box-shadow: none; }
.wg-key.y { background: var(--warm); color: #fff; box-shadow: none; }
.wg-key.x { background: var(--ink-3); color: #fff; opacity: .55; box-shadow: none; }
@media (max-width: 400px) { .wg-krow { gap: 3px; } .wg-key { height: 48px; font-size: .9rem; } }

.wg-result-card { padding: 18px 20px; margin-bottom: 14px; text-align: center; animation: rise .25s ease both; }
.wg-result-card h2 { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 6px; }
.wg-result-card p { margin: 0 0 12px; color: var(--ink-2); }
.wg-name { text-align: left; margin: 6px 0 14px; }
.wg-name label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.wg-name-row { display: flex; gap: 8px; }
.wg-name-row input { flex: 1; min-width: 0; }
.wg-named { font-size: .92rem; }
.wg-result-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.wg-next { font-size: .86rem; color: var(--ink-3); }

.wg-list { padding: 16px 18px; }
.wg-list-title { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 10px; }
.wg-top, .wg-all { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wg-all { margin-top: 4px; }
.wg-top li, .wg-all li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.wg-top li { background: var(--surface-2); }
.wg-top li:first-child { background: color-mix(in srgb, var(--sun) 22%, var(--surface)); }
.wg-top li.me, .wg-all li.me { box-shadow: inset 0 0 0 2px var(--accent); }
.wg-place { width: 28px; text-align: center; font-weight: 700; color: var(--ink-3); flex: none; }
.wg-top .wg-place { font-size: 1.2rem; }
.wg-who { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-score { font-size: .86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wg-all-btn { margin-top: 10px; border: 0; background: none; padding: 4px 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
.wg-empty { margin: 0; color: var(--ink-3); font-size: .92rem; }

/* "Dagens ord" teaser in the sidebar */
.wg-side { display: flex; align-items: center; gap: 12px; padding: 14px; text-decoration: none; color: var(--ink); }
.wg-side:hover { border-color: var(--accent); }
.wg-side-tiles { display: grid; grid-template-columns: repeat(5, 18px); gap: 3px; flex: none; }
.wg-side-tiles span {
    width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center;
    font-size: .66rem; font-weight: 800; border: 1.5px solid var(--line-2); color: var(--ink-2); background: var(--surface);
}
.wg-side-tiles .g { background: var(--accent); border-color: var(--accent); color: #fff; }
.wg-side-tiles .y { background: var(--warm); border-color: var(--warm); color: #fff; }
.wg-side-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wg-side-text small { color: var(--ink-3); font-size: .8rem; }
.wg-side .side-go { color: var(--ink-3); }

/* Translate menu in the header */
.lang-menu { position: relative; }
.lang-menu summary {
    list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
    font-weight: 600; font-size: .9rem; color: var(--ink-2);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { border-color: var(--line-2); color: var(--accent); }
.lang-pop {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 35; min-width: 190px; padding: 8px;
    display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift);
    animation: rise .15s ease both;
}
.lang-head { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 4px 10px 6px; }
.lang-pop a { padding: 8px 10px; border-radius: 9px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .94rem; }
.lang-pop a:hover { background: var(--accent-soft); color: var(--accent); }
.lang-pop a[dir="rtl"] { text-align: right; }
.lang-note { padding: 6px 10px 2px; font-size: .72rem; color: var(--ink-3); border-top: 1px solid var(--line); margin-top: 4px; }
@media (max-width: 760px) {
    .lang-label { display: none; }
    .lang-menu summary { width: 40px; padding: 0; justify-content: center; }
}
.lang-pop .lang-orig { color: var(--accent); border-bottom: 1px solid var(--line); border-radius: 9px 9px 0 0; margin-bottom: 4px; }
.lang-pop a[hidden] { display: none; }

/* Translate: in the header on wider screens, in the ☰ drawer (beside the X) on phones. */
.sidebar-head .lang-menu { display: none; margin-left: auto; }
.sidebar-head .side-edit + .lang-menu { margin-left: 0; }
@media (max-width: 760px) {
    .head-actions .lang-menu { display: none; }
    .sidebar-head .lang-menu { display: block; }
    .sidebar-head .lang-menu summary { width: 40px; height: 40px; }
}
.sidebar-head { position: relative; z-index: 6; }   /* the language list opens over the boxes below */

/* Phones: the new-post button sits beside Alle / Kommende / Kalender instead of in the header. */
.tabs-row { display: flex; align-items: center; gap: 8px; }
.tabs-new { display: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
@media (max-width: 760px) {
    .tabs-new { display: inline-flex; align-items: center; justify-content: center; }
    .head-actions .btn-new { display: none; }
}
@media (max-width: 420px) { .tabs-row .tabs a { padding: 7px 11px; } }   /* four tabs + the button still fit */
