@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Fraunces:ital,wght@0,600;1,600&display=swap');

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

html, body { overflow-x: hidden; }

body {
    font-family: 'Instrument Sans', sans-serif;
    background: #FDFAF4;
    color: #111;
    min-height: 100vh;
    min-height: 100svh;
    line-height: 1.5;
}

:focus-visible {
    outline: 2px solid #000;
    outline-offset: 3px;
}

/* ── Hero ─────────────────────────────────────────── */

.hero {
    width: 100%;
    height: 62svh;
    min-height: 340px;
    background-size: cover;
    background-position: center;
    background-color: #888;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


/* ── Lang toggle (inside hero) ───────────────────── */

.lang-nav {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 3px;
    background: rgba(26, 24, 21, 0.72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 999px;
}

.lang-btn {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    padding: 7px 14px;
    min-height: 36px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

.lang-btn:hover { color: #fff; }

.lang-btn.active {
    background: #FDFAF4;
    color: #1A1815;
}

@media (max-width: 600px) {
    .lang-nav { top: 12px; right: 12px; }
}

/* ── Hero content (title + search) ──────────────── */

.hero-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    text-align: center;
}

.hero-panel {
    background: #FDFAF4;
    padding: 2rem 2.5rem 2rem;
    width: 100%;
    max-width: 580px;
    border-radius: 12px;
}

.hero-panel h1 {
    font-family: 'Fraunces', serif;
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: 0;
    color: #000;
    margin-bottom: 0.3rem;
}

.hero-panel h1 em {
    font-style: italic;
}

.hero-panel h1 a {
    color: inherit;
    text-decoration: none;
}
.hero-panel h1 a:focus-visible {
    outline: 2px solid #000;
    outline-offset: 4px;
    border-radius: 2px;
}

.hero-panel .subtitle {
    font-size: 0.9375rem;
    color: #444;
    margin-bottom: 1.25rem;
}

/* ── Search inside hero ───────────────────────────  */

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 580px;
}

.clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #666;
    line-height: 1;
    padding: 0.625rem 0.75rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    touch-action: manipulation;
}
.clear-btn:hover { color: #000; }
.clear-btn:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}
.clear-btn.hidden { display: none; }

#search-input {
    width: 100%;
    padding: 1rem 2.5rem 1rem 1.25rem;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 1.0625rem;
    font-weight: 400;
    border: none;
    border-bottom: 1.5px solid #000;
    background: #FDFAF4;
    color: #111;
    outline: none;
    -webkit-appearance: none;
    transition: border-color 0.15s;
}

#search-input::placeholder { color: #666; }

#search-input:focus-visible {
    outline: none;
    border-bottom: 2.5px solid #000;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FDFAF4;
    border: 1.5px solid #000;
    border-top: none;
    z-index: 100;
    display: none;
    overflow: hidden;
    max-height: 280px;
    overflow-y: auto;
}

.autocomplete-list.show { display: block; }

.autocomplete-item {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: #111;
    border-bottom: 1px solid #eee;
    transition: background 0.1s;
    list-style: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.autocomplete-name {
    font-size: 0.9375rem;
    color: #111;
}

.autocomplete-kommune {
    font-size: 0.75rem;
    color: #666;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.selected { background: #EDE9DF; }

/* ── Painting credit ─────────────────────────────── */

.painting-credit {
    position: relative;
    z-index: 1;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-style: italic;
    color: rgba(255,255,255,0.8);
    text-align: right;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ── Result container ────────────────────────────── */

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

.result-container {
    animation: fadeIn 0.2s ease;
}

.result-container.hidden { display: none; }

.preposition-display { margin-bottom: 1.25rem; }

.preposition-label {
    display: block;
    font-size: 0.8125rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.preposition {
    font-family: 'Fraunces', serif;
    font-size: 4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: #000;
}

.prep-word {
    color: #111;
    margin-right: 0.25em;
}

.weather.hidden { display: none; }

.fact-box {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #555;
    line-height: 1.55;
}

.fact-title {
    font-weight: 600;
    color: #111;
    margin-bottom: 0.4rem;
}

.fact-box.hidden { display: none; }

.weather-sentence {
    font-size: 0.9375rem;
    color: #444;
    line-height: 1.5;
}

/* ── Loading ─────────────────────────────────────── */

.loading {
    margin-top: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #666;
    font-size: 0.9375rem;
}

.loading.hidden { display: none; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #000;
    border-radius: 50%;
    flex-shrink: 0;
    animation: spin 0.7s linear infinite;
}

/* ── Footer ──────────────────────────────────────── */

footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    font-size: 0.8125rem;
    color: #666;
}

footer a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}


.footer-copy {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #999;
}

/* ── Utilities ───────────────────────────────────── */

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

@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 640px) {
    .hero { height: 92vw; min-height: 380px; }
    .hero-content { justify-content: center; padding-bottom: 0; }
    .hero-content h1 { font-size: 2.25rem; }
    .hero-panel .subtitle { text-align: left; }
    .container { padding: 2rem 1.25rem 3rem; }
    .preposition { font-size: 3rem; }
    .painting-credit { display: none; }
}
