:root {
    --bg-color: #f4f3ef;
    /* Off-white paper */
    --ink: #1a1a1a;
    --accent: #bd93f9;
    /* Acid Purple */
    --accent-hover: #ff79c6;
    /* Hot Pink */
    /* Toned down borders and shadows as requested */
    --border-thick: 1.5px solid var(--ink);
    --border-thin: 1px solid var(--ink);
    --shadow-hard: 3px 3px 0px 0px var(--ink);
    --shadow-hover: 1px 1px 0px 0px var(--ink);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--ink);
    font-family: 'Space Grotesk', sans-serif;
    padding: 2rem;
    min-height: 100vh;
}

/* --- Header Section --- */
.marquee-container {
    border-top: var(--border-thick);
    border-bottom: var(--border-thick);
    background: var(--ink);
    color: var(--bg-color);
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 2rem;
    display: flex;
    /* Enable flex for seamless scrolling */
}

.marquee-content {
    display: flex;
    width: max-content;
    /* Critical for dynamic width */
    animation: scroll 30s linear infinite;
}

.marquee-text {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    text-transform: uppercase;
    padding: 0.5rem 0;
    /* Vertical padding only */
    white-space: nowrap;
    flex-shrink: 0;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
        /* Scroll exactly half to loop seamlessly */
    }
}

.header-layout {
    display: grid;
    /* Match calendar grid columns for perfect alignment */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    align-items: stretch;
}

.header-left {
    grid-column: span 2;
    /* Reverted to 2 spans */
}



.header-title {
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 0.9;
    text-transform: uppercase;
    letter-spacing: -0.05em;
}

.subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    margin-top: 1rem;
    border-bottom: var(--border-thick);
    display: inline-block;
    padding-bottom: 0.5rem;
}

/* Quran/Hadith Section */
.reminders-box {
    grid-column: span 2;
    /* Default span */
    grid-column-end: -1;
    /* Push to the right edge */
    border: var(--border-thick);
    padding: 1.5rem;
    background: white;
    box-shadow: var(--shadow-hard);
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* height: fit-content; */
    min-height: 300px;
    overflow: hidden;
    /* Clip slide animations */
}

/* Medium Screens (e.g. Tablets) */
@media (max-width: 1300px) and (min-width: 900px) {
    .header-left {
        grid-column: span 2;
        /* 2 spans on medium screens as requested */
    }

    .reminders-box {
        grid-column: span 2;
        grid-column-end: -1;
    }
}

/* Small Screens / Stack - adjusted breakpoint to 900px */
@media (max-width: 900px) {

    .header-left,
    .reminders-box {
        grid-column: 1 / -1;
    }
}

.reminder-content-wrapper {
    opacity: 1;
    transform: translateY(0);
}

.reminder-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    background: var(--ink);
    color: white;
    display: inline-block;
    padding: 0.2rem 0.5rem;
    align-self: flex-start;
}

.reminder-text {
    font-family: 'Space Grotesk', serif;
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    min-height: 3.5em;
    /* Prevent jumpiness */
}

.reminder-source {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: #555;
    text-align: right;
    display: block;
    font-style: italic;
}

.reminder-divider {
    height: 1px;
    background: var(--ink);
    margin: 1.5rem 0;
    opacity: 0.2;
}

/* --- The Grid --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* --- Day Card --- */
.day-card {
    background: white;
    border: var(--border-thick);
    box-shadow: var(--shadow-hard);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    display: flex;
    flex-direction: column;
}

.day-card:hover {
    transform: translate(1px, 1px);
    box-shadow: var(--shadow-hover);
}

/* Special styling for "Active/Today" */
.day-card.active {
    background: var(--accent);
}

.day-card.active .label,
.day-card.active .time-value {
    border-color: var(--ink);
}

/* Completed State */
.day-card.completed {
    opacity: 0.6;
    background: #e6e6e6;
    border-color: #999;
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: var(--border-thin);
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
}

.ramadan-day {
    background: var(--ink);
    color: white;
    padding: 0.1rem 0.4rem;
}

/* Card Body */
.card-body {
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.time-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.time-value {
    font-family: 'Space Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.ampm {
    font-size: 0.6em;
    font-weight: 400;
    text-transform: uppercase;
}

/* Responsive Utilities */
@media (max-width: 800px) {
    .header-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .header-title {
        font-size: 3.5rem;
    }

    body {
        padding: 1rem;
    }
}

/* --- Debug Controls --- */
.debug-controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--ink);
    color: var(--bg-color);
    padding: 1rem;
    border: 2px solid var(--accent);
    box-shadow: var(--shadow-hard);
    z-index: 1000;
    font-family: 'Space Mono', monospace;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debug-controls label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
}

.debug-controls input {
    background: var(--bg-color);
    border: none;
    padding: 0.5rem;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    cursor: pointer;
}

/* --- Countdown Section --- */
.countdown-container {
    margin-top: 2.5rem;
    padding: 2rem;
    border: var(--border-thick);
    background: var(--ink);
    color: var(--bg-color);
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 8px 8px 0px 0px var(--accent);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
    z-index: 100;
}

/* Reminder Animations */
@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.slide-in {
    animation: slideUpIn 0.5s forwards;
}

.slide-out {
    animation: slideUpOut 0.5s forwards;
}

/* Fullscreen Mode State */
.countdown-container.fullscreen-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border: none;
    border-radius: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.countdown-container:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0px 0px var(--accent-hover);
}

/* Disable hover effect in fullscreen */
.countdown-container.fullscreen-active:hover {
    transform: none;
    box-shadow: none;
}

.fullscreen-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    opacity: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.timer-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    z-index: 1;
    transition: all 0.5s ease;
}

/* Scale label in fullscreen */
.countdown-container.fullscreen-active .timer-label {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    letter-spacing: 4px;
}

.timer-value {
    font-family: 'Space Mono', monospace;
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -5px;
    color: white;
    z-index: 1;
    transition: all 0.5s ease;
}

/* Scale timer in fullscreen */
.countdown-container.fullscreen-active .timer-value {
    font-size: clamp(6rem, 20vw, 15rem);
    letter-spacing: -10px;
    text-shadow: 8px 8px 0px rgba(0, 0, 0, 0.4);
}

/* Response for smaller screens */
@media (max-width: 800px) {
    .countdown-container {
        padding: 1.5rem;
        margin-top: 1.5rem;
        width: 100%;
    }

    /* Adjust fullscreen font sizes for mobile */
    .countdown-container.fullscreen-active .timer-value {
        font-size: 18vw;
        letter-spacing: -5px;
    }

    .timer-value {
        font-size: 3.5rem;
        letter-spacing: -2px;
    }
}