:root {
    --color-primary: #C6A36D;
    --color-secondary: #C6A36D;
    --color-bg: #67352D;
    --color-bg-card: #552a23;
    --color-text: #f5ebe0;
    --color-text-muted: #c4a898;
    --transition-speed: 0.5s;
}

.back-mode {
    --color-primary: #9E4A2C;
    --color-secondary: #67352D;
    --color-bg: #C6A36D;
    --color-bg-card: #D2A252;
    --color-text: #3b1c15;
    --color-text-muted: #7a5648;
}

*, *::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%;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Layout ── */

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--color-bg);
    color: var(--color-text);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.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: var(--color-primary);
    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: 800px;
    width: 100%;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 500px;
    height: 200px;
    max-width: 100%;
    border-radius: 12px;
    padding: 2rem 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, background-color var(--transition-speed) 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-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: var(--color-secondary);
    margin-bottom: 0.4rem;
}

.card-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.card-linteum {
    padding: 0;
    overflow: hidden;
    border: none;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

/* ── Footer ── */

.footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid rgba(158, 74, 44, 0.4);
    text-align: center;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: var(--color-text);
}

.footer-link {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.footer-link:hover {
    color: var(--color-primary);
}

.footer-icon {
    margin-right: 0.25rem;
}

.footer-credits {
    font-weight: bold;
    margin-left: 1rem;
}

/* ── 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.";
    }

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    cursor: pointer;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border: 0;
    background: transparent;
    padding: 0;
    border-radius: 50%;
    transform: rotate(0deg);
    will-change: transform;
    /* overshoot bezier: the rotation slightly overshoots 180° then settles back,
       mimicking a real hourglass wobbling into place */
    transition: transform 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 0 transparent);
    will-change: filter;
    transition: filter 0.5s ease;
}

.theme-toggle:hover img {
    filter: drop-shadow(0 0 6px var(--color-primary));
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 4px;
}

/* Flipped state: real hourglass turn */
.theme-toggle.flipped {
    transform: rotate(180deg);
}

/* Sand shimmer: a glow pulse on the image that plays once per toggle */
.theme-toggle.sand-shimmer img {
    animation: sand-glow 0.9s ease-out;
}

@keyframes sand-glow {
    0%   { filter: drop-shadow(0 0 0  rgba(198, 163, 109, 0)); }
    30%  { filter: drop-shadow(0 0 10px rgba(198, 163, 109, 0.8)); }
    60%  { filter: drop-shadow(0 0 14px rgba(158, 74, 44, 0.6)); }
    100% { filter: drop-shadow(0 0 0  rgba(198, 163, 109, 0)); }
}

@media (max-width: 560px) {
    .card {
        width: 100%;
        height: auto;
    }
}

