/* ===== Design Tokens ===== */
:root {
  --bg: #faf7ef;
  --bg-2: #fffdfa;
  --text: #222222;
  --muted: #5a5a5a;
  --red: #a50021;
  --gold: #e9d8a6;
  --blue: #0f2a5f;
  --card: #ffffff;
  --ring: rgba(0,0,0,.08);
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f14;
    --bg-2: #0b0c10;
    --text: #e9e9e9;
    --muted: #b6b6b6;
    --card: #12141b;
    --ring: rgba(255,255,255,.08);
    --shadow: 0 10px 30px rgba(0,0,0,.6);
  }
}

/* ===== Base Styles ===== */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, figure { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
  background: 
    radial-gradient(1400px 700px at 85% -5%, color-mix(in oklab, var(--red) 12%, transparent), transparent 60%),
    radial-gradient(1300px 650px at -5% 25%, color-mix(in oklab, var(--blue) 10%, transparent), transparent 55%),
    radial-gradient(1000px 500px at 50% 80%, color-mix(in oklab, var(--gold) 8%, transparent), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.container { width: min(1100px, 92vw); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== Header / Nav ===== */
.skip { position: absolute; left: 0; top: -40px; background: var(--blue); color: #fff; padding: .5rem .75rem; border-radius: 8px; transition: top .2s; z-index: 1000; }
.skip:focus { top: 10px; }
header.site {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.1) blur(10px);
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--ring);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.brand { display: flex; align-items: center; gap: .8rem; font-weight: 700; letter-spacing: .3px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: var(--shadow); }
.nav a { text-decoration: none; color: var(--text); font-weight: 600; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.btn { 
  display: inline-flex; 
  align-items: center; 
  gap: .5rem; 
  padding: .75rem 1.4rem; 
  border-radius: 999px; 
  border: 1px solid var(--ring); 
  background: var(--card); 
  box-shadow: var(--shadow); 
  text-decoration: none; 
  font-weight: 700; 
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.1), transparent);
  opacity: 0;
  transition: opacity .3s ease;
}
.btn:hover::before {
  opacity: 1;
}
.btn:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 12px 32px rgba(0,0,0,.15); 
}
.btn:active {
  transform: translateY(0);
}
.btn.primary { 
  background: linear-gradient(135deg, var(--red), color-mix(in oklab, var(--red) 85%, #000)); 
  color: #fff; 
  border: none; 
  box-shadow: 0 8px 24px color-mix(in oklab, var(--red) 30%, transparent);
}
.btn.primary:hover {
  background: linear-gradient(135deg, color-mix(in oklab, var(--red) 95%, #fff), var(--red));
  box-shadow: 0 12px 32px color-mix(in oklab, var(--red) 40%, transparent);
}
.btn.ghost { 
  background: transparent; 
  border-color: var(--ring); 
}
.btn.ghost:hover {
  background: color-mix(in oklab, var(--card) 50%, transparent);
  border-color: color-mix(in oklab, var(--ring) 60%, var(--blue));
}


/* ===== Hero ===== */
.hero {
  position: relative; overflow: hidden; isolation: isolate; z-index: 1;
  background: linear-gradient(135deg, var(--bg-2) 0%, color-mix(in oklab, var(--bg-2) 95%, var(--gold)) 100%);
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, color-mix(in oklab, var(--red) 15%, transparent) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  animation: float 20s ease-in-out infinite;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, color-mix(in oklab, var(--blue) 12%, transparent) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  animation: float 25s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.1); }
}
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; padding: 6rem 0 5rem; }
.hero h1 { 
  font-size: clamp(2rem, 4vw + 1rem, 4rem); 
  line-height: 1.1; 
  letter-spacing: .2px;
  background: linear-gradient(135deg, var(--text) 0%, color-mix(in oklab, var(--text) 85%, var(--red)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero p { 
  color: var(--muted); 
  font-size: clamp(1rem, .7vw + .8rem, 1.15rem); 
  margin-top: 1rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}
.badge { 
  display: inline-flex; 
  align-items: center; 
  gap: .5rem; 
  padding: .5rem .9rem; 
  border-radius: 999px; 
  background: linear-gradient(135deg, color-mix(in oklab, var(--gold) 40%, #fff 60%), color-mix(in oklab, var(--gold) 30%, #fff 70%)); 
  border: 1px solid color-mix(in oklab, var(--gold) 50%, transparent); 
  font-weight: 700; 
  color: #5b4a1e;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  animation: fadeInUp 0.8s ease-out 0.1s both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; animation: fadeInUp 0.8s ease-out 0.3s both; }
.crest-card { 
  aspect-ratio: 1; 
  border-radius: 24px; 
  background: var(--card); 
  box-shadow: 0 20px 60px rgba(0,0,0,.12), 0 0 0 1px var(--ring); 
  border: 1px solid var(--ring); 
  display: grid; 
  place-items: center; 
  padding: 1.5rem; 
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.8s ease-out 0.4s both;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.crest-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, color-mix(in oklab, var(--gold) 8%, transparent), transparent);
  animation: shimmer 3s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
.crest-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 24px 80px rgba(0,0,0,.16), 0 0 0 1px var(--ring);
}
.crest-card img { 
  width: 70%; 
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.18)); 
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}
.crest-card:hover img {
  transform: scale(1.05);
}

/* ===== Section Styles ===== */
.section { padding: 4rem 0; }
.section h2 { 
  font-size: clamp(1.6rem, 1.2vw + 1rem, 2.2rem); 
  margin-bottom: .7rem; 
  background: linear-gradient(135deg, var(--text), color-mix(in oklab, var(--text) 75%, var(--blue)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}
.section h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  border-radius: 2px;
}
.muted { color: var(--muted); }

.grid { display: grid; gap: 1.2rem; }
.grid.features { grid-template-columns: repeat(12, 1fr); }
.card {
  grid-column: span 6;
  background: var(--card); 
  border: 1px solid var(--ring); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  padding: 1.5rem; 
  position: relative; 
  overflow: hidden;
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .3s ease, border-color .3s ease;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--blue), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.card:hover::before {
  transform: scaleX(1);
}
.card:hover { 
  transform: translateY(-4px); 
  box-shadow: 0 16px 48px rgba(0,0,0,.14); 
  border-color: color-mix(in oklab, var(--ring) 60%, var(--red));
}
.card h3 { 
  font-size: 1.2rem; 
  margin-bottom: .5rem; 
  background: linear-gradient(135deg, var(--text), color-mix(in oklab, var(--text) 80%, var(--blue)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.card p { color: var(--muted); line-height: 1.6; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.chip { 
  font-size: .8rem; 
  padding: .3rem .65rem; 
  border: 1px solid var(--ring); 
  border-radius: 999px; 
  background: color-mix(in oklab, var(--bg) 85%, transparent); 
  transition: all .2s ease;
  font-weight: 500;
}
.chip:hover {
  background: color-mix(in oklab, var(--gold) 20%, var(--bg));
  border-color: color-mix(in oklab, var(--gold) 40%, transparent);
  transform: translateY(-1px);
}
.card a.more { 
  position: absolute; 
  right: 1.2rem; 
  bottom: 1.2rem; 
  text-decoration: none; 
  font-weight: 700; 
  color: var(--red);
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.card a.more:hover {
  gap: .5rem;
  color: color-mix(in oklab, var(--red) 80%, var(--blue));
}
.card a.more::after {
  content: '→';
  transition: transform .2s ease;
}
.card a.more:hover::after {
  transform: translateX(4px);
}
@media (min-width: 820px) {
  .card.games, .card.gallery, .card.cookbook, .card.calendar { grid-column: span 3; }
}

/* ===== Gallery ===== */
.mosaic { 
  display: grid; 
  grid-template-columns: repeat(6, 1fr); 
  gap: .8rem; 
  margin-top: 1rem; 
}
.tile { 
  border-radius: 12px; 
  overflow: hidden; 
  aspect-ratio: 1; 
  background: linear-gradient(135deg, var(--gold), var(--red)); 
  position: relative;
  cursor: pointer;
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.1) 100%);
  opacity: 0;
  transition: opacity .3s ease;
}
.tile:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,.2);
  z-index: 2;
}
.tile:hover::after {
  opacity: 1;
}
.tile.wide { grid-column: span 2; }
.tile.tall { grid-row: span 2; }
.tile img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  transition: transform .5s cubic-bezier(0.4, 0, 0.2, 1);
}
.tile:hover img {
  transform: scale(1.1);
}

/* ===== Timeline ===== */
.timeline { 
  display: grid; 
  gap: 1.5rem; 
  position: relative; 
  padding-left: 1rem;
}
.timeline::before { 
  content: ""; 
  position: absolute; 
  left: .6rem; 
  top: .3rem; 
  bottom: .3rem; 
  width: 2px; 
  background: linear-gradient(180deg, var(--red), var(--blue), var(--gold));
  border-radius: 2px;
}
.moment { 
  padding: 1rem 1rem 1rem 2.5rem; 
  position: relative; 
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--ring);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  transition: all .3s ease;
}
.moment:hover {
  transform: translateX(4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  border-color: color-mix(in oklab, var(--ring) 60%, var(--blue));
}
.moment::before { 
  content: ""; 
  position: absolute; 
  left: .2rem; 
  top: 1.3rem; 
  width: 1rem; 
  height: 1rem; 
  border-radius: 999px; 
  background: linear-gradient(135deg, var(--blue), var(--red)); 
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--blue) 15%, transparent), 0 4px 12px rgba(0,0,0,.2);
  z-index: 1;
  transition: transform .3s ease;
}
.moment:hover::before {
  transform: scale(1.2);
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--blue) 20%, transparent), 0 6px 16px rgba(0,0,0,.3);
}
.moment strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: .4rem;
  color: var(--text);
}

/* Event card styles */
.event-card { display: flex; flex-direction: column; gap: .6rem; padding: .9rem 1rem; background: linear-gradient(180deg, var(--card), color-mix(in oklab, var(--card) 96%, var(--bg-2))); border-radius: 12px; border: 1px solid var(--ring); box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.event-main { display: flex; flex-direction: column; gap: .3rem; }
.event-title { font-size: 1.05rem; }
.event-meta { font-size: .9rem; color: var(--muted); }
.event-desc { margin-top: .4rem; color: var(--muted); }
.event-actions { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; }
.event-actions .btn { padding: .45rem .75rem; font-size: .9rem; }
.event-actions .btn.ghost { background: transparent; border: 1px solid var(--ring); }
.event-actions .btn.primary { background: linear-gradient(180deg, color-mix(in oklab, var(--red) 86%, #fff 14%), var(--red)); color: #fff; }
@media (min-width: 720px) {
  .event-card { flex-direction: row; justify-content: space-between; align-items: center; }
  .event-main { max-width: 72%; }
  .event-actions { margin-top: 0; }
}

/* Event form */
.event-form { margin: 1rem 0 1.5rem 0; display: flex; flex-direction: column; gap: .6rem; }
.event-form .form-row { display: flex; gap: .6rem; }
.event-form input, .event-form textarea { flex: 1 1 auto; padding: .6rem .7rem; border-radius: 8px; border: 1px solid var(--ring); background: color-mix(in oklab, var(--bg-2) 92%, transparent); }
.event-form textarea { resize: vertical; }
.event-form button { align-self: flex-start; }
@media (max-width: 520px) {
  .event-form .form-row { flex-direction: column; }
}

/* ===== Footer ===== */
footer { border-top: 1px solid var(--ring); padding: 2.5rem 0; }
.motto { font-style: italic; color: color-mix(in oklab, var(--blue) 64%, var(--text)); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .tile, .moment, .btn, .badge, .crest-card { 
    transition: none; 
    animation: none;
  }
  .hero::before, .hero::after {
    animation: none;
  }
  .crest-card::before {
    animation: none;
  }
}

/* Recipe image styling */
.recipe-image { 
  margin: 1rem 0; 
  border-radius: 12px; 
  overflow: hidden; 
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  background: var(--bg-2);
}
.recipe-image img { 
  width: 100%; 
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
  transition: transform .3s ease;
}
.recipe-image:hover img {
  transform: scale(1.02);
}

/* Recipe card specific styles */
#recipes-list .card {
  grid-column: span 12;
}
#recipes-list .card h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}
#recipes-list .card h3 {
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
  font-size: 1.15rem;
  color: var(--red);
}
#recipes-list .card h4 {
  margin-top: 0.8rem;
  margin-bottom: 0.3rem;
  font-size: 1rem;
  color: var(--blue);
}
#recipes-list .card .summary {
  font-style: italic;
  color: var(--muted);
  margin: 0.5rem 0;
}
#recipes-list .card ul.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  font-size: 0.9rem;
}
#recipes-list .card ul:not(.meta):not(.comments) {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
#recipes-list .card .step {
  margin: 0.8rem 0;
  padding: 0.8rem;
  background: color-mix(in oklab, var(--bg) 60%, transparent);
  border-radius: 8px;
  border-left: 3px solid var(--gold);
}
#recipes-list .card .comments {
  list-style: none;
  padding: 0;
}
#recipes-list .card .comments li {
  margin: 0.6rem 0;
  padding: 0.6rem;
  background: color-mix(in oklab, var(--bg-2) 80%, transparent);
  border-radius: 6px;
}

@media (min-width: 820px) {
  #recipes-list .card {
    grid-column: span 6;
  }
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 2rem;
  line-height: 0;
  color: #333;
}

@media (max-width: 768px) {
  .hamburger { display: block; }
  .hamburger::before { content: '\2261'; }   /* ☰ */
  .hamburger.active::before { content: '\00D7'; } /* × */

  .nav-links { display: none; flex-direction: column; width: 100%; }
  .nav-links.active { display: flex; }
  
  /* Responsive hero for mobile */
  .hero .container { 
    grid-template-columns: 1fr; 
    padding: 3rem 0 2rem;
    gap: 2rem;
  }
  .crest-card { 
    order: -1;
    max-width: 280px;
    margin: 0 auto;
  }
  
  /* Responsive grid for mobile */
  .grid.features { 
    grid-template-columns: 1fr; 
  }
  .card { 
    grid-column: span 1 !important; 
  }
  
  /* Responsive mosaic for mobile */
  .mosaic {
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
  }
  .tile.wide {
    grid-column: span 1;
  }
  .tile.tall {
    grid-row: span 1;
  }
  
  /* Responsive timeline for mobile */
  .timeline {
    padding-left: .5rem;
  }
  .moment {
    padding: .9rem .9rem .9rem 2rem;
  }
  .moment::before {
    left: .1rem;
    width: .8rem;
    height: .8rem;
  }
}

@media (max-width: 520px) {
  .event-form .form-row { flex-direction: column; }
  
  /* Stack filter controls on mobile */
  .filters { 
    flex-direction: column; 
    gap: 0.75rem;
  }
  .filters > div {
    width: 100%;
  }
  .filters select, .filters input {
    width: 100%;
  }
}

/* Responsive calendar container */
.calendar-container {
  width: 100%;
  max-width: 800px;
  margin: 1.5rem auto 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

@media (max-width: 820px) {
  .calendar-container iframe {
    height: 500px;
  }
}

@media (max-width: 520px) {
  .calendar-container iframe {
    height: 400px;
  }
}

/* Improved album grid responsiveness */
@media (max-width: 768px) {
  .album-grid {
    grid-template-columns: 1fr !important;
  }
}
