:root {
    /* Day mode (default) — bg=secondary, text=primary */
    --color-primary: #9E4A2C;
    --color-secondary: #C6A36D;
    --color-bg: #C6A36D;
    --color-bg-card: #d9ba88;
    --color-text: #9E4A2C;
    --color-text-muted: #7a4520;
}

.theme-night {
    /* Night mode — primary & secondary swap */
    --color-primary: #C6A36D;
    --color-secondary: #9E4A2C;
    --color-bg: #1c1108;
    --color-bg-card: #271a0e;
    --color-text: #f0e6d3;
    --color-text-muted: #8a7a68;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    height: 100%;
}

/* ── Layout ── */

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1.5rem 2rem;
}

/* ── Hero ── */

.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    color: #9E4A2C;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

h1:focus {
    outline: none;
}

.hero-subtitle {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: var(--color-text-muted);
}

/* ── Cards ── */

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    max-width: 1100px;
    width: 100%;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(500px, 100%);
    height: 200px;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid var(--color-primary);
    background-color: var(--color-bg-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: var(--color-text);
}

.card-active {
    cursor: pointer;
}

.card-active:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(158, 74, 44, 0.5);
    border-color: var(--color-secondary);
}

.card-active:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 4px;
}

.card-inactive {
    opacity: 0.5;
    cursor: default;
    border-style: dashed;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #9E4A2C;
    margin-bottom: 0.4rem;
}

.card-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.card-image-only {
    padding: 0;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* ── Footer ── */

.footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid rgba(158, 74, 44, 0.4);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--color-secondary);
}

.footer-icon {
    margin-right: 0.25rem;
}

/* ── Blazor error UI ── */

#blazor-error-ui {
    background: rgba(158, 74, 44, 0.9);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--color-primary);
    padding: 1rem;
    color: white;
    border-radius: 4px;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* ── Hourglass theme toggle ── */

.hourglass-btn {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background-color: var(--color-bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 200;
    padding: 0;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.hourglass-btn:hover {
    border-color: var(--color-secondary);
    box-shadow: 0 0 18px rgba(198, 163, 109, 0.45);
}

.hourglass-btn:disabled {
    cursor: default;
}

.hourglass-svg {
    transform-origin: center center;
    display: block;
}

@keyframes hourglass-flip {
    0%   { transform: rotate(0deg); }
    40%  { transform: rotate(100deg); animation-timing-function: ease-in; }
    70%  { transform: rotate(165deg); animation-timing-function: ease-out; }
    85%  { transform: rotate(175deg); }
    100% { transform: rotate(180deg); }
}

.hourglass-flipping {
    animation: hourglass-flip 0.8s ease-in-out forwards;
}
