/* Castricum Live - modern stylesheet */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1e293b;
    --text-soft: #64748b;
    --accent: #0ea5e9;
    --accent-dark: #0284c7;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.06);
    --good: #16a34a;
    --radius: 14px;
}

html.dark {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #e2e8f0;
    --text-soft: #94a3b8;
    --accent: #38bdf8;
    --accent-dark: #0ea5e9;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    --good: #4ade80;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.75rem; margin-right: auto; }

.brand-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
}

.site-header h1 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.site-header .accent { color: var(--accent); }

.tagline {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-soft);
}

.wind-badge {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}

.wind-badge.wind-good {
    background: color-mix(in srgb, var(--good) 18%, var(--surface));
    border-color: var(--good);
    color: var(--good);
}

.wind-badge .wind-dir { font-size: 1.2rem; }
.wind-badge .wind-updated { font-size: 0.7rem; font-weight: 400; color: var(--text-soft); }

.icon-button {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1rem;
    cursor: pointer;
}

/* ---------- Floating card canvas ---------- */

.canvas {
    position: relative;
    max-width: 2800px;
    margin: 0 auto;
    padding: 0;
    min-height: 100px;
}

/* Desktop: floating absolute cards */
.canvas.floating .card {
    position: absolute;
}

/* Touch / small screens: simple stacked column */
@media (hover: none), (max-width: 960px) {
    .canvas { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.75rem; }
    .canvas .card { position: static !important; width: auto !important; }
    .drag-handle, .resize-handle { display: none; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-body {
    padding: 0.5rem;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}


/* ---------- Drag handle (top strip): move a card ---------- */

.drag-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 16px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: grab;
    touch-action: none;
}

.drag-handle::before {
    content: "⋮ ⋮";
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    padding: 0 6px;
    border-radius: 0 0 6px 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.card:hover > .drag-handle::before,
.drag-handle:hover::before { opacity: 0.9; }

/* ---------- Resize handle (bottom-right corner) ---------- */

.resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    z-index: 3;
    cursor: nwse-resize;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    background: transparent;
    touch-action: none;
}

.resize-handle::before {
    content: "◂◢";
    font-size: 8px;
    letter-spacing: -1px;
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-radius: 6px 0 0 0;
    padding: 0 2px 0 3px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.card:hover > .resize-handle::before,
.resize-handle:hover::before { opacity: 0.9; }

/* ---------- Modules ---------- */

.module {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: calc(var(--radius) - 6px);
    background: var(--bg);
    flex: 1 1 auto;
    min-height: 160px;
}

.module-square { aspect-ratio: 1 / 1; }
.module-tall   { aspect-ratio: 3 / 4; }
.module-rws    { aspect-ratio: auto; height: 625px; }

img.module { object-fit: contain; }


/* ---------- Drag & resize feedback ---------- */

.card.dragging {
    cursor: grabbing;
    opacity: 0.85;
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.card.resizing {
    outline: 2px dashed var(--good);
    outline-offset: -4px;
}

/* ---------- Footer ---------- */

.site-footer {
    max-width: 2800px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    color: var(--text-soft);
    font-size: 0.85rem;
}

.site-footer p { margin: 0.5em 0; }
.site-footer .about { max-width: 70ch; }

.visitors {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.75rem;
    color: var(--text-soft);
}

/* ---------- Widgets ---------- */

#windmeter-allmeteo-name,
.allmeteo-nodata,
.runway,
.allmeteo-runway-line { display: none !important; }

svg { max-width: 100%; }
