/* =========================================================
   KALATUTKA.FI — SHARED COMPONENTS
   Anything that can appear on more than one page lives here:
   ad slots, the announcement bar, notices, the brand lockup,
   and the accessibility utilities. Loaded on every front-end
   view so these never render unstyled again.
   ========================================================= */

/* Utilities ---------------------------------------------- */

.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;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 2000;
    padding: 10px 18px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--brand-navy);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: top var(--transition);
}

.skip-link:focus {
    top: 0;
}

/* Announcement bar ---------------------------------------- */

.site-announcement {
    position: relative;
    z-index: 1200;
    padding: 9px 18px;
    background: var(--brand-navy);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.site-announcement a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    text-decoration: none;
}

.site-announcement a:hover {
    text-decoration: underline;
}

/* Notices -------------------------------------------------- */

.app-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: min(720px, calc(100% - 32px));
    margin: 18px auto;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.55;
}

/* Ad slots -------------------------------------------------- */

.ad-section {
    padding-top: 18px;
    padding-bottom: 18px;
}

.ad-slot {
    position: relative;
    overflow: hidden;
    margin: 16px auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}

.ad-slot--wide {
    margin-top: 16px;
    margin-bottom: 0;
}

.ad-slot__link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-height: 84px;
    padding: 14px 18px;
    color: inherit;
    text-decoration: none;
}

.ad-slot__link:hover {
    background: var(--surface);
}

.ad-slot__label {
    position: absolute;
    top: 7px;
    right: 9px;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--bg-soft);
    color: var(--text-faint);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ad-slot__image {
    display: block;
    max-width: min(58%, 720px);
    max-height: 150px;
    object-fit: contain;
}

.ad-slot__copy {
    display: grid;
    gap: 4px;
    max-width: 520px;
}

.ad-slot__copy strong {
    color: var(--brand-navy);
    font-size: 1rem;
}

:root[data-theme="dark"] .ad-slot__copy strong {
    color: var(--text);
}

.ad-slot__copy > span {
    color: var(--text-soft);
    font-size: 0.78rem;
    line-height: 1.5;
}

.ad-slot--map_sidebar {
    margin: 0 0 12px;
}

.ad-slot--map_sidebar .ad-slot__link {
    display: grid;
    min-height: 0;
    padding: 14px;
}

.ad-slot--map_sidebar .ad-slot__image {
    max-width: 100%;
    max-height: 130px;
}

/* Brand lockup --------------------------------------------- */

.site-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    font-weight: 800;
}

.site-header-brand img {
    display: block;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    object-fit: contain;
}

/* Focus ----------------------------------------------------- */

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (max-width: 700px) {
    .ad-slot__link {
        flex-direction: column;
        text-align: center;
    }

    .ad-slot__image {
        max-width: 100%;
    }

    .ad-slot--wide {
        width: calc(100% - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .skip-link {
        transition: none;
    }
}

/* Floating notice ------------------------------------------
   Same visual family as the static banner above, but pinned to
   the viewport and animated in. app.js builds this variant. */

.app-notice--toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    left: auto;
    z-index: 1600;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    width: min(420px, calc(100vw - 40px));
    margin: 0;
    border-left-width: 1px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 260ms ease, transform 260ms ease;
}

.app-notice--toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-notice--toast > i {
    font-size: 1.05rem;
    color: var(--secondary);
}

.app-notice--success > i { color: var(--success); }
.app-notice--warning > i { color: var(--accent); }
.app-notice--error > i { color: var(--danger); }

.app-notice--toast button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-soft);
    font: inherit;
    cursor: pointer;
}

.app-notice--toast button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

@media (max-width: 600px) {
    .app-notice--toast {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-notice--toast {
        transition: none;
        transform: none;
    }
}

/* Place search --------------------------------------------
   Used by the hero block and by both app shells, so it lives
   in the shared layer rather than the landing stylesheet. */

.place-search{display:grid;gap:10px;margin-top:18px}
.place-search-label{font-size:.9rem;font-weight:800;color:var(--text)}
.place-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center}
.place-search-row--compact{grid-template-columns:minmax(0,1fr) auto}
.place-search-input{width:100%;min-height:52px;padding:0 16px;border-radius:16px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);font:inherit}
.place-search-input::placeholder{color:var(--text-soft)}
.place-search-input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 4px rgba(25, 174, 184, 0.16)}
.place-search-button{min-height:52px;white-space:nowrap}
.place-search-note{margin:0;color:var(--text-soft);font-size:.85rem;line-height:1.5}
#mapPlaceInput,#dashboardPlaceInput{min-height:44px;border-radius:12px}
#mapPlaceButton,#dashboardPlaceButton{width:auto;min-width:120px}
@media(max-width:700px){.place-search-row,.place-search-row--compact{grid-template-columns:1fr}.place-search-button,#mapPlaceButton,#dashboardPlaceButton{width:100%}}
