/* Harvest base chrome - Myelink "technical print" language.
   Paper background, ink text, hairline rules, square shapes, mono microtext. */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

html, body {
    font-family: var(--font-sans);
    color: var(--fg);
    background-color: var(--bg);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 15.5px;
    line-height: 1.6;
}

/* Header: sticky paper bar with hairline rule */
.header {
    background-color: rgba(250, 250, 248, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.9rem 2rem;
    color: var(--fg);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    border-bottom: 0.5px solid var(--line);
}

.header.scrolled {
    background-color: rgba(250, 250, 248, 0.85);
    border-bottom: 0.5px solid var(--line);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1180px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

/* Brand name: the single 600-weight exception of the system */
.header-title-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    text-decoration: none;
    color: var(--fg);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Parent byline, mono microtext beside the 600-weight brand */
.header-title-by {
    align-self: flex-end;
    margin: 0 0 3px 0.5em;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--muted-2);
    white-space: nowrap;
}

.header-logo {
    display: block;
}

.header-title-link:hover,
.header-title-link:active {
    color: var(--fg);
    text-decoration: none;
}

/* City display: mono metadata under the brand */
.city-display {
    display: none;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted-2);
    margin-top: 0.15rem;
    text-align: left;
    width: 100%;
}

.header p {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    margin-top: 0.2rem;
    color: var(--muted-2);
}

.harvest-auth-links {
    font-size: 0.95rem;
    font-weight: 400;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.harvest-auth-links a {
    text-decoration: none;
    color: var(--fg);
    transition: color 160ms ease;
}

.harvest-auth-links a:hover {
    color: var(--accent);
}

.auth-placeholder {
    visibility: hidden;
    width: 0;
    margin-left: auto;
    display: inline-block;
}

/* Main content wrapper */
.main-wrapper {
    flex-grow: 1;
    min-height: 0;
    padding-top: 1rem;
}

/* Navbar */
.navbar {
    background-color: transparent;
    display: flex;
    align-items: center;
}

.navbar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

.navbar li {
    margin: 0;
}

.navbar a {
    display: block;
    padding: 0.3rem 0.5rem;
    color: var(--fg);
    text-decoration: none;
    font-weight: 400;
    transition: color 160ms ease;
}

.navbar a:hover,
.navbar a.active {
    color: var(--accent);
}

/* Main content area */
.content {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: visible;
}

.content h1 {
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--fg);
    text-wrap: balance;
}

.content p {
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--muted);
    text-wrap: pretty;
}

/* Footer: inverted big section, Myelink style */
.footer {
    background-color: var(--dark-bg);
    color: var(--dark-muted);
    border-top: 0.5px solid var(--dark-line);
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 32px 0;
}

.footer-main {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
    gap: 40px;
}

.footer-brand {
    max-width: 34ch;
}

.footer-logo {
    display: inline-block;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--dark-fg);
    text-decoration: none;
    margin-bottom: 14px;
    transition: color 160ms ease;
}

.footer-logo:hover {
    color: var(--accent-on-dark);
}

.footer-by {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dark-muted);
}

.footer-tagline {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--dark-muted);
    margin: 0;
    text-wrap: pretty;
}

.footer-col-title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-on-dark);
    margin: 4px 0 16px;
}

.footer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.footer-nav-link {
    color: var(--dark-muted);
    text-decoration: none;
    font-size: 14.5px;
    line-height: 1.3;
    border-bottom: 0.5px solid transparent;
    transition: color 160ms ease, border-color 160ms ease;
}

.footer-nav-link:hover {
    color: var(--dark-fg);
    border-bottom-color: var(--accent-on-dark);
}

.footer-nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(143, 166, 245, 0.35);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 48px;
    padding: 20px 0;
    border-top: 0.5px solid var(--dark-line);
}

.footer .copyright {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--dark-muted);
}

.footer .social {
    display: flex;
    gap: 8px;
}

.footer .social-link {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 0.5px solid var(--dark-line);
    text-decoration: none;
    transition: border-color 160ms ease;
}

.footer .social-link:hover,
.footer .social-link:focus-visible {
    border-color: var(--accent-on-dark);
    background: transparent;
    outline: none;
}

/* Icons stay monochrome on ink */
.footer .social-link img {
    display: block;
    filter: brightness(0) invert(0.65);
    transition: filter 160ms ease;
}

.footer .social-link:hover img,
.footer .social-link:focus-visible img {
    filter: brightness(0) invert(0.98);
}

@media (max-width: 820px) {
    .footer-main {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-brand {
        max-width: none;
    }
}

@media (max-width: 520px) {
    .footer-container {
        padding: 40px 20px 0;
    }

    .footer-main {
        gap: 28px;
    }
}

/* Modal: paper form on ink veil */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(28, 25, 23, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card);
    border: 0.5px solid var(--line-strong);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 0.5px solid var(--line);
}

.modal-header h2 {
    margin: 0;
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--muted-2);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 160ms ease;
}

.modal-close:hover {
    background: transparent;
    color: var(--fg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    border-top: 0.5px solid var(--line);
}

/* Settings */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-label {
    display: block;
    margin-bottom: 0.75rem;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-2);
}

.radius-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.radius-slider {
    flex: 1;
    height: 2px;
    background: var(--line-strong);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    cursor: pointer;
}

.radius-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 0;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.radius-number {
    width: 80px;
    padding: 0.5rem;
    border: 0.5px solid var(--line-strong);
    background: var(--card);
    color: var(--fg);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 13px;
}

.radius-info {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted-2);
}

.radius-current {
    display: inline-block;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border: 0.5px solid var(--accent);
}

.btn-primary:hover {
    background: var(--fg);
    border-color: var(--fg);
}

.btn-secondary {
    background: transparent;
    color: var(--muted);
    border: 0.5px solid var(--line-strong);
}

.btn-secondary:hover {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

/* Settings trigger button styling (row inside user menu) */
.settings-trigger {
    background: none !important;
    border: none !important;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.settings-trigger:hover {
    background-color: var(--bg-alt) !important;
    color: var(--fg) !important;
}

.city-display,
.radius-display-inline {
    font-family: var(--font-mono);
}

.radius-display-inline {
    font-size: 11px;
    color: var(--faint);
    margin-left: 0.25rem;
}

/* Cookie notice: small paper card, hairline border */
.cookie-notice {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
}

.cookie-notice.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-card {
    max-width: 320px;
    padding: 1rem;
    background-color: var(--card);
    border: 0.5px solid var(--line-strong);
}

.cookie-card .title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg);
}

.cookie-card .description {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted);
}

.cookie-card .description a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 0.5px solid rgba(36, 82, 224, 0.3);
}

.cookie-card .description a:hover {
    border-bottom-color: var(--accent);
    text-decoration: none;
}

.cookie-card .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    column-gap: 1rem;
    flex-shrink: 0;
}

.cookie-card .pref {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted-2);
    border: none;
    background-color: transparent;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 0.5px solid var(--line-strong);
    transition: color 160ms ease, border-color 160ms ease;
}

.cookie-card .pref:hover {
    color: var(--fg);
    border-bottom-color: var(--fg);
}

.cookie-card .pref:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.cookie-card .accept {
    font-family: var(--font-mono);
    font-size: 11px;
    background-color: var(--fg);
    font-weight: 500;
    color: var(--dark-fg);
    padding: 0.6rem 1rem;
    border: 0.5px solid var(--fg);
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.cookie-card .accept:hover {
    background-color: var(--accent);
    border-color: var(--accent);
}

.cookie-card .accept:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .cookie-notice {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }

    .cookie-card {
        max-width: none;
        padding: 0.85rem;
    }

    .cookie-card .description {
        font-size: 0.8rem;
    }

    .cookie-card .actions {
        flex-direction: column;
        gap: 0.4rem;
    }

    .cookie-card .pref,
    .cookie-card .accept {
        width: 100%;
        text-align: center;
    }
}

/* Non-sticky header alternative */
.header.non-sticky {
    position: static;
    background-color: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 0.5px solid var(--line);
}

/* Back-to-top: square ink button, no lift */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 44px;
    height: 44px;
    background-color: var(--fg);
    color: var(--dark-fg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 160ms ease, opacity 160ms ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background-color: var(--accent);
}

/* Focus management for accessibility */
:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 82, 224, 0.35);
}

:focus:not(:focus-visible) {
    box-shadow: none;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 82, 224, 0.35);
}

/* Reduced motion kills smooth scroll and transitions */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0.9rem 1.5rem;
    }

    .header-container {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .header-left {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        align-items: center;
    }

    .header-title {
        align-items: center;
    }

    .city-display {
        text-align: center;
    }

    .navbar {
        width: 100%;
        justify-content: center;
    }

    .navbar ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .navbar a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .harvest-auth-links {
        justify-content: center;
    }

    .content {
        padding: 1.5rem;
    }



    .back-to-top {
        bottom: 90px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .navbar ul {
        gap: 0.5rem;
    }

    .harvest-auth-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .auth-placeholder {
        display: none;
    }
}
