/* ============================================
   COOKHAM.INFO - Main Stylesheet
   Thames valley inspired: misty blues, willow greens, warm stone
   ============================================ */

:root {
    /* Color Palette */
    --color-ink: #1a1f2e;
    --color-ink-light: #4a5568;
    --color-ink-muted: #718096;
    --color-paper: #faf9f7;
    --color-paper-warm: #f5f3ef;
    --color-stone: #e8e4dc;
    --color-willow: #4a6741;
    --color-willow-light: #6b8c5f;
    --color-thames: #3d5a6c;
    --color-thames-light: #5a7d8a;
    --color-amber: #c4850c;
    --color-amber-light: #f0b429;
    --color-rose: #9b2c2c;
    
    /* Status colors */
    --status-good: var(--color-willow);
    --status-moderate: var(--color-amber);
    --status-severe: var(--color-rose);
    
    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;
    
    /* Layout */
    --max-width: 1200px;
    --border-radius: 8px;
}

/* ===== RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-paper);
    color: var(--color-ink);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--color-thames);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* ===== HEADER ===== */
.site-header {
    background: var(--color-ink);
    color: var(--color-paper);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
}

.site-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.site-title .dot {
    width: 8px;
    height: 8px;
    background: var(--color-willow-light);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-meta {
    font-size: 0.8rem;
    color: var(--color-ink-muted);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-meta time {
    color: var(--color-paper);
    opacity: 0.7;
}

/* ===== STATUS STRIP ===== */
.status-strip {
    background: linear-gradient(135deg, var(--color-thames) 0%, var(--color-thames-light) 100%);
    color: white;
    padding: var(--space-lg) 0;
}

.status-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.status-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.status-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.status-content {
    flex: 1;
}

.status-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
    margin-bottom: var(--space-xs);
}

.status-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.status-value.good { color: #9ae6b4; }
.status-value.moderate { color: #fbd38d; }
.status-value.severe { color: #feb2b2; }

.status-detail {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: var(--space-xs);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-lg);
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    padding: var(--space-lg);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-ink);
}

.card-badge {
    font-size: 0.7rem;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.card-badge.live {
    background: #c6f6d5;
    color: #22543d;
}

.card-badge.static {
    background: var(--color-stone);
    color: var(--color-ink-light);
}

/* Card sizes */
.card--full { grid-column: span 12; }
.card--half { grid-column: span 6; }
.card--third { grid-column: span 4; }
.card--two-thirds { grid-column: span 8; }

.card-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--color-thames);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: var(--space-md);
    transition: gap 0.2s ease;
}

.card-link:hover {
    gap: var(--space-sm);
    text-decoration: none;
}

/* ===== RIVER WIDGET ===== */
.river-widget {
    grid-column: span 8;
}

.river-display {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
}

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

.river-level-value {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-thames);
}

.river-level-unit {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.6;
}

.river-level-label {
    font-size: 0.8rem;
    color: var(--color-ink-muted);
    margin-top: var(--space-xs);
}

.river-status {
    flex: 1;
}

.river-status-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.river-status-text.normal { color: var(--color-willow); }
.river-status-text.elevated { color: var(--color-amber); }
.river-status-text.high { color: var(--color-rose); }

.river-trend {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    color: var(--color-ink-light);
}

.river-trend svg {
    width: 16px;
    height: 16px;
}

.threshold-bar {
    height: 8px;
    background: var(--color-stone);
    border-radius: 4px;
    position: relative;
    margin-top: var(--space-md);
    overflow: visible;
}

.threshold-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--color-willow) 0%, var(--color-amber) 70%, var(--color-rose) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.threshold-marker {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 16px;
    background: var(--color-ink);
    opacity: 0.3;
}

.threshold-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--color-ink-muted);
    margin-top: var(--space-xs);
}

/* ===== TRAFFIC WIDGET ===== */
.traffic-widget {
    grid-column: span 4;
}

.traffic-routes {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.traffic-route {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-stone);
}

.traffic-route:last-child {
    border-bottom: none;
}

.route-name {
    font-size: 0.9rem;
    color: var(--color-ink);
}

.route-time {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
}

.route-time.good { color: var(--color-willow); }
.route-time.slow { color: var(--color-amber); }
.route-time.severe { color: var(--color-rose); }

.route-delay {
    font-size: 0.75rem;
    color: var(--color-ink-muted);
}

.traffic-loading {
    text-align: center;
    padding: var(--space-lg);
    color: var(--color-ink-muted);
}

/* ===== ROADWORKS ===== */
.roadworks-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.roadwork-item {
    padding: var(--space-md);
    background: var(--color-paper-warm);
    border-radius: 6px;
    border-left: 3px solid var(--color-amber);
}

.roadwork-item.active {
    border-left-color: var(--color-rose);
}

.roadwork-location {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.roadwork-dates {
    font-size: 0.8rem;
    color: var(--color-ink-muted);
}

.roadwork-desc {
    font-size: 0.85rem;
    color: var(--color-ink-light);
    margin-top: var(--space-sm);
}

.no-roadworks {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-ink-muted);
}

.no-roadworks-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    color: var(--color-willow);
}

/* ===== PLANNING ===== */
.planning-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.planning-item {
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-stone);
}

.planning-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.planning-ref {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--color-thames);
    margin-bottom: var(--space-xs);
}

.planning-ref a {
    color: inherit;
}

.planning-ref a:hover {
    text-decoration: underline;
}

.planning-address {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.planning-desc {
    font-size: 0.85rem;
    color: var(--color-ink-light);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.planning-meta {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.planning-status {
    display: inline-block;
    font-size: 0.7rem;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.planning-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.planning-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.planning-status.refused {
    background: #fee2e2;
    color: #991b1b;
}

.planning-status.withdrawn {
    background: #e5e7eb;
    color: #6b7280;
}

.planning-expiry {
    font-size: 0.75rem;
    color: var(--color-ink-muted);
}

.loading-placeholder {
    text-align: center;
    padding: var(--space-lg);
    color: var(--color-ink-muted);
}

/* ===== TOOLS SECTION ===== */
.tools-section {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-stone);
}

.section-header {
    margin-bottom: var(--space-lg);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-ink);
}

.section-subtitle {
    color: var(--color-ink-muted);
    margin-top: var(--space-xs);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.tool-card {
    background: white;
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--color-stone);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    border-color: var(--color-thames);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-decoration: none;
}

.tool-icon {
    width: 48px;
    height: 48px;
    background: var(--color-paper-warm);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

.tool-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.tool-desc {
    font-size: 0.9rem;
    color: var(--color-ink-light);
    flex: 1;
}

.tool-source {
    font-size: 0.75rem;
    color: var(--color-ink-muted);
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-stone);
}

/* ===== EMAIL SIGNUP ===== */
.signup-section {
    margin-top: var(--space-2xl);
    background: linear-gradient(135deg, var(--color-ink) 0%, #2d3748 100%);
    border-radius: var(--border-radius);
    padding: var(--space-xl);
    color: white;
    text-align: center;
}

.signup-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.signup-desc {
    opacity: 0.8;
    margin-bottom: var(--space-lg);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.signup-form {
    display: flex;
    gap: var(--space-sm);
    max-width: 400px;
    margin: 0 auto;
}

.signup-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.signup-button {
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-willow);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.signup-button:hover {
    background: var(--color-willow-light);
}

.signup-note {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: var(--space-md);
}

.signup-success {
    color: #9ae6b4;
    font-weight: 600;
    margin-top: var(--space-md);
}

/* ===== FOOTER ===== */
.site-footer {
    background: var(--color-ink);
    color: var(--color-paper);
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-xl);
}

.footer-section h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: var(--space-md);
    color: white;
}

.footer-section li {
    margin-bottom: var(--space-sm);
}

.footer-section a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: white;
    text-decoration: none;
}

.footer-bottom {
    max-width: var(--max-width);
    margin: var(--space-xl) auto 0;
    padding: var(--space-lg) var(--space-lg) 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .card--half, .card--third, .card--two-thirds,
    .river-widget, .traffic-widget {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .river-display {
        flex-direction: column;
        text-align: center;
    }
    
    .signup-form {
        flex-direction: column;
    }
    
    .header-meta {
        display: none;
    }
    
    .status-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .status-inner {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        gap: var(--space-md);
    }
}
