/* Moon Phase Calendar — art direction per PRD §6: PlanetScale, inverted.
   High contrast, minimal black/white palette, visible borders, zero
   border-radius anywhere. Self-contained: no Bootstrap/jQuery dependency —
   the main site's light/rounded look is a different, deliberate choice for
   a different section; this one needs the opposite. */

:root {
    --bg: #1c1d21;          /* page background — dark grey, distinct from the calendar */
    --surface: #000000;     /* calendar / card background — pure black */
    --fg: #ffffff;          /* primary text */
    --muted: #cfd2d8;       /* secondary text — kept bright per feedback #5 */
    --dim: #9aa0a8;         /* decorative-only text, never a border or a status line */
    --line: #6d7178;        /* default border — kept bright per feedback #5/#6 */
    --line-strong: #aeb3bb; /* emphasized border */
    --accent: #e8c877;      /* gold accent — links, today highlight */
    --accent-dim: #6b5a33;
    --moon-dark: #2c2d33;
    --moon-light: #f2ede0;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button, input, select, a, div, td, th, table, section, nav, header, footer, li {
    border-radius: 0;
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 14px; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
    position: absolute; top: 0; left: -9999px; z-index: 100;
    background: var(--fg); color: var(--bg); padding: 8px 14px; font-weight: 700;
}
.skip:focus { left: 0; }

/* Cross-site tab switcher — PRD §5.1a */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs a {
    display: block; padding: 9px 16px; font-size: 13px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
    border-right: 1px solid var(--line);
}
.tabs a[aria-current="page"] { background: var(--fg); color: var(--bg); }
.tabs a:hover:not([aria-current]) { color: var(--fg); }

/* Top bar — non-sticky, per PRD §5.1 */
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.brand { font-size: clamp(15px, 2.4vw, 19px); font-weight: 800; letter-spacing: -.02em; }
.brand span { color: var(--muted); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn {
    display: inline-block; min-height: 40px; padding: 8px 14px;
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    background: transparent; color: var(--fg); border: 1px solid var(--line-strong);
}
.btn:hover { border-color: var(--fg); color: var(--accent); }
.btn-accent { border-color: var(--accent-dim); color: var(--accent); }
.btn[aria-pressed="true"], .btn.is-selected { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Language switcher — one row of buttons, no dropdown */
.topbar-sep { width: 1px; align-self: stretch; background: var(--line); }
.lang-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-buttons a[aria-current="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Month/year nav — PRD §5.1. Year select, the 12-month row, and prev/next
   arrows all share one line on desktop. */
.month-nav { padding: 14px 0; }
.month-nav .nav-line { display: flex; align-items: center; gap: 10px; }
.nav-arrow {
    flex: 0 0 auto; min-width: 40px; padding: 8px 0; text-align: center;
    font-size: 16px; line-height: 1;
}
.nav-arrow[aria-disabled="true"] { color: #4a4d54; border-color: #333438; pointer-events: none; }
select.ctl {
    appearance: none; -webkit-appearance: none;
    background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23cfd2d8'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--fg); border: 1px solid var(--line-strong); font: inherit; font-size: 14px;
    padding: 9px 32px 9px 12px; min-height: 40px;
}
.month-nav .nav-line select.ctl { flex: 0 0 auto; width: auto; }
.month-row { flex: 1; display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.month-row a, .month-row span {
    text-align: center; padding: 8px 2px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--line); color: var(--muted);
}
.month-row a:hover { border-color: var(--fg); color: var(--fg); }
.month-row a[aria-current="page"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.month-row span[aria-disabled="true"] { color: #4a4d54; border-color: #333438; }

.mobile-nav { display: none; gap: 8px; align-items: center; }
.mobile-nav select { flex: 1; }
.mobile-nav .nav-arrow { min-width: 34px; }

@media (max-width: 720px) {
    .month-row { display: none; }
    .month-nav .nav-line > select.ctl { display: none; }
    .month-nav .nav-line > .nav-arrow { display: none; }
    .mobile-nav { display: flex; }
    /* PRD §5.2: the full month must fit above the fold on common mobile
       viewports, so chrome above the grid is compacted here rather than
       left at desktop spacing. */
    .topbar { padding: 8px 0; gap: 8px; }
    .topbar-right { gap: 6px; }
    .topbar { padding: 6px 0; }
    .topbar .btn { min-height: 32px; padding: 5px 9px; font-size: 12px; }
    h1 { margin: 4px 0; line-height: 1.15; }
    .month-nav { padding: 4px 0; }
    .mobile-nav select.ctl { min-height: 32px; padding: 5px 24px 5px 9px; font-size: 13px; }
    .mobile-nav .nav-arrow { min-height: 32px; padding: 5px 0; }
}

/* Calendar grid — PRD §5.2 */
.calendar { background: var(--surface); border: 1px solid var(--line-strong); }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.grid > .dow {
    text-align: center; padding: 8px 2px; font-size: 12px; font-weight: 700;
    color: var(--muted); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
}
.grid > .dow:last-child { border-right: none; }

/* Cell is a photo card: the moon image fills it edge to edge, day number
   and phase name are overlaid on top rather than taking their own rows --
   the moon dominates the cell instead of sharing it with chrome. */
.cell {
    position: relative; overflow: hidden; aspect-ratio: 1 / 1;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.grid > .cell:nth-child(7n) { border-right: none; }
.cell.is-outside { opacity: .3; display: flex; align-items: flex-start; justify-content: flex-end; padding: 6px; }
.cell.is-today { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 1; }

.cell .moon { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.cell .daynum {
    position: absolute; top: 6px; right: 8px; z-index: 2;
    font-size: 14px; font-weight: 700; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.85), 0 0 6px rgba(0,0,0,.6);
}
.cell.is-outside .daynum { position: static; color: var(--dim); text-shadow: none; }

.cell .label {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 14px 4px 6px; text-align: center; font-size: 12px; font-weight: 600;
    color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.85);
    background: linear-gradient(to top, rgba(0,0,0,.8), rgba(0,0,0,0));
}

@media (max-width: 480px) {
    .cell .daynum { top: 3px; right: 5px; font-size: 11px; }
    .cell .label { font-size: 9px; padding: 10px 2px 4px; }
    .grid > .dow { padding: 4px 2px; font-size: 10px; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 30px; padding: 22px 0; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 0; margin-bottom: 12px; }
.site-footer nav a {
    padding: 4px 14px; font-size: 13px; color: var(--muted);
    border-right: 1px solid var(--line);
}
.site-footer nav a:last-child { border-right: none; }
.site-footer .lang-row { margin-bottom: 12px; }
.site-footer .lang-row a, .site-footer .lang-row span {
    padding: 3px 10px; font-size: 11px; letter-spacing: .03em;
    border-right: 1px solid var(--line);
}
.site-footer .lang-row a:last-child, .site-footer .lang-row span:last-child { border-right: none; }
.site-footer .lang-row span[aria-current="true"] { color: var(--fg); font-weight: 700; }
.site-footer p { text-align: center; font-size: 12px; color: var(--dim); margin: 0; }
.site-footer .footer-blurb {
    max-width: 640px; margin: 0 auto 18px; font-size: 13px; line-height: 1.6; color: var(--muted);
}

.about-copy { max-width: 720px; margin: 24px auto; color: var(--muted); }
.about-copy h1 { color: var(--fg); }
.about-copy dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.about-copy dt { color: var(--fg); font-weight: 600; }
.about-copy dd { margin: 0; }

h1, h2 { color: var(--fg); font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(20px, 3vw, 28px); }
