/* ============================================================
   AAARG theme — matches aaargwi.com brand (forest green + gold,
   Playfair Display headings + Source Sans body). Fonts via Google
   Fonts (loaded in baseof.html). Light is the default theme.
   ============================================================ */
:root {
  --color-green: #272e24;
  --color-green-2: #6c7c27;
  --color-gold: #d49a35;
  --color-gold-dark: #b67f25;

  --color-success: #3f7d3f;
  --color-warning: #d4a017;
  --color-error: #b23a3a;

  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", Menlo, monospace;

  --max-width: 64rem;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --radius: 10px;
}

/* Light theme (default) */
:root, [data-theme="light"] {
  --color-text-primary: #1f241c;
  --color-text-secondary: #4f5848;
  --color-text-muted: #717a6a;
  --color-bg-page: #faf9f5;
  --color-bg-elevated: #ffffff;
  --color-bg-card: #ffffff;
  --color-bg-card-hover: rgba(39, 46, 36, 0.03);
  --color-border: #e3e1d8;
  --color-link: var(--color-gold-dark);
  --color-link-hover: var(--color-green-2);
  --color-hero-watermark: 0.05;
  --color-toggle-bg: #ece9df;
  --color-toggle-icon: "🌙";
}

/* Dark theme (toggle) */
[data-theme="dark"] {
  --color-text-primary: #f4f1e9;
  --color-text-secondary: #c9c8bd;
  --color-text-muted: #9a9a8c;
  --color-bg-page: #1b201a;
  --color-bg-elevated: #222a20;
  --color-bg-card: #222a20;
  --color-bg-card-hover: rgba(255, 255, 255, 0.05);
  --color-border: rgba(255, 255, 255, 0.12);
  --color-link: var(--color-gold);
  --color-link-hover: #f4e0bf;
  --color-hero-watermark: 0.08;
  --color-toggle-bg: #333a30;
  --color-toggle-icon: "☀️";
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
html { font-size: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--color-text-primary);
  background: var(--color-bg-page);
  line-height: 1.65;
  transition: background .3s, color .3s;
}

.skip-link {
  position: absolute; top: -100%; left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-gold); color: #fff; z-index: 1000;
  text-decoration: none; border-radius: 0 0 var(--radius) var(--radius);
}
.skip-link:focus { top: 0; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-lg); }

/* ---------- Header (forest green, white logo) ---------- */
.site-header { background: var(--color-green); border-bottom: 3px solid var(--color-gold); padding: var(--space-md) 0; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-md); }
.site-brand { display: flex; align-items: center; gap: var(--space-sm); text-decoration: none; color: #fff; }
.site-brand img { height: 38px; width: auto; }
.site-brand span { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 800; letter-spacing: .02em; color: #fff; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-lg); flex-wrap: wrap; align-items: center; }
.site-nav a { color: #e9e6da; text-decoration: none; font-size: 1rem; font-weight: 600; padding: var(--space-xs) 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.site-nav a:hover, .site-nav a:focus { color: #fff; border-bottom-color: var(--color-gold); }
.theme-toggle { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 20px; padding: 4px 12px; cursor: pointer; font-size: 16px; line-height: 1; }
.theme-toggle::before { content: var(--color-toggle-icon); }

main { min-height: 60vh; padding: var(--space-xl) 0; }

/* ---------- Hero (full-bleed dice backdrop, matches aaargwi.com) ---------- */
.hero { position: relative; text-align: center; overflow: hidden; }
.hero--backdrop {
  /* full-bleed: sit flush under the header (main has vertical padding) */
  margin-top: calc(-1 * var(--space-xl));
  margin-bottom: var(--space-xl);
  padding: clamp(4rem, 14vh, 9rem) var(--space-md);
  /* the dice photo, cover + fixed (parallax) — matches aaargwi.com */
  background: #1b201a url("/images/hero-bg.jpg") center center / cover no-repeat fixed;
}
/* green-tinted overlay — light enough to show the valley scene, dark enough for white text */
.hero--backdrop::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(16, 22, 12, 0.42), rgba(16, 22, 12, 0.66)); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-width: 46rem; margin: 0 auto; }
.hero-logo { max-width: 200px; width: 55%; height: auto; margin-bottom: var(--space-md); }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); color: #fff; margin: 0 0 var(--space-sm); line-height: 1.15; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5); }
.hero .tagline { font-family: var(--font-heading); font-style: italic; font-size: clamp(1.15rem, 2.6vw, 1.5rem); color: var(--color-gold); margin: 0 0 var(--space-lg); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55); }
.hero-cta { display: flex; gap: var(--space-sm); justify-content: center; flex-wrap: wrap; }
/* light-outline CTA that reads on the dark backdrop */
.cta-ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.cta-ghost-light:hover, .cta-ghost-light:focus { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: #fff; }
@media (max-width: 768px) {
  /* fixed backgrounds are janky on mobile — scroll instead (desktop keeps the parallax) */
  .hero--backdrop { background-attachment: scroll; }
}

/* ---------- Buttons / CTAs ---------- */
.cta { display: inline-block; background: var(--color-bg-elevated); color: var(--color-text-primary); border: 1px solid var(--color-border); padding: var(--space-sm) var(--space-lg); border-radius: var(--radius); text-decoration: none; font-weight: 600; transition: all .2s; }
.cta:hover, .cta:focus { border-color: var(--color-gold); color: var(--color-text-primary); }
.cta-primary { background: var(--color-gold); color: #fff; border-color: var(--color-gold); }
.cta-primary:hover, .cta-primary:focus { background: var(--color-gold-dark); border-color: var(--color-gold-dark); color: #fff; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.25; margin: var(--space-lg) 0 var(--space-md); color: var(--color-green); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: var(--color-text-primary); }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; }
p { color: var(--color-text-secondary); }
strong { color: var(--color-text-primary); }
a { color: var(--color-link); text-decoration: none; transition: color .2s; }
a:hover, a:focus { color: var(--color-link-hover); }
:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 2px; }
.page { max-width: 48rem; }
article ul, article ol { color: var(--color-text-secondary); }
article li { margin-bottom: var(--space-xs); }
article iframe { width: 100%; max-width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius); }

/* ---------- Value cards ---------- */
.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-lg); margin: var(--space-lg) 0; }
.value-card { background: var(--color-bg-card); border: 1px solid var(--color-border); border-top: 3px solid var(--color-gold); border-radius: var(--radius); padding: var(--space-lg); }
.value-card h3 { margin-top: 0; color: var(--color-green); }
[data-theme="dark"] .value-card h3 { color: var(--color-gold); }

.post-list { list-style: none; padding: 0; }
.post-list li { padding: var(--space-md) 0; border-bottom: 1px solid var(--color-border); }
.post-meta { color: var(--color-text-muted); font-size: .9rem; }

/* ---------- Footer (green) ---------- */
.site-footer { background: var(--color-green); border-top: 3px solid var(--color-gold); color: #d8d6c8; padding: var(--space-xl) 0 var(--space-lg); margin-top: var(--space-xl); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-lg); }
.footer-heading { font-family: var(--font-heading); color: #fff; font-weight: 700; font-size: 1.1rem; margin: 0 0 var(--space-sm); }
.site-footer p { color: #cfcdbe; }
.site-footer a { color: #e9e6da; }
.site-footer a:hover, .site-footer a:focus { color: var(--color-gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: var(--space-md); font-size: .9rem; color: #b9b7a8; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Mobile nav ---------- */
.nav-toggle-label { display: none; cursor: pointer; padding: var(--space-xs); z-index: 10; }
.hamburger, .hamburger::before, .hamburger::after { display: block; width: 24px; height: 2px; background: #fff; border-radius: 2px; position: relative; transition: transform .3s, opacity .3s; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -7px; } .hamburger::after { top: 7px; }
.nav-toggle:checked ~ .nav-toggle-label .hamburger { background: transparent; }
.nav-toggle:checked ~ .nav-toggle-label .hamburger::before { top: 0; transform: rotate(45deg); }
.nav-toggle:checked ~ .nav-toggle-label .hamburger::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 768px) {
  .nav-toggle-label { display: block; }
  .site-nav { flex-basis: 100%; max-height: 0; overflow: hidden; transition: max-height .3s ease; }
  .nav-toggle:checked ~ .site-nav { max-height: 340px; }
  .site-nav ul { flex-direction: column; gap: 0; padding: var(--space-sm) 0; align-items: flex-start; }
  .site-nav a { display: block; padding: var(--space-sm) 0; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .hero-cta, .nav-toggle-label, .skip-link, .theme-toggle { display: none !important; }
  body { color: #000; background: #fff; }
  p, li { color: #000; }
  a { color: #000; text-decoration: underline; }
  main { padding: 0; }
}

/* ---------- Public room-availability widget ---------- */
.rooms-widget { margin: var(--space-lg) 0; }
.rooms-grid { display: grid; gap: 5px; align-items: stretch; }
.rooms-dayhdr { text-align: center; font-size: .78rem; color: var(--color-text-muted); font-weight: 600; line-height: 1.1; padding-bottom: .2rem; align-self: end; }
.rooms-dayhdr span { display: block; font-family: var(--font-heading); font-size: 1.05rem; color: var(--color-text-primary); }
.rooms-name { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; color: var(--color-green); padding-right: .4rem; }
[data-theme="dark"] .rooms-name { color: var(--color-gold); }
.rooms-dot { width: .7rem; height: .7rem; border-radius: 50%; flex: none; }
.rooms-cell { position: relative; height: 120px; background: rgba(108,124,39,.16); border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; }
.rooms-cell--open { background: rgba(108,124,39,.30); }
.rooms-busy { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(40,46,36,.58), rgba(40,46,36,.58) 5px, rgba(40,46,36,.40) 5px, rgba(40,46,36,.40) 10px); }
.rooms-legend { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; font-size: .85rem; color: var(--color-text-secondary); }
.rooms-sw { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; vertical-align: -2px; margin-right: .3rem; }
.rooms-sw--open { background: rgba(108,124,39,.30); border: 1px solid var(--color-border); }
.rooms-sw--busy { background: rgba(40,46,36,.55); }
.rooms-hours { margin-left: auto; color: var(--color-text-muted); }
.rooms-loading, .rooms-error { color: var(--color-text-muted); }
@media (max-width: 600px) { .rooms-dayhdr { font-size: .62rem; } .rooms-dayhdr span { font-size: .85rem; } .rooms-cell { height: 84px; } .rooms-name { font-size: .8rem; } }

/* ---------- Join / membership form ---------- */
.join-form { max-width: 32rem; margin: var(--space-lg) 0; }
.join-form label { display: block; font-weight: 600; margin: var(--space-md) 0 var(--space-xs); color: var(--color-text-primary); }
.join-form input[type=text], .join-form input[type=email] { width: 100%; font-family: var(--font-body); font-size: 1rem; padding: .6rem .7rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg-elevated); color: var(--color-text-primary); }
.join-form input:focus { outline: none; border-color: var(--color-gold); }
.join-form .join-check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 400; font-size: .92rem; color: var(--color-text-secondary); margin-top: var(--space-md); }
.join-form .join-check input { width: 18px; height: 18px; margin-top: .2rem; flex: none; }
.join-form button { margin-top: var(--space-md); cursor: pointer; }
.join-msg { margin-top: var(--space-md); font-weight: 600; }
.join-msg.ok { color: var(--color-success); }
.join-msg.err { color: var(--color-error); }

/* ---------- Public calendar widget (month grid) ---------- */
.pcal { margin: var(--space-lg) 0; }
.pcal-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.pcal-navwrap { display: flex; gap: .35rem; }
.pcal-nav, .pcal-today { font-family: var(--font-body); font-weight: 600; border: 1px solid var(--color-border); background: var(--color-bg-elevated); color: var(--color-text-primary); border-radius: var(--radius); padding: .35rem .7rem; cursor: pointer; }
.pcal-nav:hover, .pcal-today:hover { border-color: var(--color-gold); }
.pcal-month { font-family: var(--font-heading); font-size: 1.25rem; color: var(--color-green); }
[data-theme="dark"] .pcal-month { color: var(--color-gold); }
.pcal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--color-border); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.pcal-dow { background: var(--color-green); color: #f4f1e9; text-align: center; font-size: .78rem; font-weight: 600; padding: .4rem 0; }
.pcal-cell { background: var(--color-bg-card); min-height: 92px; min-width: 0; padding: .3rem; display: flex; flex-direction: column; gap: .15rem; }
.pcal-cell.other { background: var(--color-bg-page); }
.pcal-cell.other .pcal-day { color: var(--color-text-muted); opacity: .6; }
.pcal-day { font-size: .8rem; color: var(--color-text-muted); align-self: flex-end; line-height: 1.4rem; }
.pcal-cell.today .pcal-day { background: var(--color-gold); color: #fff; border-radius: 50%; width: 1.4rem; height: 1.4rem; text-align: center; font-weight: 700; }
.pcal-ev { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; color: #fff; font-size: .72rem; line-height: 1.25; padding: .12rem .3rem; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-body); }
.pcal-ev:hover { filter: brightness(1.08); }
.pcal-more { font-size: .7rem; color: var(--color-text-muted); padding-left: .2rem; }
.pcal-detail { margin-top: .9rem; padding: .8rem 1rem; border: 1px solid var(--color-border); border-left: 4px solid var(--color-gold); border-radius: var(--radius); background: var(--color-bg-card); }
.pcal-detail .pcal-dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; vertical-align: -1px; margin-right: .4rem; }
.pcal-when { color: var(--color-text-secondary); font-size: .9rem; margin-top: .25rem; }
.pcal-msg { color: var(--color-text-muted); padding: 1.5rem 0; }
@media (max-width: 640px) { .pcal-cell { min-height: 60px; } .pcal-ev { font-size: .6rem; } .pcal-dow { font-size: .62rem; } }

/* public calendar legend */
.pcal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: .7rem; }
.pcal-leg { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--color-text-secondary); }
.pcal-leg i { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }

/* ---------- Calendar loader: rolling dice (controlled conclude) ---------- */
.pcal-loader { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; min-height: 26rem; padding: 1rem 0; }
.pcal-dice { display: flex; gap: 1.2rem; }
.pcal-die { filter: drop-shadow(0 3px 4px rgba(39,46,36,.25)); transform-origin: 50% 50%; animation: pcal-roll 1.15s cubic-bezier(.45,.05,.3,1) infinite; }
.pcal-die.d2 { animation-delay: -.5s; }
.pcal-face { fill: #faf9f5; stroke: var(--color-gold); stroke-width: 3.5; stroke-linejoin: round; }
.pcal-facet { fill: rgba(212,154,53,.14); stroke: var(--color-gold); stroke-width: 2; stroke-linejoin: round; }
.pcal-facetline { fill: none; stroke: var(--color-gold); stroke-width: 1.5; opacity: .5; }
.pcal-num { fill: var(--color-green); font-family: var(--font-heading); font-weight: 800; font-size: 22px; text-anchor: middle; dominant-baseline: central; }
.pcal-loadtxt { font-family: var(--font-heading); font-style: italic; color: var(--color-text-muted); }
@keyframes pcal-roll {
  0%   { transform: translateY(0) rotate(0deg); }
  20%  { transform: translateY(-16px) rotate(115deg); }
  45%  { transform: translateY(0) rotate(240deg); }
  55%  { transform: translateY(-4px) rotate(285deg); }
  70%  { transform: translateY(0) rotate(345deg); }
  100% { transform: translateY(0) rotate(360deg); }
}
/* Conclusion: stop looping, settle the dice flat, and fade the loader out. */
.pcal-loader.settle { opacity: 0; transition: opacity .4s ease .12s; }
.pcal-loader.settle .pcal-die { animation: pcal-settle .46s ease-out forwards; }
.pcal-loader.settle .pcal-die.d2 { animation-delay: .06s; }
@keyframes pcal-settle {
  0%   { transform: translateY(-10px) rotate(18deg); }
  55%  { transform: translateY(0) rotate(0deg); }
  74%  { transform: translateY(-5px) rotate(0deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) { .pcal-die { animation: none; } .pcal-loader.settle .pcal-die { animation: none; } }
