/* 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(--surface-2); color: var(--ink); border-color: var(--line);
    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(--ink-3); 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: 84px; padding-top: 34px; max-height: calc(100vh - 96px); 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); }
@media (min-width: 1400px) { .wx-pill { cursor: default; pointer-events: none; } }   /* the box is right there */
.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; } }

/* Phones: no "Logg inn" in the crowded header - it is the footer link instead, for the few who post. */
.foot-login .on-phone { display: none; }
@media (max-width: 600px) {
    .btn-login { display: none; }
    .foot-login .on-wide { display: none; }
    .foot-login .on-phone { display: inline; 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; }
