:root {
    --bg: #f3f6f4;
    --bg-elevated: #ffffff;
    --ink: #14212b;
    --muted: #5b6b76;
    --line: #d5dde3;
    --focus: #0b3d5c;
    --black: #1a1a1a;
    --green: #2f9e44;
    --brown: #8b5a2b;
    --warn: #9a5b00;
    --warn-bg: #fff4e0;
    --radius: 14px;
    --shadow: 0 18px 50px rgba(20, 33, 43, 0.08);
    --sticky-fade: rgba(243, 246, 244, 0.96);
    --sticky-fade-mid: rgba(243, 246, 244, 0.7);
    --bin-panel: rgba(255, 255, 255, 0.72);
    --glow-green: rgba(47, 158, 68, 0.12);
    --glow-blue: rgba(11, 61, 92, 0.10);
    --font-display: "Syne", sans-serif;
    --font-body: "Figtree", sans-serif;
}

[data-theme="dark"] {
    --bg: #0f1418;
    --bg-elevated: #1a2229;
    --ink: #e8eef2;
    --muted: #9aabb8;
    --line: #2c3842;
    --focus: #7eb6d6;
    --warn: #f0c674;
    --warn-bg: #2a2418;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --sticky-fade: rgba(15, 20, 24, 0.96);
    --sticky-fade-mid: rgba(15, 20, 24, 0.7);
    --bin-panel: rgba(26, 34, 41, 0.9);
    --glow-green: rgba(47, 158, 68, 0.16);
    --glow-blue: rgba(126, 182, 214, 0.08);
}

html {
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(ellipse 90% 55% at 10% -10%, var(--glow-green), transparent 55%),
        radial-gradient(ellipse 70% 45% at 100% 0%, var(--glow-blue), transparent 50%),
        var(--bg);
    line-height: 1.5;
}

.grain {
    pointer-events: none;
    position: fixed;
    inset: 0;
    opacity: 0.035;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

.hidden {
    display: none !important;
}

.topbar,
main,
.site-footer {
    position: relative;
    z-index: 1;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.1rem 1.25rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.brand-mark {
    display: grid;
    grid-template-columns: repeat(3, 8px);
    gap: 3px;
    align-items: end;
    height: 28px;
}

.bin-stack {
    display: block;
    width: 8px;
    border-radius: 2px 2px 1px 1px;
}

.bin-stack.black { height: 18px; background: var(--black); }
.bin-stack.green { height: 24px; background: var(--green); }
.bin-stack.brown { height: 14px; background: var(--brown); }

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-text span {
    font-size: 0.78rem;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.theme-toggle {
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink);
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--focus);
    outline: none;
}

.sync-chip {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

.sync-chip.warn {
    color: var(--warn);
    background: var(--warn-bg);
    border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
}

.hero {
    max-width: 1120px;
    margin: 0 auto;
    min-height: calc(100svh - 4.5rem);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
    align-items: stretch;
    padding: 1.5rem 1.25rem 2.5rem;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 0 2rem;
    animation: rise 0.8s ease both;
}

.eyebrow {
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--focus);
}

.brand-hero {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(3rem, 8vw, 5.4rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.hero-line {
    margin: 0.85rem 0 0;
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero-support {
    margin: 0.85rem 0 1.6rem;
    max-width: 28rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.postcode-form {
    max-width: 28rem;
}

.postcode-row {
    display: flex;
    gap: 0.6rem;
}

.postcode-row input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.95rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.postcode-row input:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(11, 61, 92, 0.12);
}

.postcode-row button,
.sticky-cal-btn,
.cal-btn {
    font: inherit;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    padding: 0.95rem 1.25rem;
    background: var(--focus);
    color: #fff;
    transition: transform 0.15s ease, background 0.15s ease;
}

.postcode-row button:hover,
.sticky-cal-btn:hover,
.cal-btn:hover {
    background: #0a3149;
}

.postcode-row button:active,
.cal-btn:active {
    transform: translateY(1px);
}

.postcode-row button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.form-hint {
    margin: 0.55rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
}

.form-hint.error {
    color: #9f1d1d;
}

.hero-visual {
    position: relative;
    margin: 0 -1.25rem -2.5rem 0;
    min-height: 420px;
    animation: fade 1s ease both;
}

.hero-art {
    width: 100%;
    height: 100%;
    min-height: 520px;
    object-fit: cover;
    display: block;
}

.bin-group {
    animation: floaty 5s ease-in-out infinite;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes wipe {
    from { clip-path: inset(0 100% 0 0); opacity: 0.4; }
    to { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes staggerIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.panel {
    max-width: 1120px;
    margin: 0 auto 2.5rem;
    padding: 0 1.25rem;
}

.section-head h2 {
    margin: 0.25rem 0 0.35rem;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    letter-spacing: -0.03em;
}

.section-head p {
    margin: 0;
    color: var(--muted);
}

.text-btn {
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--focus);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    margin-bottom: 0.35rem;
}

.filter-wrap {
    display: block;
    margin: 1rem 0 0.75rem;
}

.filter-wrap input {
    width: 100%;
    font: inherit;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--bg-elevated);
}

.address-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.address-list li {
    animation: staggerIn 0.35s ease both;
}

.address-list button {
    width: 100%;
    text-align: left;
    font: inherit;
    padding: 0.95rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.address-list button:hover,
.address-list button:focus-visible {
    border-color: var(--focus);
    box-shadow: var(--shadow);
    outline: none;
}

.address-list button:active {
    transform: translateY(1px);
}

.empty {
    margin: 1rem 0 0;
    color: var(--muted);
}

.next-collection {
    margin: 1.4rem 0 1.75rem;
    padding: 1.35rem 1.4rem;
    border-radius: var(--radius);
    background: var(--black);
    color: #f5f7f6;
    position: relative;
    overflow: hidden;
    animation: wipe 0.55s ease both;
}

.next-collection::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 8px;
    background: var(--next-color, var(--green));
}

.next-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    opacity: 0.7;
}

.next-bin {
    margin: 0.45rem 0 0;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.next-date {
    margin: 0.2rem 0 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.next-countdown {
    margin: 0.55rem 0 0;
    opacity: 0.75;
}

.bin-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.bin-block {
    padding: 1rem 1rem 1.1rem;
    border-top: 4px solid var(--bin-color, var(--line));
    background: var(--bin-panel);
    border-radius: 0 0 12px 12px;
}

.bin-block h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.bin-block .desc {
    margin: 0.2rem 0 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.bin-block ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bin-block li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
}

.bin-block li:last-child {
    border-bottom: 0;
}

.bin-block .paused {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.calendar-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.calendar-actions h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.calendar-actions > p {
    margin: 0.4rem 0 1rem;
    color: var(--muted);
    max-width: 40rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.cal-btn.secondary {
    background: transparent;
    color: var(--focus);
    border: 1.5px solid var(--focus);
}

.cal-btn.secondary:hover {
    background: color-mix(in srgb, var(--focus) 12%, transparent);
}

.status-panel pre {
    background: #14212b;
    color: #e8eef2;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    overflow-x: auto;
}

.sticky-cal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--sticky-fade), var(--sticky-fade-mid), transparent);
    display: flex;
    justify-content: center;
}

.sticky-cal-btn {
    text-decoration: none;
    display: inline-block;
    width: min(100%, 28rem);
    text-align: center;
    box-shadow: var(--shadow);
}

.site-footer {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1rem 1.25rem 5rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.site-footer a {
    color: var(--focus);
}

@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding-bottom: 0;
    }

    .hero-visual {
        margin: 0 -1.25rem;
        order: -1;
        min-height: 280px;
        max-height: 42vh;
        overflow: hidden;
    }

    .hero-art {
        min-height: 280px;
        transform: translateY(-8%);
    }

    .hero-copy {
        padding: 0.5rem 0 1.75rem;
    }

    .bin-columns {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (min-width: 861px) {
    .sticky-cal {
        display: none !important;
    }

    .site-footer {
        padding-bottom: 2.5rem;
    }
}

[data-theme="dark"] .hero-art {
    filter: brightness(0.72) saturate(0.9) contrast(1.05);
}

[data-theme="dark"] .next-collection {
    background: #0a0e12;
    border: 1px solid var(--line);
}

[data-theme="dark"] .grain {
    opacity: 0.05;
}
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
