/**
 * AVX Ticket Counter Hours — Frontend Styles v1.0.2
 *
 * Mobile-first. WCAG 2.1 AA compliant.
 *
 * Contrast verification (all on #ffffff background):
 *   --text       #000000 = 21.0:1   ✓ (AAA)
 *   --text-muted #595959 =  7.0:1   ✓ (AA)
 *   --closed     #9E2B2F =  6.9:1   ✓ (AA)
 *   --toggle-active #001489 bg with #fff text = 16.7:1 ✓ (AAA)
 */

/* ================================================================
   Custom Properties
   ================================================================ */

.avx-tch {
    --avx-tch-bg: #ffffff;
    --avx-tch-text: #000000;
    --avx-tch-text-muted: #595959;
    --avx-tch-border: #d4d4d4;
    --avx-tch-closed-text: #9E2B2F;
    --avx-tch-closed-bg: #fdf2f2;
    --avx-tch-today-border: #001489;
    --avx-tch-today-bg: #f0f3fa;
    --avx-tch-today-badge-bg: #001489;
    --avx-tch-today-badge-text: #ffffff;
    --avx-tch-note-text: #595959;
    --avx-tch-cell-bg-alt: #f3f3f3;
    --avx-tch-toggle-active-bg: #001489;
    --avx-tch-toggle-active-text: #ffffff;
    --avx-tch-toggle-border: #001489;
    --avx-tch-toggle-bg: #ffffff;
    --avx-tch-toggle-text: #001489;
    --avx-tch-font-family: inherit;
    --avx-tch-font-size-base: 1rem;
    --avx-tch-font-size-sm: 0.875rem;
    --avx-tch-font-size-xs: 0.8125rem;
    --avx-tch-spacing: 1rem;
    --avx-tch-radius: 4px;
}

/* ================================================================
   SR-only
   ================================================================ */

.avx-tch-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ================================================================
   Container
   ================================================================ */

.avx-tch {
    font-family: var(--avx-tch-font-family);
    font-size: var(--avx-tch-font-size-base);
    line-height: 1.5;
    color: var(--avx-tch-text);
    max-width: 64rem;
}

.avx-tch-title {
    margin: 0 0 0.15em;
    font-size: 1.375rem;
    line-height: 1.3;
    color: var(--avx-tch-text);
}

.avx-tch-subtitle {
    margin: 0;
    font-size: 1.25rem;
    color: var(--avx-tch-text);
    font-weight: 600;
}

/* Month header — subtitle + nav arrows on same row */
.avx-tch-month-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

/* Month navigation */
.avx-tch-nav {
    display: flex;
    gap: 0.75rem;
}

.avx-tch-nav-link {
    font-size: var(--avx-tch-font-size-sm);
    font-weight: 600;
    color: var(--avx-tch-today-border);
    text-decoration: none;
    transition: opacity 0.12s;
}

.avx-tch-nav-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.avx-tch-nav-link:focus-visible {
    outline: 2px solid var(--avx-tch-today-border);
    outline-offset: 2px;
}

.avx-tch-updated {
    margin: 0.75rem 0 0;
    font-size: var(--avx-tch-font-size-xs);
    color: var(--avx-tch-text-muted);
}

/* ================================================================
   View Toggle
   Hidden by default. Shown by inline JS (progressive enhancement).
   On mobile, always hidden — list view only.
   ================================================================ */

.avx-tch-view-toggle {
    display: none;
    gap: 0;
    margin-bottom: 0.75rem;
}

.avx-tch-view-toggle[data-ready] {
    display: inline-flex;
}

.avx-tch-toggle-btn {
    padding: 0.35em 1em;
    border: 1.5px solid var(--avx-tch-toggle-border);
    background: var(--avx-tch-toggle-bg);
    color: var(--avx-tch-toggle-text);
    font-size: var(--avx-tch-font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    line-height: 1.4;
    font-family: inherit;
    margin: 0;
}

.avx-tch-toggle-btn:first-child {
    border-radius: var(--avx-tch-radius) 0 0 var(--avx-tch-radius);
}

.avx-tch-toggle-btn:last-child {
    border-radius: 0 var(--avx-tch-radius) var(--avx-tch-radius) 0;
    border-left: none;
}

.avx-tch-toggle-btn--active {
    background: var(--avx-tch-toggle-active-bg);
    color: var(--avx-tch-toggle-active-text);
}

.avx-tch-toggle-btn:hover:not(.avx-tch-toggle-btn--active) {
    background: var(--avx-tch-cell-bg-alt);
    color: var(--avx-tch-toggle-text);
}

.avx-tch-toggle-btn:focus-visible {
    outline: 2px solid var(--avx-tch-today-border);
    outline-offset: 2px;
    z-index: 1;
    position: relative;
}

@media (max-width: 599px) {
    .avx-tch-view-toggle { display: none !important; }
}

/* ================================================================
   LIST VIEW
   ================================================================ */

.avx-tch-schedule {
    margin: 0;
    padding: 0;
    list-style: none;
}

.avx-tch-day {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--avx-tch-border);
}

.avx-tch-day:first-child {
    border-top: 1px solid var(--avx-tch-border);
}

.avx-tch-day dt {
    font-weight: 600;
    min-width: 10rem;
    color: var(--avx-tch-text);
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.avx-tch-day dd {
    margin: 0;
    color: var(--avx-tch-text);
}

/* Force all inline elements inside dd to stay inline */
.avx-tch-day dd time,
.avx-tch-day dd span {
    display: inline !important;
}

/* Today highlight */
.avx-tch-day--today {
    background: var(--avx-tch-today-bg);
    border-left: 3px solid var(--avx-tch-today-border);
    padding-left: calc(var(--avx-tch-spacing) - 3px);
    margin-left: calc(-1 * var(--avx-tch-spacing));
    padding-right: var(--avx-tch-spacing);
    margin-right: calc(-1 * var(--avx-tch-spacing));
}

/* Today badge */
.avx-tch-today-badge {
    display: inline-block;
    padding: 0.05em 0.45em;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.5;
    border-radius: 2px;
    background: var(--avx-tch-today-badge-bg);
    color: var(--avx-tch-today-badge-text);
    vertical-align: middle;
}

/* Closed */
.avx-tch-closed-label {
    color: var(--avx-tch-closed-text);
    font-weight: 600;
}

.avx-tch-separator {
    margin: 0 0.1em;
}

.avx-tch-note {
    font-size: var(--avx-tch-font-size-sm);
    color: var(--avx-tch-note-text);
    font-style: italic;
}

.avx-tch-no-schedule {
    padding: var(--avx-tch-spacing);
    background: var(--avx-tch-cell-bg-alt);
    border: 1px solid var(--avx-tch-border);
    border-radius: var(--avx-tch-radius);
    color: var(--avx-tch-text-muted);
}

/* ---- List: tablet+ ---- */
@media (min-width: 600px) {
    .avx-tch-day { flex-wrap: nowrap; }
    .avx-tch-day dt { flex: 0 0 14rem; }
}

/* ================================================================
   TABLE VIEW (calendar grid)
   ================================================================ */

.avx-tch-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--avx-tch-bg);
}

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

.avx-tch-table th,
.avx-tch-table td {
    padding: 0.4rem 0.5rem;
    text-align: left;
    vertical-align: top;
    border: 1px solid var(--avx-tch-border);
    font-size: var(--avx-tch-font-size-sm);
}

.avx-tch-table thead th {
    background: var(--avx-tch-cell-bg-alt);
    font-weight: 600;
    font-size: var(--avx-tch-font-size-sm);
    letter-spacing: 0.01em;
    color: var(--avx-tch-text-muted);
    text-align: center;
    padding: 0.35rem 0.5rem;
}

/* Base cell — uniform height across all rows */
.avx-tch-cell {
    height: 5.5rem;
    position: relative;
    vertical-align: top;
}

/* Outside-month cells */
.avx-tch-cell--empty {
    background: var(--avx-tch-cell-bg-alt);
}

/* Days WITH service — subtle left accent to make them pop */
.avx-tch-cell--open {
    border-left: 3px solid var(--avx-tch-today-border);
}

/* Today */
.avx-tch-cell--today {
    background: var(--avx-tch-today-bg);
    outline: 2px solid var(--avx-tch-today-border);
    outline-offset: -2px;
}

/* Closed */
.avx-tch-cell--closed {
    background: var(--avx-tch-closed-bg);
    border-left: 3px solid var(--avx-tch-closed-text);
}

/* Date number — compact, top-left */
.avx-tch-date {
    display: block;
    font-weight: 700;
    font-size: var(--avx-tch-font-size-sm);
    line-height: 1.2;
    margin-bottom: 0.2rem;
    color: var(--avx-tch-text);
}

/* "Open" label — sits above the time range */
.avx-tch-open-label {
    display: block;
    font-weight: 600;
    color: var(--avx-tch-today-border);
    font-size: var(--avx-tch-font-size-xs);
    margin-bottom: 0.1rem;
}

/* Hours in calendar cells */
.avx-tch-cell .avx-tch-hours {
    display: block;
    font-size: var(--avx-tch-font-size-sm);
    color: var(--avx-tch-text);
    line-height: 1.3;
}

.avx-tch-cell .avx-tch-hours span {
    display: inline !important;
}

.avx-tch-cell .avx-tch-closed-label {
    color: var(--avx-tch-closed-text);
    font-weight: 600;
    font-size: var(--avx-tch-font-size-sm);
}

.avx-tch-cell .avx-tch-note {
    display: block;
    font-size: var(--avx-tch-font-size-xs);
    margin-top: 0.1rem;
}

.avx-tch-dayname-short { display: none; }
.avx-tch-dayname-full  { display: inline; }

/* ---- Table: mobile collapse ---- */
@media (max-width: 599px) {
    .avx-tch-table, .avx-tch-table thead,
    .avx-tch-table tbody, .avx-tch-table tr,
    .avx-tch-table th, .avx-tch-table td { display: block; }

    .avx-tch-table thead {
        position: absolute; width: 1px; height: 1px;
        margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
    }

    .avx-tch-table tr { display: contents; }

    .avx-tch-cell {
        display: flex; flex-wrap: wrap;
        align-items: baseline; gap: 0.25rem 0.75rem;
        padding: 0.625rem 0; border: none;
        border-bottom: 1px solid var(--avx-tch-border);
        min-height: auto;
    }

    .avx-tch-cell--empty { display: none; }

    .avx-tch-cell::before {
        content: attr(data-label);
        font-size: var(--avx-tch-font-size-xs);
        color: var(--avx-tch-text-muted);
        letter-spacing: 0.02em;
        display: block; width: 100%;
    }

    .avx-tch-date { display: inline; margin-bottom: 0; margin-right: 0.5rem; }
    .avx-tch-cell .avx-tch-hours { display: inline; }
}

/* ---- Table: smaller tablets — abbreviate day names ---- */
@media (min-width: 600px) and (max-width: 767px) {
    .avx-tch-dayname-full  { display: none; }
    .avx-tch-dayname-short { display: inline; }
}

/* ================================================================
   Focus (keyboard nav)
   ================================================================ */

.avx-tch a:focus-visible,
.avx-tch button:focus-visible,
.avx-tch *:focus-visible {
    outline: 2px solid var(--avx-tch-today-border);
    outline-offset: 2px;
}

/* ================================================================
   Reduced motion
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    .avx-tch, .avx-tch * {
        animation: none !important;
        transition: none !important;
    }
}

/* ================================================================
   Windows High Contrast
   ================================================================ */

@media (forced-colors: active) {
    .avx-tch-day--today { border-left-color: Highlight; }
    .avx-tch-cell--today { outline-color: Highlight; }
    .avx-tch-today-badge { forced-color-adjust: none; }
    .avx-tch-toggle-btn--active { forced-color-adjust: none; }
}

/* ================================================================
   Print
   ================================================================ */

@media print {
    .avx-tch { max-width: 100%; color: #000; font-size: 10pt; }
    .avx-tch-today-badge,
    .avx-tch-view-toggle { display: none !important; }
    .avx-tch-day--today { background: none; border-left: 2pt solid #000; }
    .avx-tch-cell--today { outline: 1pt solid #000; }
}
