/*
 * Mobile-first: base rules target small screens; @media widens up.
 *
 * This file only holds styling Ionic has no utility class or component
 * for (https://ionicframework.com/docs/layout/css-utilities) - layout
 * spacing, alignment, and responsive columns use Ionic's own classes/
 * components directly in the templates instead (ion-padding,
 * ion-text-center, ion-grid/ion-row/ion-col, ion-button, etc.), and
 * colors use Ionic's theming CSS variables
 * (https://ionicframework.com/docs/theming) rather than hardcoded
 * values, so everything follows the light/dark palette
 * vendor/ionic/dark.class.css defines for .ion-palette-dark (toggled by
 * js/theme.js). Page-wide background/text color needs no rule here at
 * all: ionic.bundle.css already sets those on <body> from the same
 * variables.
 */

.visually-hidden {
    /* No Ionic utility for this - it's a screen-reader-only visually
     hidden pattern, not a layout/spacing concern. */
    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 {
    /* Off-screen until focused (Tab from page load lands here first),
     then pinned to the top so keyboard/screen-reader users can see
     where they are before jumping to #main-content. No Ionic
     utility/component covers this WCAG 2.4.1 "bypass blocks" pattern. */
    position: absolute;
    top: -3rem;
    left: 0;
    z-index: 1000;
    padding: 0.6rem 1rem;
    background: var(--ion-color-primary, #3880ff);
    color: var(--ion-color-primary-contrast, #fff);
    transition: top 0.15s ease-in-out;
}

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

.landing__hero {
    /* text-align:center is ion-text-center in the template; this vertical
     rhythm is deliberately larger than Ionic's fixed --ion-padding, so
     there's no exact utility for it. */
    padding: 1.5rem 1rem;
}

.landing__hero h1 {
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.landing__hero p {
    margin-bottom: 1.25rem;
}

.landing__features h2 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.landing__features article {
    /* ion-row's default align-items:stretch already makes every ion-col
     in a row match the tallest one's height - height:100% carries that
     down from the ion-col onto the visible bordered box, and the
     flex/justify-content centers title+body inside it, so cards with
     less text don't look short/empty next to a longer one. */
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--ion-color-light-shade, #d7d8da);
}

.landing__footer {
    /* padding/text-align are ion-padding/ion-text-center in the template.
     A muted tone comes from Ionic's own step color scale rather than
     opacity, so it stays a real, themed color in both palettes instead
     of a translucency hack. */
    font-size: 0.85rem;
    color: var(--ion-color-medium, #92949c);
}

@media (min-width: 48rem) {
    .landing__hero h1 {
        font-size: 2.5rem;
    }
}

.options-demo__select {
    /* Plain <select> (see templates/options_demo.html's doc comment on why
     - it needs a native change event and value binding, not an Ionic
     one): browsers inherit `color` onto form controls from the page (so
     it already followed --ion-text-color into dark mode on its own) but
     never inherit `background-color` (so it kept its light UA default) -
     white text on a white background in dark mode without this. */
    background: var(--ion-background-color, #fff);
    color: var(--ion-text-color, #000);
    border: 1px solid var(--ion-color-light-shade, #d7d8da);
    border-radius: 0.25rem;
    padding: 0.3rem 0.4rem;
}

.autocomplete {
    /* Positions .autocomplete__popup relative to the box, not the page -
     no Ionic utility covers a popup listbox. */
    position: relative;
}

.autocomplete__label {
    /* Mirrors Ionic's own ion-label[position=stacked] look (small, muted,
     above the field) - not using ion-item/ion-label here since nothing
     else in the box is an Ionic element either; see the template's own
     doc comment for why. */
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: var(--ion-color-medium, #92949c);
}

.autocomplete__box {
    /* The "search box" chips render inside, before the input - a plain
     flexbox that wraps (and so grows vertically) as chips are added,
     with the input itself just becoming the last wrapped item. No Ionic
     utility/component covers a resizing, chip-filled text field. */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem;
    border: 1px solid var(--ion-color-light-shade, #d7d8da);
    border-radius: 0.5rem;
    background: var(--ion-background-color, #fff);
}

.autocomplete__box:focus-within {
    border-color: var(--ion-color-primary, #3880ff);
}

.autocomplete__chips {
    /* No box/margin of its own - see templates/autocomplete.html's doc
     comment: display:contents promotes the chip buttons into
     .autocomplete__box's own flex layout, alongside the input, while
     still leaving this element itself patchable independently of it. */
    display: contents;
}

.autocomplete__input {
    /* Grows to fill the rest of its line, wrapping to a new one once
     there's no room left; min-width keeps it from shrinking to nothing
     once several chips are already on the same line. */
    flex: 1 1 8rem;
    min-width: 8rem;
    border: 0;
    outline: none;
    padding: 0.3rem 0.2rem;
    background: transparent;
    color: inherit;
    font: inherit;
}

.autocomplete__popup {
    /* Shown only while the input has focus (or focus is moving within the
     component, e.g. to an option/chip) - a plain CSS rule rather than a
     Datastar signal, since "is the popup open" is pure client UI state
     with no backend involvement (see js/theme.js's own note on that
     distinction, and static/js/autocomplete.js). */
    display: none;
    position: absolute;
    z-index: 10;
    inset-inline: 0;
    top: 100%;
    max-height: 16rem;
    overflow-y: auto;
    border: 1px solid var(--ion-color-light-shade, #d7d8da);
    border-radius: 0.5rem;
    background: var(--ion-background-color, #fff);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
}

.autocomplete:focus-within .autocomplete__popup {
    display: block;
}

.autocomplete__results {
    /* Plain <ul>, not ion-list: see templates/autocomplete.html's doc
     comment - Stencil elements inserted via Datastar's SSE patches never
     finish hydrating, staying permanently hidden. */
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.autocomplete__option {
    padding: 0.6rem 1rem;
    cursor: pointer;
}

.autocomplete__option--empty {
    cursor: default;
    color: var(--ion-color-medium, #92949c);
}

.autocomplete__option--highlighted,
.autocomplete__option:hover {
    background: var(--ion-color-light, #f4f5f8);
}

.autocomplete__chip {
    /* Plain <button>, not ion-chip - see templates/autocomplete.html's doc
     comment. Rounded pill shape mirrors ion-chip's own look, using
     Ionic's theming variables so it still follows the light/dark
     palette. */
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: var(--ion-color-light, #f4f5f8);
    color: var(--ion-color-dark, #222);
    font-size: 0.85rem;
    cursor: pointer;
}

.media-demo__preview {
    margin-top: 1rem;
}

.media-demo__photo {
    /* No Ionic utility sizes a plain <img> - this fragment is plain HTML
     rather than ion-img, see templates/media_demo.html's doc comment. */
    max-width: 12rem;
    border-radius: 0.5rem;
}

.media-demo__error {
    color: var(--ion-color-danger, #eb445a);
}

/*
 * No .auth-* rules here (deliberately): templates/auth.html uses real
 * ion-grid/ion-item/ion-input/ion-text throughout, so layout, dark-mode
 * background/text color, and inline validation styling all come from
 * Ionic's own components/theming variables - see its own doc comment
 * for the history (this file used to carry custom CSS working around a
 * plain <input>/<label> pairing that doesn't apply anymore).
 */
