/* =============================================================================
   Boekel Allsky Archive — stylesheet
   Aesthetic: observatory logbook × modern dark UI.
   Type: Fraunces (display serif) + Instrument Sans (body) + JetBrains Mono (data)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,300..700,0..100&family=Instrument+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* palette */
    --bg:          #0a0e16;
    --bg-deep:     #06080e;
    --surface:     #141826;
    --surface-hi:  #1c2236;
    --border:      #2a3148;
    --border-hi:   #3a4260;

    --text:        #e4e7ef;
    --text-muted:  #8890a8;
    --text-dim:    #5a6276;

    --accent:      #f5d48a;  /* warm amber — old star chart ink */
    --accent-hi:   #f2c98a;
    --accent-cool: #6b9dc8;  /* steel blue */

    /* type */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Instrument Sans', -apple-system, system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'SF Mono', Consolas, monospace;

    /* rhythm */
    --radius:  2px;  /* sharp, technical */
    --radius-lg: 4px;

    /* shadows */
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-lift: 0 12px 40px -8px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
}

/* ----- reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    /* subtle star-dust texture using layered radial gradients */
    background-image:
        radial-gradient(1px 1px at 23% 14%, rgba(255,255,255,0.4), transparent 50%),
        radial-gradient(1px 1px at 67% 41%, rgba(255,255,255,0.3), transparent 50%),
        radial-gradient(1px 1px at 89% 78%, rgba(255,255,255,0.35), transparent 50%),
        radial-gradient(1px 1px at 15% 62%, rgba(255,255,255,0.25), transparent 50%),
        radial-gradient(1.5px 1.5px at 44% 88%, rgba(255,255,255,0.3), transparent 50%),
        radial-gradient(1px 1px at 78% 22%, rgba(255,255,255,0.4), transparent 50%),
        radial-gradient(ellipse at 50% 0%, rgba(40,60,100,0.15), transparent 70%);
    background-attachment: fixed;
    background-size: 800px 800px, 700px 700px, 600px 600px, 900px 900px, 750px 750px, 650px 650px, 100% 100%;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ----- layout ----- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) { .container { padding: 0 18px; } }

/* =============================================================================
   Header — always present
   ========================================================================== */
.site-header {
    padding: 48px 0 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}
.site-header .container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 16px;
}
.brand-mark {
    width: 38px;
    height: 38px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transform: translateY(6px);
}
.brand-mark::before,
.brand-mark::after {
    content: '';
    position: absolute;
    background: var(--accent);
}
.brand-mark::before {
    top: 50%; left: 6px; right: 6px; height: 1px;
}
.brand-mark::after {
    left: 50%; top: 6px; bottom: 6px; width: 1px;
}
.brand-mark .dot {
    position: absolute; width: 4px; height: 4px;
    background: var(--accent);
    border-radius: 50%;
    top: 8px; left: 50%; transform: translateX(-50%);
}
.brand-title {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 144, 'SOFT' 30;
    font-weight: 400;
    font-size: 28px;
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1;
}
.brand-title em {
    font-style: italic;
    font-variation-settings: 'opsz' 144, 'SOFT' 60;
    color: var(--accent);
}
.brand-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 6px 0 0;
}
.site-coords {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: right;
    line-height: 1.7;
}
.site-coords strong {
    color: var(--text-muted);
    font-weight: 500;
}

/* =============================================================================
   Index page — hero + calendar
   ========================================================================== */
.hero {
    margin-bottom: 64px;
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 48px;
    align-items: start;
}
@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; gap: 32px; }
}
.hero-intro h1 {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 144, 'SOFT' 50;
    font-weight: 300;
    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
    color: var(--text);
}
.hero-intro h1 em {
    font-style: italic;
    font-variation-settings: 'opsz' 144, 'SOFT' 90;
    color: var(--accent);
}
.hero-intro p {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 52ch;
    margin: 0;
}
.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}
.stat {
    background: var(--surface);
    padding: 20px 22px;
}
.stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin: 0 0 6px;
}
.stat-value {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 144;
    font-weight: 500;
    font-size: 28px;
    margin: 0;
    line-height: 1.1;
    color: var(--text);
}
.stat-value small {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 400;
    margin-left: 4px;
}

/* ----- month section ----- */
.month-section { margin-bottom: 72px; }
.month-header {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.month-title {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 144, 'SOFT' 40;
    font-weight: 300;
    font-size: 34px;
    margin: 0;
    letter-spacing: -0.01em;
}
.month-title em {
    font-style: italic;
    color: var(--accent);
    font-weight: 300;
}
.month-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ----- day grid ----- */
.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.day-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}
.day-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
}
.day-card-thumb {
    aspect-ratio: 16 / 5;  /* keograms are wide panoramic strips */
    background: var(--bg-deep);
    overflow: hidden;
    position: relative;
}
.day-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, opacity 0.3s ease;
}
.day-card:hover .day-card-thumb img {
    transform: scale(1.04);
}
.day-card-thumb.missing {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.day-card-body {
    padding: 16px 18px 18px;
}
.day-card-date {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 144;
    font-weight: 400;
    font-size: 22px;
    letter-spacing: -0.01em;
    margin: 0 0 2px;
}
.day-card-weekday {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin: 0 0 12px;
}
.day-card-meta {
    display: flex;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}
.day-card-meta span::before {
    content: '·';
    margin-right: 12px;
    color: var(--text-dim);
}
.day-card-meta span:first-child::before { content: none; }

/* empty state */
.empty-state {
    padding: 80px 24px;
    text-align: center;
    border: 1px dashed var(--border);
    color: var(--text-muted);
}
.empty-state h2 {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: 28px;
    margin: 0 0 8px;
    color: var(--text);
}

/* =============================================================================
   Day detail page
   ========================================================================== */
.day-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }
.back-link::before { content: '←'; font-size: 14px; }

.day-title {
    font-family: var(--font-display);
    font-variation-settings: 'opsz' 144, 'SOFT' 40;
    font-weight: 300;
    font-size: clamp(40px, 6vw, 68px);
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1;
}
.day-title em {
    font-style: italic;
    font-variation-settings: 'opsz' 144, 'SOFT' 90;
    color: var(--accent);
    font-weight: 300;
}
.day-facts {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: right;
    line-height: 1.8;
}
.day-facts strong {
    color: var(--text-muted);
    font-weight: 500;
}

/* ----- sections ----- */
.section {
    margin-bottom: 64px;
}
.section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-dim);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.artwork {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    overflow: hidden;
}
.artwork img,
.artwork video {
    width: 100%;
    display: block;
}
.artwork.keogram img { aspect-ratio: auto; }
.artwork.missing {
    padding: 40px;
    text-align: center;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* ----- frame grid ----- */
.frame-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.frame-tile {
    aspect-ratio: 1 / 1;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s, transform 0.2s;
}
.frame-tile:hover {
    border-color: var(--accent);
    z-index: 2;
}
.frame-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.frame-tile:hover img { transform: scale(1.06); }
.frame-tile-ts {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 18px 8px 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255,255,255,0.75);
    background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.frame-tile:hover .frame-tile-ts { opacity: 1; }

/* =============================================================================
   Lightbox
   ========================================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 12, 0.96);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    backdrop-filter: blur(8px);
}
.lightbox.open {
    display: flex;
    animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-image-wrap {
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
.lightbox img {
    max-width: 95vw;
    max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(20, 24, 38, 0.8);
    border: 1px solid var(--border);
    color: var(--text);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s, border-color 0.2s;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--surface-hi);
    border-color: var(--accent);
    color: var(--accent);
}
.lightbox-close { top: 24px; right: 24px; }
.lightbox-prev  { left: 24px;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 24px; top: 50%; transform: translateY(-50%); }

.lightbox-caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 8px 16px;
    background: rgba(20, 24, 38, 0.8);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* =============================================================================
   Footer
   ========================================================================== */
.site-footer {
    margin-top: 96px;
    padding: 32px 0 48px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.site-footer .container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.site-footer a:hover { color: var(--accent); }

/* =============================================================================
   Loading / error states
   ========================================================================== */
.loading {
    padding: 80px 0;
    text-align: center;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}
.loading::after {
    content: '';
    display: inline-block;
    width: 3px; height: 3px;
    background: var(--accent);
    border-radius: 50%;
    margin-left: 6px;
    animation: blink 1s infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.error {
    padding: 40px;
    border: 1px solid #6b3030;
    background: rgba(107, 48, 48, 0.1);
    color: #e89090;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* entry animation for cards — staggered via nth-child */
.day-card, .frame-tile {
    animation: rise 0.5s ease backwards;
}
.day-card:nth-child(1)  { animation-delay: 0.02s; }
.day-card:nth-child(2)  { animation-delay: 0.04s; }
.day-card:nth-child(3)  { animation-delay: 0.06s; }
.day-card:nth-child(4)  { animation-delay: 0.08s; }
.day-card:nth-child(5)  { animation-delay: 0.10s; }
.day-card:nth-child(n+6){ animation-delay: 0.12s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
