/* Shared breadcrumb + icon + title + actions page header.
   Rendered by page-header-helpers.php's render_page_header(). */

/* No width/max-width/margin of its own — every page calling
   render_page_header() does so inside <main class="content">, which
   already provides the cap/centering/padding (see .content in
   shared.css); this just fills that box. intro.php is the one page that
   calls this before .content opens, so it needs its own fix there
   instead of a second padding layer added here. */
.page-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.ph-block {
    flex: 1;
    min-width: 0;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.ph-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: var(--slate);
    margin-bottom: 12px;
}
.ph-breadcrumb a {
    color: var(--slate);
    text-decoration: none;
}
.ph-breadcrumb a:hover {
    color: var(--navy);
    text-decoration: underline;
}
.ph-breadcrumb svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #cbd5e1;
}
.ph-breadcrumb span[aria-current] {
    color: var(--navy);
    font-weight: 600;
}
.ph-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.ph-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
/* .ph-title doesn't grow inside .ph-row by default, which the search
   bar's flex:1/max-width below needs to grow into — scoped to the
   search variant only.
   Also doubles as the search bar's "zone": a solid navy-mid band, not a
   tint, matching the "this band matters" language the app already uses
   for CTA bands/card headers. */
.ph-title-search {
    flex: 1;
    min-width: 0;
    background: var(--navy-mid);
    padding: 26px 24px;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(21, 48, 76, 0.28);
    /* Stacks greeting → kicker → input → chips as a centered column
       instead of .ph-title's left-aligned row above. Centered rather
       than left-hugging since the panel spans the full header width
       regardless. */
    display: flex;
    flex-direction: column;
    align-items: center;
    /* No flat gap — these aren't four equally-related lines, they're a
       header followed by one tight input module. Each element below
       carries its own margin instead. */
    gap: 0;
}
/* Dark mode gets a richer two-tone gradient + a soft gold glow from the
   bottom, painted as background layers on this element itself rather
   than a ::before — .ph-search-dropdown is an absolutely-positioned
   child that needs to float free of this box, and a real pseudo-element
   here would need overflow:hidden that would clip it too. */
:root[data-theme="dark"] .ph-title-search {
    background:
        radial-gradient(ellipse 90% 60% at 50% 130%, rgba(240, 180, 41, 0.18) 0%, transparent 70%),
        linear-gradient(180deg, #24466b 0%, #1c3552 100%);
}
/* "Welcome back, {name}" — the one thing on this panel only true for
   the logged-in user. Sits in the breadcrumb's slot rather than beneath
   it — on the one page that sets search_greeting_name (home.php), the
   breadcrumb was just a redundant "Home" label. The done/total stat is
   optional and only renders when both are set. */
.ph-header-greeting {
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
}
.ph-header-greeting-stat {
    font-size: 13px;
    font-weight: 500;
    color: var(--slate);
    margin-left: 6px;
}
/* Small gold eyebrow above the input, turning the search box into a
   little hero of its own and giving screen-reader-visible users a
   plain-language cue. Gold rather than navy-mid since the panel itself
   is now navy-mid. */
.ph-search-kicker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-glow);
    margin: 0 0 8px;
}
/* Always-visible shortcuts, same data as the on-focus dropdown's default
   state, so the search area isn't empty until someone clicks in. Wraps
   rather than scrolls since there are at most 4 (one per track). */
.ph-search-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
/* Literal colors, not tokens — this chip sits inside .ph-title-search's
   fixed navy-mid panel (unaffected by theme), so its text/border can't
   track tokens that flip in dark mode. Dark mode gets its own pill
   design below instead. */
.ph-search-chip {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e4e4e7;
    color: #15304c;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ph-search-chip:hover {
    border-color: var(--gold-glow);
    color: #24466b;
}
/* Dark mode: a translucent glass pill instead of solid white, so it
   reads as part of the dark panel; brightens to a gold fill on hover. */
:root[data-theme="dark"] .ph-search-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e8edf3;
}
:root[data-theme="dark"] .ph-search-chip:hover {
    background: var(--gold-glow);
    border-color: var(--gold-glow);
    color: #1c1508;
}
.ph-title h1 {
    margin: 0;
    font-size: 24px;
    color: var(--navy);
}
.ph-title p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--slate);
}
/* Visually-hidden-but-accessible pattern, used when search_placeholder
   replaces the visible h1/p with a search input, so there's still a
   real heading for screen readers. */
.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;
}
/* The app's tier-1 action on pages that use it (home.php today): solid
   white against the navy-mid panel, a gold-tinted border instead of the
   generic hairline, a soft shadow to lift it off the panel, bigger
   padding/radius than a standard input. Shadow is black-based, not
   navy-tinted — a navy shadow would disappear on the panel's own fill. */
.ph-search {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 714px;
    padding: 15px 20px;
    border: 2px solid rgba(240, 180, 41, 0.35);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ph-search:focus-within {
    border-color: var(--gold-glow);
    box-shadow: 0 0 0 4px rgba(240, 180, 41, 0.28), 0 10px 24px rgba(0, 0, 0, 0.28);
}
.ph-search svg {
    width: 19px;
    height: 19px;
    color: var(--navy-mid);
    flex-shrink: 0;
}
.ph-search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}
.ph-search input {
    border: none;
    background: none;
    padding: 0;
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    color: #1e293b;
    position: relative;
    z-index: 1; /* above the fake overlay so typing/clicking always reaches the real input */
}
.ph-search input:focus { outline: none; }
/* Dark mode: a recessed dark-glass well instead of the light-mode solid
   white card, so it doesn't read as a leftover punched into a dark page. */
:root[data-theme="dark"] .ph-search {
    background: var(--card-bg);
    border-color: rgba(240, 180, 41, 0.4);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
:root[data-theme="dark"] .ph-search:focus-within {
    box-shadow: 0 0 0 4px rgba(240, 180, 41, 0.22), 0 10px 24px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .ph-search svg { color: var(--gold-glow); }
:root[data-theme="dark"] .ph-search input { color: #e8edf3; }
/* Decorative "type it out, then turn green word-by-word" overlay (see
   search_phrases in page-header-helpers.php). Purely visual; the real
   input underneath receives focus/typing. */
.ph-search-fake {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 0.3em; /* flex collapses whitespace-only text nodes between children, so gap replaces the space a plain text node would render */
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.ph-search-fake .word {
    display: inline-block;
    transition: color 0.25s ease;
}
.ph-search-fake .word.green {
    color: #16a34a;
}
.ph-search-fake.ph-search-fake-hidden {
    opacity: 0;
}
:root[data-theme="dark"] .ph-search-fake { color: #7c8898; }
:root[data-theme="dark"] .ph-search-fake .word.green { color: var(--success-green); }
.ph-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    /* White surface + accent border, not a solid color fill, matching
       every other "this is a distinct thing" marker on the page
       (.ph-search-chip, focus-item's accent border) instead of reading
       as generic template chrome. Still picks up each hub's own color
       via --hub-accent, as a border/icon tint now instead of a fill. */
    background: var(--card-bg);
    border: 1.5px solid var(--hub-accent, var(--navy));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ph-icon svg {
    width: 18px;
    height: 18px;
    color: var(--hub-accent, var(--navy));
}
.ph-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 6px;
}
.ph-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    color: var(--navy);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s ease;
}
.ph-btn:hover {
    border-color: var(--border-hover);
}
.ph-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
/* Lets a 'form' action's wrapping <form> sit inside .ph-actions' flex
   row without becoming its own flex item, which would push the button
   onto its own line. */
.ph-btn-form {
    display: contents;
}
/* 'static' action: same slot as a real .ph-btn but a plain <span> for a
   state with nothing left to click (e.g. "Marked Complete"). Dimmed, no
   hover feedback. */
.ph-btn-static {
    cursor: default;
    color: var(--slate);
    background: var(--bg);
}

@media (max-width: 640px) {
    .ph-title p { display: none; }
    .ph-btn-hide-mobile { display: none; }
    .ph-title-search { padding: 18px 14px; border-radius: 14px; }
    .ph-search { padding: 12px 16px; }
    .ph-header-greeting-stat { display: block; margin: 2px 0 0; }
}

/* Shared "blue wrap" for a tool's main card: a thick navy-mid border
   instead of the plain 1px card border, overflow hidden so a flush
   header band's corners clip to match. Apply alongside .card or
   .form-card. If that card has a .tool-hero-header/.form-card-header as
   its first child, it's auto-recolored to sit flush against the edge. */
.tool-form-wrap {
    border: 4px solid var(--navy-mid);
    border-radius: 14px;
}
.tool-form-wrap .tool-hero-header,
.tool-form-wrap .form-card-header {
    background: var(--navy-mid);
    border-radius: 0;
    margin-bottom: 0;
}

/* Smart search dropdown (search_default_links / search_endpoint) */
.ph-search-wrap {
    position: relative;
    /* width:100% (capped by max-width) claims the full column width
       .ph-title-search's centered layout would otherwise leave shrunk
       to content size. */
    width: 100%;
    max-width: 714px;
    margin-bottom: 14px; /* space before the chips row, kept as margin so it collapses correctly on pages with no chips */
}
.ph-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.18);
    max-height: 380px;
    overflow-y: auto;
    z-index: 50;
    padding: 6px;
}
.ph-search-group-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted-text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 10px 4px;
}
.ph-search-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--ink);
    cursor: pointer;
}
.ph-search-option:hover,
.ph-search-option.ph-search-option-active {
    background: var(--surface-muted);
}
.ph-search-option-disabled {
    color: var(--muted-text-2);
    cursor: default;
}
.ph-search-option-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ph-search-option-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.ph-search-option-text {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ph-search-option-cat {
    font-size: 11.5px;
    color: var(--muted-text-2);
}
.ph-search-boost-tag {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--success-green-text);
    background: var(--success-green-light);
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}
.ph-search-soon-tag {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted-text-2);
    background: var(--surface-muted);
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}
.ph-search-empty {
    padding: 16px 10px;
    font-size: 13px;
    color: var(--muted-text-2);
    text-align: center;
}
.ph-search-empty a {
    color: var(--navy);
    font-weight: 600;
}
