/* Card System - Grid Layout and Components */

/* Now Page Container */
.now-container {
    width: 100vw;
    max-width: 1200px;
    margin-left: 50%;
    transform: translateX(-50%);
    padding: 0 var(--spacing-xl);
}

/* Grid System */
.now-cards {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 1.5rem;
    grid-auto-rows: 180px;
    margin-top: var(--spacing-xl);
}

/* Base Card Styling */
.card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-large);
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    grid-column: span 2;
    min-height: 0; /* Prevents grid blowout */
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Card Size Variants */
.card--wide {
    grid-column: span 3;
}
.card--extra-wide {
    grid-column: span 7;
}

.card--tall {
    grid-row: span 3;
}

.card--large {
    grid-column: span 2;
    grid-row: span 2;
}

/* Placeholder Card Styling */
.card--placeholder {
    opacity: 0.7;
}

.card--placeholder .card__body {
    color: var(--color-text-secondary);
    font-style: italic;
}

/* Card Header */
.card__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.card__title {
    font-size: var(--font-size-small);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.card__icon {
    font-size: 1rem;
    opacity: 0.8;
}

/* Card Body */
.card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Prevents flex item from overflowing */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.card__content {
    font-size: var(--font-size-regular);
    line-height: 1.6;
    color: var(--color-text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.card__content--large {
    font-size: var(--font-size-lg);
    font-weight: 500;
}

/* Card Lists */
.card__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card__list-item {
    font-size: var(--font-size-base);
    line-height: 1.5;
    padding-left: 1.25rem;
    position: relative;
}

.card__list-item::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-text-secondary);
}

/* Card Footer */
.card__footer {
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border-light);
}

/* Card Links */
.card__link {
    color: var(--color-text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.card__link:hover {
    color: var(--color-text-hover);
    text-decoration: underline;
}

/* Specific Card Accent Borders */
.card--weather {
    border: 2px solid var(--color-border);
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    overflow: hidden;
    background-image: url("/static/images/weather-cloud.svg");
    background-repeat: no-repeat;
    background-position: 12px 56px;
    background-size: 70% auto;
    background-blend-mode: multiply;
}

[data-theme="light"] .card--weather {
    background-color: #ffffff;
    background-blend-mode: normal;
}

.card--clock {
    border-top: 3px;
}

.card--music {
    border-top: 3px;
}

.card--writing {
    border-top: 3px;
    grid-row: span 2;
}

.card--work {
    border-top: 3px;
}

.card--reading {
    border-top: 3px;
}

.card--goals {
    border-top: 3px;
}

.card--contact {
    border-top: 3px;
}

/* Clock Display Styling */
.clock-display {
    font-size: 2.0rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: var(--color-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
}

/* Weather Display */
.weather-card__header {
    margin-bottom: 0.5rem;
}

.weather-card__title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.weather-card__body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1;
}

.weather-card__current {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    margin-top: 3.25rem;
}

.weather-card__current-day {
    font-size: 1rem;
    font-weight: 400;
    text-transform: capitalize;
}

.weather-card__current-temp {
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.weather-card__forecast {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: auto;
    max-width: 140px;
}

.weather-card__forecast-day {
    display: flex;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 600;
}

.weather-card__forecast-label {
    text-transform: capitalize;
}

.weather-card__forecast-temp {
    font-size: 1.05rem;
}

.weather-card__status {
    font-size: 0.85rem;
    margin-top: auto;
}

.weather-card__status--error {
    color: #a13d2d;
}

.weather-card__status--hidden {
    display: none;
}

/* Contact Links */
.contact-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Loading State */
.card--loading .card__body {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

/* Last Updated */
.now-last-updated {
    margin-top: 2rem;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
}

/* Responsive Breakpoints */

/* Large Tablets and Small Desktops (768px - 1199px) */
@media (max-width: 1199px) {
    .now-container {
        width: 100vw;
        padding: 0 var(--spacing-lg);
    }
    
    .now-cards {
        grid-template-columns: repeat(6, 1fr);
        gap: 1.25rem;
        grid-auto-rows: 160px;
    }
    
    /* Adjust card spans for 6-column grid */
    .card {
        grid-column: span 2;
    }
    
    .card--wide {
        grid-column: span 3;
    }
    
    .card--extra-wide {
        grid-column: span 6;
    }
    
    .card--large {
        grid-column: span 3;
        grid-row: span 2;
    }
    
    /* Optimize weather card for tablets */
    .card--weather {
        background-size: 65% auto;
        background-position: 10px 50px;
    }
    
    .weather-card__current {
        margin-top: 2.75rem;
    }
    
    .weather-card__current-temp {
        font-size: 2.6rem;
    }
}

/* Tablets (481px - 767px) */
@media (max-width: 767px) {
    .now-container {
        width: 100vw;
        padding: 0 var(--spacing-md);
    }
    
    .now-cards {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        grid-auto-rows: 150px;
    }
    
    /* Adjust card spans for 4-column grid */
    .card {
        grid-column: span 2;
        padding: 1rem;
    }
    
    .card--wide,
    .card--large {
        grid-column: span 2;
    }
    
    .card--extra-wide {
        grid-column: span 4;
    }
    
    /* Make tall cards less tall on tablets */
    .card--tall {
        grid-row: span 2;
    }
    
    .card--large {
        grid-row: span 2;
    }
    
    /* Improve touch targets */
    .card__link {
        padding: 0.25rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .clock-display {
        font-size: 1.85rem;
    }
    
    .weather-card__current {
        margin-top: 2rem;
    }

    .weather-card__current-temp {
        font-size: 2.2rem;
    }
    
    .card--weather {
        background-size: 60% auto;
        background-position: 8px 45px;
    }
}

/* Mobile Landscape and Small Tablets (481px - 600px) */
@media (max-width: 600px) {
    .now-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
        grid-auto-rows: 140px;
    }
    
    .card {
        grid-column: span 1;
        padding: 0.875rem;
    }
    
    .card--wide,
    .card--extra-wide {
        grid-column: span 2;
    }
    
    .card--tall,
    .card--large {
        grid-row: span 2;
        grid-column: span 1;
    }
    
    .clock-display {
        font-size: 1.65rem;
    }
    
    .weather-card__current-temp {
        font-size: 2rem;
    }
    
    .weather-card__forecast {
        max-width: 120px;
    }
    
    .weather-card__forecast-day {
        font-size: 0.95rem;
    }
}

/* Mobile Portrait (< 481px) */
@media (max-width: 480px) {
    .now-container {
        width: 100vw;
        margin-left: 50%;
        transform: translateX(-50%);
        padding: 0 var(--spacing-md);
    }
    
    .now-cards {
        grid-template-columns: 1fr;
        gap: 0.875rem;
        grid-auto-rows: auto;
    }
    
    /* Reset all card spans on mobile portrait */
    .card,
    .card--wide,
    .card--extra-wide,
    .card--tall,
    .card--large {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    .card {
        padding: 1.125rem;
        min-height: 140px;
    }
    
    .card__header {
        margin-bottom: 0.75rem;
    }
    
    .card__body {
        gap: 0.625rem;
    }
    
    /* Ensure proper touch targets on mobile */
    .card__link {
        padding: 0.375rem 0;
        min-height: 48px;
    }
    
    .card__list-item {
        padding: 0.25rem 0 0.25rem 1.25rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .clock-display {
        font-size: 1.75rem;
    }
    
    .weather-card__current {
        margin-top: 1.5rem;
        gap: 0.125rem;
    }

    .weather-card__current-temp {
        font-size: 2.5rem;
    }

    .weather-card__forecast {
        max-width: 100%;
        gap: 0.5rem;
    }
    
    .weather-card__forecast-day {
        font-size: 1rem;
    }
    
    .card--weather {
        background-size: 75% auto;
        background-position: center 40px;
    }
}

/* Very Small Mobile Devices (< 375px) */
@media (max-width: 374px) {
    .now-container {
        padding: 0 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .clock-display {
        font-size: 1.5rem;
    }
    
    .weather-card__current-temp {
        font-size: 2.25rem;
    }
    
    .card__title {
        font-size: 0.7rem;
    }
    
    .card__content {
        font-size: 0.9rem;
    }
}

/* Reduced Motion Preference (Accessibility) */
@media (prefers-reduced-motion: reduce) {
    .card {
        transition: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .card__link {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .now-cards {
        display: block;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
    }
    
    .card:hover {
        transform: none;
        box-shadow: none;
    }
}
