/* ============================================================================
   Wikipedia Golf - Augusta National Elegance
   A patrician, timeless aesthetic with carefully curated colors and typography.
   ============================================================================ */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@400;500;600&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
    --wg-green-rgb: 30, 77, 43;

    --wg-augusta-green: #1e4d2b;
    --wg-billiard-green: #2d5a3d;

    --wg-paper: #f8f8f6;
    --wg-surface: #ffffff;

    /* Championship yellow — accent (active nav, trim) */
    --wg-championship: #f4c430;

    --wg-primary: var(--wg-augusta-green);
    --wg-primary-hover: var(--wg-billiard-green);

    /* Copy on Augusta green rails (title, Origin/Destination, header links …) */
    --wg-on-field: #ffffff;

    --wg-text: var(--wg-primary);
    --wg-text-muted: var(--wg-primary);

    /* Lines & fills derived from Augusta (no gray chrome) */
    --wg-line-faint: rgba(var(--wg-green-rgb), 0.07);
    --wg-line: rgba(var(--wg-green-rgb), 0.11);
    --wg-line-strong: rgba(var(--wg-green-rgb), 0.2);
    --wg-fill-hover: rgba(var(--wg-green-rgb), 0.055);
    --wg-fill-well: rgba(var(--wg-green-rgb), 0.075);

    /* Elevation tint (greens, not charcoal smog) */
    --wg-shadow-sm: 0 2px 16px rgba(var(--wg-green-rgb), 0.075);
    --wg-shadow-md: 0 4px 28px rgba(var(--wg-green-rgb), 0.1);
    --wg-shadow-dropdown: 0 6px 28px rgba(var(--wg-green-rgb), 0.12);
    /* About / Settings panels — contact + deep green cast */
    --wg-shadow-flyout:
        0 3px 14px rgba(var(--wg-green-rgb), 0.2),
        0 22px 56px rgba(var(--wg-green-rgb), 0.36),
        0 32px 72px rgba(var(--wg-green-rgb), 0.2);

    /* Inner Augusta ring + outer white ring (matches flyouts; stack before elevation shadows) */
    --wg-double-ring:
        0 0 0 2px var(--wg-primary),
        0 0 0 4px var(--wg-on-field);

    /* Semantic shortcuts */
    --wg-bg: var(--wg-primary);
    --wg-border: var(--wg-line);
    --wg-divider: var(--wg-line-faint);

    --wg-error-bg: #fef8f8;
    --wg-error-border: rgba(185, 48, 48, 0.35);
    --wg-error-text: #b12c2c;

    --wg-focus-ring: rgba(var(--wg-green-rgb), 0.38);

    /* Typography — Crimson for editorial/UI; Barlow Semi Condensed for caps */
    --font-display: 'Barlow Semi Condensed', system-ui, sans-serif;
    --font-heading: 'Crimson Text', Georgia, 'Times New Roman', serif;
    --font-body: 'Crimson Text', Georgia, 'Times New Roman', serif;
    /* Revert path/steps + .wg-scorecard-stat-value to this when preferred */
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;
}

/* viewport + Dash root — contiguous Augusta green */
html,
body,
#react-entry-point {
    margin: 0;
    min-height: 100vh;
    background-color: var(--wg-primary);
}

/* ============================================================================
   Animations
   ============================================================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Layout & Container
   ============================================================================ */

.wg-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px;
    background-color: var(--wg-bg);
    min-height: 100vh;
    font-family: var(--font-body);
}

.wg-header {
    text-align: center;
    margin-bottom: 48px;
}

/* ============================================================================
   Typography
   ============================================================================ */

.wg-title {
    font-family: var(--font-display);
    font-size: 31px;
    font-weight: 500;
    color: var(--wg-on-field);
    letter-spacing: 0.14em;
    margin: 0 0 8px 0;
    text-transform: uppercase;
}

.wg-section-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--wg-on-field);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

/* ============================================================================
   Inputs & Search
   ============================================================================ */

.wg-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 16px;
    line-height: 1.5;
    border: 1px solid var(--wg-line);
    border-radius: var(--radius-md);
    background-color: var(--wg-surface);
    color: var(--wg-text);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: var(--font-body);
}

.wg-input:focus {
    border-color: var(--wg-primary);
    box-shadow: 0 0 0 2px var(--wg-focus-ring);
}

.wg-input::placeholder {
    color: var(--wg-primary);
    opacity: 1;
}

.wg-input::-webkit-input-placeholder {
    color: var(--wg-primary);
}

.wg-input::-moz-placeholder {
    color: var(--wg-primary);
    opacity: 1;
}

.wg-search-wrapper {
    position: relative;
    z-index: 100;
}

.wg-search-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    border: none;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--wg-shadow-dropdown);
    z-index: 1000;
    background-color: var(--wg-surface);
}

.wg-search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    background-color: var(--wg-surface);
    border-bottom: 1px solid var(--wg-divider);
    transition: background-color 0.15s ease;
}

.wg-search-result-item:last-child {
    border-bottom: none;
}

.wg-search-result-item:hover {
    background-color: var(--wg-fill-hover);
}

.wg-search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--wg-text);
}

.wg-search-result-desc {
    font-size: 12px;
    color: var(--wg-text-muted);
    margin-top: 2px;
}

.wg-search-container {
    transition: opacity 0.3s ease, transform 0.3s ease, height 0.3s ease, margin 0.3s ease;
}

.wg-search-container.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.wg-button {
    width: 100%;
    padding: 16px 32px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--wg-primary);
    background-color: var(--wg-surface);
    border: 2.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow:
        var(--wg-double-ring),
        var(--wg-shadow-sm);
    transition:
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        opacity 0.2s ease,
        background-color 0.2s ease;
}

.wg-button:hover:not(:disabled) {
    background-color: var(--wg-championship);
    /* Inner Augusta ring unchanged; outer ring matches former white halo → championship */
    box-shadow:
        0 0 0 2px var(--wg-primary),
        0 0 0 4px var(--wg-championship),
        var(--wg-shadow-md);
    border-color: var(--wg-championship);
}

.wg-button:disabled,
.wg-button-disabled {
    background-color: var(--wg-surface);
    color: rgba(var(--wg-green-rgb), 0.42);
    cursor: not-allowed;
    opacity: 0.78;
    box-shadow: var(--wg-double-ring);
}

.wg-button:disabled:hover,
.wg-button-disabled:hover {
    box-shadow: var(--wg-double-ring);
    border-color: transparent;
}

.wg-reset-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-md);
    /* Darker Augusta wash than wg-fill-well (distinct from thumbnail placeholder) */
    background-color: rgba(var(--wg-green-rgb), 0.14);
    color: rgba(var(--wg-green-rgb), 0.92);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.wg-reset-btn:hover {
    background-color: rgba(var(--wg-green-rgb), 0.26);
    color: var(--wg-augusta-green);
}

/* ============================================================================
   Cards & Selected Articles
   ============================================================================ */

.wg-selected-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background-color: var(--wg-surface);
    border: none;
    border-radius: var(--radius-md);
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    box-shadow:
        var(--wg-double-ring),
        var(--wg-shadow-sm);
}

.wg-selected-card:hover {
    box-shadow:
        var(--wg-double-ring),
        var(--wg-shadow-md);
    transform: translateY(-1px);
}

.wg-selected-thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    border: 1px solid var(--wg-line-faint);
}

.wg-selected-thumbnail-placeholder {
    width: 48px;
    height: 48px;
    background-color: var(--wg-fill-well);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--wg-text-muted);
}

.wg-selected-content {
    flex: 1;
    min-width: 0;
}

.wg-selected-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--wg-text);
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.wg-selected-desc {
    font-size: 13px;
    color: var(--wg-text-muted);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   Scorecard - Hero Metric + Stats Row
   ============================================================================ */

.wg-scorecard {
    margin-top: 32px;
    text-align: center;
}

.wg-scorecard-hero {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 16px;
}

.wg-scorecard-hero-number {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 600;
    color: var(--wg-primary);
    line-height: 1;
}

.wg-scorecard-hero-label {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 400;
    color: var(--wg-text);
    line-height: 1;
}

.wg-scorecard-divider {
    width: 100%;
    max-width: 480px;
    height: 1.75px;
    background-color: var(--wg-championship);
    margin: 0 auto 16px auto;
}

.wg-scorecard-stats-row {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.wg-scorecard-stat {
    text-align: center;
    min-width: 80px;
}

.wg-scorecard-stat-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    color: var(--wg-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 4px;
}

.wg-scorecard-stat-value {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: lining-nums proportional-nums;
    color: var(--wg-text);
}

/* ============================================================================
   Loading State — label + pulsating dot
   ============================================================================ */

.wg-loading-container {
    text-align: center;
    padding: 48px 0;
    transition: opacity 0.3s ease;
}

.wg-loading-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-on-field);
    line-height: 1.2;
    margin: 0 0 12px 0;
}

.wg-pulse-dot {
    width: 12px;
    height: 12px;
    background-color: var(--wg-on-field);
    border-radius: 50%;
    margin: 0 auto;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ============================================================================
   Results & Path Display
   ============================================================================ */

.wg-result-container {
    margin-top: 48px;
    padding: 32px;
    background-color: var(--wg-surface);
    border: none;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow:
        var(--wg-double-ring),
        var(--wg-shadow-md);
}

.wg-result-links-hero {
    margin-bottom: 24px;
    text-align: center;
}

.wg-result-links-hero .wg-scorecard-hero {
    margin-bottom: 0;
}

.wg-result-usage {
    margin-top: 24px;
    text-align: center;
}

.wg-path-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wg-path-step,
.wg-path-step-dest {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    color: var(--wg-text);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.wg-path-step:hover,
.wg-path-step-dest:hover {
    color: var(--wg-championship);
    text-decoration: underline;
}

.wg-path-arrow {
    font-size: 14px;
    color: var(--wg-text-muted);
}

.wg-path-stats {
    margin-top: 24px;
    font-size: 13px;
    color: var(--wg-text-muted);
}

.wg-spinner {
    text-align: center;
    padding: 48px 0;
    color: var(--wg-on-field);
    font-size: 14px;
}

.wg-spinner-text {
    color: var(--wg-on-field);
    font-size: 16px;
}

.wg-error {
    margin-top: 8px;
    padding: 10px 12px;
    background-color: var(--wg-error-bg);
    border: 1px solid var(--wg-error-border);
    border-radius: var(--radius-md);
    color: var(--wg-error-text);
    font-size: 13px;
}

/* ============================================================================
   Header utilities — About / Settings (anchored flyouts)
   ============================================================================ */

.wg-header-flyout-anchor {
    position: relative;
    z-index: 2000;
    margin-top: 24px;
    text-align: center;
}

.wg-header-util-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.wg-header-link {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-on-field);
    background: none;
    border: none;
    padding: 4px 2px;
    cursor: pointer;
    transition: color 0.15s ease;
    border-bottom: 1px solid transparent;
    line-height: 1.2;
}

/* Inactive + hover: championship preview; underline never shown */
.wg-header-link:hover:not(.wg-header-link-active) {
    color: var(--wg-championship);
}

.wg-header-link-active,
.wg-header-link-active:hover {
    color: var(--wg-championship);
}

.wg-header-util-sep {
    color: var(--wg-on-field);
    font-size: 14px;
    user-select: none;
    line-height: 1;
}

.wg-flyout-stack {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 8px;
    text-align: left;
    pointer-events: none;
}

.wg-header-flyout-anchor.is-open .wg-flyout-stack {
    pointer-events: auto;
}

.wg-flyout-panel .wg-panel-content {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-sizing: border-box;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    /* Inner Augusta ring, outer white ring (separates panel from field), then depth */
    box-shadow:
        var(--wg-double-ring),
        var(--wg-shadow-flyout);
}

/* Panel content (shared; centered in flyouts via rules above) */
.wg-panel-content {
    width: 420px;
    max-width: 90vw;
    margin: 1rem auto 0;
    padding: 1rem 1.25rem 1.25rem;
    background-color: var(--wg-surface);
    border: none;
    border-radius: var(--radius-md);
    text-align: left;
    color: var(--wg-text);
}

.wg-about-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--wg-text-muted);
    margin: 0 0 1rem 0;
}

.wg-about-links {
    display: block;
}

.wg-about-links .wg-about-link {
    display: block;
    margin-bottom: 0.5rem;
}

.wg-about-links .wg-about-link:last-child {
    margin-bottom: 0;
}

.wg-about-link {
    font-size: 0.9rem;
    color: var(--wg-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.wg-about-link:hover {
    color: var(--wg-championship);
    text-decoration: underline;
}

.wg-settings-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-primary);
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.wg-settings-label:first-of-type {
    margin-top: 0;
}

/* Settings flyout: all text Augusta green (Dash injects neutral text tokens elsewhere). */
#settings-panel.wg-flyout-panel,
#settings-panel .wg-panel-content {
    color: var(--wg-augusta-green) !important;
}

#settings-panel .wg-settings-label {
    color: var(--wg-augusta-green) !important;
}

#settings-panel .dash-radioitems,
#settings-panel .dash-radioitems label {
    color: var(--wg-augusta-green) !important;
    transition: color 0.15s ease;
}

#settings-panel .dash-radioitems label span {
    transition: color 0.15s ease;
}

#settings-panel .dash-radioitems label:hover,
#settings-panel .dash-radioitems label:hover span {
    color: var(--wg-championship) !important;
}

/* Championship yellow on Settings radios (scoped to #settings-panel).
   Native accent-color draws an ugly dark ring between dot and outer ring — custom paint matches panel white. */
#settings-panel input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--wg-line-strong);
    border-radius: 50%;
    background-color: var(--wg-surface);
    cursor: pointer;
    box-sizing: border-box;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

#settings-panel input[type="radio"]:checked {
    border-color: var(--wg-championship);
    background: radial-gradient(
        circle at center,
        var(--wg-championship) 0,
        var(--wg-championship) 28%,
        var(--wg-surface) 29%,
        var(--wg-surface) 100%
    );
}

#settings-panel input[type="radio"]:focus-visible {
    outline: 2px solid var(--wg-championship);
    outline-offset: 2px;
}

/* Fix radio button vertical alignment */
.wg-panel-content input[type="radio"] {
    vertical-align: middle;
    margin-top: 0;
    margin-bottom: 0;
    position: relative;
    top: -1px;
}

.wg-panel-content label {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.slide-in {
    animation: slideIn 0.35s ease forwards;
}

.text-center {
    text-align: center;
}

.mt-sm {
    margin-top: 8px;
}

.mt-md {
    margin-top: 16px;
}

.mt-lg {
    margin-top: 24px;
}

.mt-xl {
    margin-top: 48px;
}

.mb-md {
    margin-bottom: 16px;
}

/* Origin/Destination Section Layout */
.wg-origin-dest-container {
    display: flex;
    gap: 48px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.wg-origin-dest-item {
    flex: 1;
    min-width: 300px;
}

.wg-origin-dest-container > .wg-origin-dest-item:last-child > .wg-section-label {
    text-align: right;
}
