/* Minimal base (replaces dashboard Soft UI on public pages). */
*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; height: auto; }

/* CariYuk palette. Dark is the default; light keeps the same gold accents. */
body.search-home {
    --home-background: #fff;
    --home-surface: #f7f5f2;
    --home-muted: #6f6a62;
    --home-text: #57534e;
    --home-strong: #1a1a1a;
    --home-toggle: #e8e1cf;
    --home-accent: #9a7b1c;          /* gold dark enough to read on white */
    --home-accent-bright: #b8922a;
    --home-button: linear-gradient(135deg, #FFD76A, #D4AF37);
    --home-button-text: #0B0B0B;
    margin: 0;
    background: var(--home-background) !important;
    color: var(--home-text);
    font-family: Arial, Helvetica, sans-serif;
}
html[data-theme="dark"] body.search-home {
    --home-background: #0B0B0B;      /* main background */
    --home-surface: #151515;         /* card / search bar background */
    --home-muted: #B8B8B8;           /* secondary text */
    --home-text: #B8B8B8;
    --home-strong: #FFFFFF;          /* primary text */
    --home-toggle: #3B321D;          /* borders */
    --home-accent: #D4AF37;          /* primary accent */
    --home-accent-bright: #FFD76A;   /* bright gold */
    --home-button: linear-gradient(135deg, #FFD76A, #D4AF37);
    --home-button-text: #0B0B0B;
    color-scheme: dark;
}
.search-home .main-content { margin-top: 0 !important; }
/* Header, content and footer fill the window exactly: no scrollbar when the content fits. */
body.search-home > main.main-content { margin-top: 0 !important; min-height: 100svh; }
body.search-home > main.main-content > .mx-auto { display: flex; flex-direction: column; min-height: 100svh; }
/* Short pages (e.g. "No results"): keep the footer at the bottom of the window. */
body.search-home > main.main-content > .mx-auto > .site-footer { margin-top: auto; }
.home-content { flex: 1 0 auto; box-sizing: border-box; padding: 11vh 24px 48px; text-align: center; }
.home-wordmark { margin: 0 0 clamp(18px, 2vw, 28px); color: var(--home-accent);
    background: linear-gradient(135deg, var(--home-accent-bright), var(--home-accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(212, 175, 55, .35)); font-family: Arial, Helvetica, sans-serif; font-size: clamp(30px, 3.44vw, 58px); font-weight: 700; font-style: italic; line-height: 1.2; letter-spacing: -0.04em; }
.home-search { display: flex; align-items: center; gap: clamp(7px, .84vw, 14px); width: min(54vw, 900px); margin: 0 auto; padding: clamp(3px, .36vw, 6px) clamp(5px, .6vw, 10px); border-radius: 999px; background: var(--home-surface); border: 1px solid var(--home-toggle); }
.home-search svg { width: clamp(15px, 1.72vw, 25px); height: clamp(15px, 1.72vw, 25px); flex-shrink: 0; color: var(--home-muted) !important; }
.home-search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; color: var(--home-strong); font: inherit; font-size: clamp(11px, 1.18vw, 16px); line-height: clamp(24px, 2.57vw, 38px); }
.home-search input::placeholder { color: var(--home-muted); opacity: 1; font-style: italic; }
.home-search:focus-within { outline: 2px solid var(--home-accent); outline-offset: 3px; box-shadow: 0 0 18px rgba(212, 175, 55, .22); }
.home-search button { flex-shrink: 0; border: 0; border-radius: 999px; padding: 0 clamp(15px, 1.79vw, 28px); background: var(--home-button); color: var(--home-button-text); font: inherit; font-weight: 700; font-size: clamp(9px, .96vw, 14px); line-height: clamp(23px, 2.47vw, 36px); cursor: pointer; }
.home-search button:hover { filter: brightness(1.08); }
.home-search .notice-clear { background: transparent; border: 0; color: var(--home-muted); padding: 0 6px; font-size: 20px; cursor: pointer; }
.home-search input:placeholder-shown + .notice-clear { visibility: hidden; }
.home-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.home-search input[type="search"]::-ms-clear { display: none; }
.home-tagline { margin: clamp(14px, 1.72vw, 27px) 0 clamp(20px, 2.37vw, 36px); color: var(--home-muted); font-size: clamp(11px, 1.18vw, 16px); line-height: 1.6; }
.home-tagline strong { color: var(--home-strong); font-weight: 700; }
.home-links { display: flex; justify-content: center; gap: clamp(70px, 8.37vw, 135px); }
.home-links a { color: var(--home-text); font-size: clamp(11px, 1.18vw, 16px); line-height: 1.6; text-decoration: none; }
.home-links a:hover { text-decoration: underline; }
.home-links a:hover { color: var(--home-accent-bright); }
.home-links a:focus-visible, .home-search button:focus-visible { outline: 2px solid var(--home-accent); outline-offset: 4px; }
.home-theme-toggle { position: absolute; top: clamp(27px, 3.22vw, 48px); right: clamp(36px, 4.3vw, 64px); }
.home-theme-input { position: absolute; width: 100%; height: 100%; opacity: 0; margin: 0; }
.home-theme-label { position: relative; display: flex; align-items: center; justify-content: space-around; width: clamp(42px, 4.73vw, 68px); height: clamp(24px, 2.57vw, 36px); margin: 0; border: 1px solid var(--home-toggle); border-radius: 999px; background: var(--home-surface); cursor: pointer; }
.home-theme-label img { width: clamp(16px, 1.91vw, 24px); height: clamp(16px, 1.91vw, 24px); position: relative; z-index: 1; }
.home-theme-slider { position: absolute; right: 2px; width: calc(50% - 2px); height: calc(100% - 4px); border-radius: 50%; background: var(--home-toggle); transition: transform .2s; }
html[data-theme="dark"] .home-theme-label .home-theme-slider { transform: translateX(-100%); }
html[data-theme="dark"] .home-theme-label .home-theme-sun { filter: grayscale(1); opacity: .5; }
html[data-theme="dark"] .home-theme-label .home-theme-moon { filter: sepia(1) saturate(2.2) brightness(1.15) hue-rotate(5deg); }
.home-theme-input:focus-visible + .home-theme-label { outline: 2px solid var(--home-accent); outline-offset: 4px; }
@media (max-width: 600px) {
    .home-search { width: 100%; max-width: 480px; }
    .home-wordmark { font-size: 36px; margin-bottom: 34px; }
    .home-content { padding-top: 7vh; }
    .home-search input { font-size: 16px; line-height: 38px; }
    .home-search button { font-size: 13px; line-height: 34px; padding: 0 20px; }
    .home-tagline, .home-links a { font-size: 13px; }
    .home-theme-toggle { top: 20px; right: 20px; }
    .home-links { gap: 48px; }
}
@media (prefers-reduced-motion: reduce) { .home-theme-slider { transition: none; } }

.home-search { position: relative; }
/* Recent-search dropdown, joined to the search bar. */
.home-search.history-open {
    border-radius: 24px 24px 0 0;
    border-color: var(--home-accent);
    outline: 0;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, .25);
    z-index: 2;
}
.home-search.history-open > svg { color: var(--home-accent) !important; }
.home-history {
    position: absolute;
    top: 100%;
    left: -1px;
    right: -1px;
    margin: 0;
    padding: 6px;
    list-style: none;
    text-align: left;
    background: var(--home-surface);
    border: 1px solid var(--home-accent);
    border-top: 1px solid var(--home-toggle);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
    z-index: 60;
    /* Long lists scroll inside the dropdown instead of running over the page. */
    max-height: min(420px, 60vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--home-toggle) transparent;
}
.home-history::-webkit-scrollbar { width: 8px; }
.home-history::-webkit-scrollbar-thumb { background: var(--home-toggle); border-radius: 8px; border: 2px solid var(--home-surface); }
.home-history[hidden] { display: none; }
.home-history li {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 42px;
    padding: 6px 8px 6px 14px;
    border-radius: 12px;
    color: var(--home-text);
    font-size: clamp(14px, 1.18vw, 16px);
    line-height: 1.4;
    cursor: pointer;
    transition: background-color .12s, color .12s;
}
.home-history li:hover, .home-history li[aria-selected="true"], .home-history li:focus-within {
    background: var(--home-background);
    color: var(--home-strong);
}
.home-history li:hover .home-history-clock, .home-history li[aria-selected="true"] .home-history-clock { color: var(--home-accent); }
.home-history-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-search .home-history-delete {
    visibility: hidden;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--home-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.home-history li:hover .home-history-delete,
.home-history li[aria-selected="true"] .home-history-delete,
.home-history li:focus-within .home-history-delete { visibility: visible; }
.home-search .home-history-delete:hover { color: var(--home-strong); background: var(--home-toggle); }
.home-search .home-history-delete:focus-visible { visibility: visible; outline: 2px solid var(--home-accent); outline-offset: 1px; }
@media (hover: none) { .home-search .home-history-delete { visibility: visible; } }
.home-history li.home-history-heading,
.home-history li.home-history-heading:hover {
    min-height: 0;
    padding: 10px 14px 6px;
    background: none;
    color: var(--home-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: default;
}
.home-history li.home-history-heading + li.home-history-option { margin-top: 0; }
.home-history li.home-history-option + li.home-history-heading { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--home-toggle); border-radius: 0; }
.home-history-trend {
    width: 16px; height: 16px; flex-shrink: 0; background: var(--home-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 7h6v6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 7h6v6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.home-history-clock { position: relative; width: 15px; height: 15px; border: 1.5px solid currentColor; border-radius: 50%; flex-shrink: 0; color: var(--home-muted); }
.home-history-clock::after { content: ''; position: absolute; left: 5px; top: 2px; width: 3.5px; height: 4.5px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }

/* ---------- Header (all public pages): logo, menu, theme toggle ---------- */
.home-header { display: flex; align-items: center; gap: 24px; padding: 16px clamp(20px, 4.2vw, 64px); border-bottom: 1px solid var(--home-toggle); }
.home-header-logo { display: inline-flex; flex-shrink: 0; line-height: 0; text-decoration: none; }

/* Logo image (public/images/brand): dark-background version in dark mode, light version in light mode. */
.brand-logo { display: block; height: 38px; width: auto; }
.brand-logo--on-light { display: none; }
html[data-theme="light"] .brand-logo--on-dark { display: none; }
html[data-theme="light"] .brand-logo--on-light { display: block; }
.home-header-logo, .notice-logo, .site-footer-logo { transition: opacity .15s; }
.home-header-logo:hover, .notice-logo:hover, .site-footer-logo:hover { opacity: .85; }
.home-header-logo:focus-visible, .notice-logo:focus-visible, .site-footer-logo:focus-visible { outline: 2px solid var(--home-accent); outline-offset: 4px; border-radius: 6px; }
.home-header .site-nav { margin-left: auto; }
/* Sticky header on every public page (homepage header and the results/policy header). */
.home-header, .notice-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--home-background);
    border-bottom: 1px solid var(--home-toggle);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.home-header .home-theme-toggle, .notice-header .home-theme-toggle { position: relative; top: auto; right: auto; flex-shrink: 0; }

.site-nav { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.site-nav > a, .site-nav summary {
    display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 8px;
    color: var(--home-text); font-size: clamp(13px, 1vw, 15px); text-decoration: none; cursor: pointer; list-style: none;
}
.site-nav summary::-webkit-details-marker { display: none; }
.site-nav summary svg { width: 15px; height: 15px; transition: transform .2s; }
.site-nav-menu[open] summary svg { transform: rotate(180deg); }
.site-nav > a:hover, .site-nav summary:hover, .site-nav-menu[open] summary { color: var(--home-strong); background: var(--home-surface); }
.site-nav > a[aria-current="page"], .site-nav summary.is-current { color: var(--home-accent-bright); }
.site-nav > a:focus-visible, .site-nav summary:focus-visible { outline: 2px solid var(--home-accent); outline-offset: 2px; }
.site-nav-menu { position: relative; }
/* Categories menu: one-column panel, each item has an icon, title and short description. */
.site-nav summary { -webkit-user-select: none; user-select: none; }
.site-nav-panel {
    --panel-caret-right: 168px;
    position: absolute; z-index: 30; top: calc(100% + 12px); right: -150px; width: 400px; max-width: calc(100vw - 32px);
    padding: 8px; background: var(--home-surface); border: 1px solid var(--home-toggle); border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(212, 175, 55, .04);
    white-space: normal; text-align: left;
    transform-origin: top right; animation: site-nav-panel-in .16s ease-out;
}
/* Small pointer towards the Categories button */
.site-nav-panel::before {
    content: ''; position: absolute; top: -7px; right: var(--panel-caret-right); width: 12px; height: 12px;
    background: var(--home-surface); border-left: 1px solid var(--home-toggle); border-top: 1px solid var(--home-toggle);
    transform: rotate(45deg); border-top-left-radius: 3px;
}
@keyframes site-nav-panel-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .site-nav-panel { animation: none; } }
.site-nav-panel-head { padding: 12px 14px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--home-toggle); }
.site-nav-panel-title { margin: 0 0 3px; color: var(--home-accent); font-size: 11px !important; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.site-nav-panel-sub { margin: 0; color: var(--home-muted); font-size: 13px !important; }
.site-nav-panel ul { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 0; padding: 4px 0 0; list-style: none; }
.site-nav-panel li a {
    position: relative; display: flex; align-items: center; gap: 14px; height: 100%; padding: 12px 14px; border-radius: 13px;
    text-decoration: none; transition: background .15s;
}
.site-nav-icon {
    display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px;
    background: rgba(212, 175, 55, .09); border: 1px solid rgba(212, 175, 55, .22); color: var(--home-accent-bright);
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.site-nav-icon svg { width: 21px; height: 21px; }
.site-nav-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.site-nav-text strong { color: var(--home-strong); font-size: 14px; font-weight: 600; line-height: 1.3; transition: color .15s; }
.site-nav-text small { color: var(--home-muted); font-size: 12.5px; line-height: 1.45; }
.site-nav-go { flex: 0 0 16px; width: 16px; height: 16px; color: var(--home-accent-bright); opacity: 0; transform: translateX(-6px); transition: opacity .15s, transform .15s; }
.site-nav-panel li a:hover, .site-nav-panel li a:focus-visible { background: var(--home-background); }
.site-nav-panel li a:hover .site-nav-icon, .site-nav-panel li a:focus-visible .site-nav-icon,
.site-nav-panel li a[aria-current="page"] .site-nav-icon {
    background: linear-gradient(135deg, var(--home-accent-bright), var(--home-accent)); border-color: transparent; color: var(--home-button-text, #0b0b0b);
}
.site-nav-panel li a:hover .site-nav-icon { transform: scale(1.04); }
.site-nav-panel li a:hover strong, .site-nav-panel li a:focus-visible strong, .site-nav-panel li a[aria-current="page"] strong { color: var(--home-accent-bright); }
.site-nav-panel li a:hover .site-nav-go, .site-nav-panel li a:focus-visible .site-nav-go { opacity: 1; transform: none; }
.site-nav-panel li a[aria-current="page"] { background: var(--home-background); box-shadow: inset 0 0 0 1px rgba(212, 175, 55, .35); }
.site-nav-panel li a:focus-visible { outline: 2px solid var(--home-accent); outline-offset: -2px; }

@media (max-width: 640px) {
    .site-nav-panel ul { grid-template-columns: 1fr; }
    .site-nav-go { display: none; }
    .site-nav-panel { max-height: 70vh; overflow-y: auto; }
}

/* ---------- Hero: headline + description ---------- */
.home-headline { margin: 0 auto 10px; color: var(--home-strong); font-size: clamp(20px, 2.3vw, 30px); font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.home-headline span { color: var(--home-accent-bright); }
.home-description { max-width: 620px; margin: 0 auto clamp(26px, 3vw, 40px); color: var(--home-text); font-size: clamp(13px, 1.15vw, 16px); line-height: 1.6; }
.home-links { margin-top: clamp(22px, 2.6vw, 36px); }

/* ---------- Footer (all public pages) ---------- */
.site-footer { padding: 36px clamp(20px, 4.2vw, 64px) 22px; border-top: 1px solid var(--home-toggle); font-size: 14px; }
.site-footer-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding-bottom: 24px; }
.site-footer-logo { display: inline-flex; margin-bottom: 14px; line-height: 0; text-decoration: none; }
.site-footer-logo .brand-logo { height: 42px; }
.site-footer-brand p { max-width: 420px; margin: 0; color: var(--home-text); font-size: 14px !important; line-height: 1.6; }
.site-footer-col { display: flex; flex-direction: column; gap: 9px; }
.site-footer-col h2 { margin: 0 0 4px; color: var(--home-accent); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.site-footer a { color: var(--home-text); text-decoration: none; }
.site-footer-col a:hover { color: var(--home-accent-bright); text-decoration: underline; }
.site-footer-copy { margin: 0; padding-top: 16px; border-top: 1px solid var(--home-toggle); color: var(--home-muted); font-size: 13px !important; }
/* Copyright-only footer: a full-width bar (card colour), no divider lines. */
/* Same colours as the header: page background, thin border line, gold brand name. */
.site-footer--compact { padding: 20px clamp(20px, 4.2vw, 64px); border-top: 1px solid var(--home-toggle); background: var(--home-background); }
.site-footer--compact .site-footer-copy { padding: 0; border-top: 0; color: var(--home-muted); }
.site-footer-brand-name { color: var(--home-accent-bright); font-weight: 700; }
@media (max-width: 700px) {
    .site-footer-main { grid-template-columns: 1fr 1fr; }
    .site-footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .home-header { flex-wrap: wrap; gap: 8px 16px; }
    .home-header .site-nav { order: 3; flex-basis: 100%; margin-left: -12px; overflow-x: auto; }
    .home-header .home-theme-toggle { margin-left: auto; }
    .site-nav-menu { position: static; }
    .site-nav-panel { left: 12px; right: 12px; width: auto; max-width: none; }
}
@media (max-width: 480px) {
    .home-header-logo .brand-logo, .notice-logo .brand-logo { height: 30px; }
    .site-footer-logo .brand-logo { height: 36px; }
}

/* ---------- Search in progress: gold bar along the top + dimmed results ---------- */
.search-loading-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 2000; height: 3px; overflow: hidden;
    background: rgba(212, 175, 55, .18);
}
.search-loading-bar::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
    background: linear-gradient(90deg, transparent, var(--home-accent-bright, #FFD76A), var(--home-accent, #D4AF37), transparent);
    box-shadow: 0 0 10px rgba(255, 215, 106, .7);
    animation: search-loading 1.1s ease-in-out infinite;
}
@keyframes search-loading { from { left: -40%; } to { left: 100%; } }
/* Dim only when re-searching from the results page, not during the first Google fetch. */
body.is-searching:not(.provider-pending) .results-content { opacity: .45; transition: opacity .2s; pointer-events: none; }
body.provider-pending .results-content { opacity: 1; pointer-events: auto; }
body.is-searching .home-search button[type="submit"][aria-busy="true"] { cursor: progress; opacity: .85; }
@media (prefers-reduced-motion: reduce) {
    .search-loading-bar::before { animation-duration: 2.5s; }
}

/* ---------- Minimal homepage (no header): wordmark, search, tagline, links, centred ---------- */
.home-content--minimal { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px 8vh; }
.home-content--minimal .home-wordmark { margin: 0 0 clamp(34px, 4vw, 56px); font-size: clamp(40px, 4.4vw, 68px); }
.home-content--minimal .home-search { width: min(54vw, 900px); }
@media (max-width: 700px) {
    .home-content--minimal .home-search { width: 100%; }
    .home-content--minimal .home-wordmark { font-size: 40px; margin-bottom: 30px; }
    .home-content--minimal .home-links { gap: 40px; }
}
