/* ============================
   Toast — Coffee House, Tywyn
   ============================ */

:root {
  --cream: #FFFFFF;
  --cream-dark: #EFEFEF;
  --espresso: #0A0A0A;
  --coffee: #1A1A1A;
  --coffee-mid: #666666;
  --terracotta: #111111;
  --terracotta-dark: #000000;
  --gold: #B0B0B0;
  --ink: #0A0A0A;
  --paper: #E4E4E4;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Jost", "Segoe UI", system-ui, sans-serif;

  --shadow-soft: 0 20px 50px -20px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 12px 30px -14px rgba(0, 0, 0, 0.28);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 10px;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--espresso);
  margin: 0 0 0.4em;
  line-height: 1.08;
  font-weight: 600;
}

p { margin: 0 0 1em; line-height: 1.65; color: var(--coffee); }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(30px, 6vw, 64px);
}

.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;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: var(--espresso); color: var(--cream);
  padding: 12px 18px; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

/* Grain overlay for texture */
.grain-overlay {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 999;
  opacity: 0.045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 28px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--terracotta);
  color: var(--cream);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
.btn-primary:hover { background: var(--terracotta-dark); transform: translateY(-2px); box-shadow: 0 16px 28px -12px rgba(0, 0, 0, 0.55); }
.btn-small { padding: 10px 20px; font-size: 0.85rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.logo {
  display: flex;
  align-items: center;
}
.logo-img { height: 34px; width: auto; display: block; }

.main-nav { display: flex; gap: 34px; }
.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--coffee);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}
.main-nav a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--terracotta);
  transition: width 0.25s ease;
}
.main-nav a:hover { color: var(--espresso); }
.main-nav a:hover::after { width: 100%; }

.header-actions { display: flex; align-items: center; gap: 18px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer;
  border-radius: 50%;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--espresso); margin: 0 auto;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 28px 24px;
  background: var(--cream);
  border-top: 1px solid rgba(0,0,0,0.08);
}
.mobile-nav a {
  padding: 12px 4px;
  font-size: 1.02rem;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.mobile-nav .btn { margin-top: 14px; width: 100%; }
.mobile-nav.is-open { display: flex; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 82vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-media { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: 50% 45%;
  animation: kenburns 26s ease-in-out infinite alternate;
}
@keyframes kenburns {
  0% { transform: scale(1); }
  100% { transform: scale(1.05) translate(-1%, -1%); }
}
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.2) 45%, rgba(0,0,0,0.62) 100%);
}

.hero-inner {
  position: relative; z-index: 1;
  width: 100%;
  padding-top: 96px;
  padding-bottom: 110px;
}

.hero-copy {
  max-width: 640px;
  padding: 28px 32px;
  margin: -28px -32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(0,0,0,0.38), rgba(0,0,0,0.22));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 14px;
}
.hero .eyebrow { color: rgba(255,255,255,0.8); text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.1rem);
  font-weight: 600;
  margin-bottom: 22px;
  color: #FFFFFF;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
}
.hero h1 span { color: rgba(255,255,255,0.75); font-style: italic; font-weight: 500; }

.hero-lede {
  font-size: 1.12rem;
  max-width: 40ch;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 10px rgba(0,0,0,0.45);
}

.hero-cta { display: flex; gap: 16px; margin: 30px 0 44px; flex-wrap: wrap; }

/* ---------- Section basics ---------- */
section { padding: 100px 0; }
.section-head { max-width: 640px; margin-bottom: 54px; }
.section-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.section-lede { font-size: 1.05rem; }
.section-head.light .eyebrow { color: var(--gold); }
.section-head.light h2 { color: var(--cream); }

/* ---------- About ---------- */
.about { background: var(--paper); }
.about-copy { max-width: 680px; margin: 0 auto 44px; }
.about-art { position: relative; width: 100%; }
.about-photo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 21 / 6;
  object-fit: cover;
  object-position: 50% 60%;
}
.about-copy h2 { font-size: clamp(1.9rem, 3.2vw, 2.5rem); }

/* ---------- Menu ---------- */
.menu-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--paper);
  padding: 6px;
  border-radius: 999px;
  margin-bottom: 40px;
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 12px 24px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--coffee);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}
.tab-btn.is-active { background: var(--espresso); color: var(--cream); }

.menu-list {
  list-style: none;
  margin: 0; padding: 0;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 4px 60px;
}
.menu-list.is-active { display: grid; }
.menu-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.18);
}
.menu-list h4 { font-size: 1.08rem; margin: 0 0 4px; }
.menu-list p { font-size: 0.86rem; margin: 0; color: var(--coffee-mid); }
.menu-list span { font-family: var(--font-display); font-weight: 600; color: var(--terracotta); white-space: nowrap; }

/* ---------- Gallery ---------- */
.gallery { background: var(--paper); }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 190px;
  grid-auto-flow: dense;
  gap: 16px;
}
.gallery-tile {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.4s ease;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  display: block;
}
.gallery-tile svg { width: 100%; height: 100%; }
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; }
.gallery-tile:hover { transform: scale(1.03) rotate(-0.5deg); }
.gallery-tile:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,10,0.92);
  padding: 60px;
}
.lightbox.is-open { display: flex; }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}
.lightbox-close,
.lightbox-nav {
  position: fixed;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.05);
  color: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
  z-index: 201;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.5); }
.lightbox-close svg,
.lightbox-nav svg { width: 20px; height: 20px; }
.lightbox-close { top: 24px; right: 24px; }
.lightbox-nav.prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 24px; top: 50%; transform: translateY(-50%); }
.tile-1 { grid-column: span 2; grid-row: span 2; }
.tile-2 { grid-column: span 1; }
.tile-3 { grid-column: span 1; }
.tile-4 { grid-column: span 1; grid-row: span 2; }
.tile-5 { grid-column: span 2; }
.tile-6 { grid-column: span 1; }
.tile-7 { grid-column: span 1; }
.tile-8 { grid-column: span 4; }

/* ---------- Reviews ---------- */
.reviews { background: var(--espresso); }
.rating-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.rating-stars { width: 100px; height: auto; color: var(--gold); flex-shrink: 0; }
.rating-line span { font-size: 0.95rem; color: rgba(255,255,255,0.75); }
.rating-line strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--cream); }
.reviews-carousel {
  display: flex;
  align-items: center;
  gap: 20px;
}
.reviews-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}
.reviews-track::-webkit-scrollbar { display: none; }
.review-card {
  flex: 0 0 100%;
  scroll-snap-align: center;
  margin: 0 auto;
  max-width: 620px;
  text-align: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
}
.review-card p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.4;
  color: var(--paper);
  margin-bottom: 20px;
}
.review-card cite {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.carousel-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.carousel-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.5); }
.carousel-btn svg { width: 20px; height: 20px; }
.carousel-dots { display: flex; justify-content: center; gap: 10px; margin-top: 30px; }
.carousel-dots .dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.carousel-dots .dot.is-active { background: var(--cream); transform: scale(1.35); }

/* ---------- Visit ---------- */
.visit-shopfront { width: 100%; margin-bottom: 56px; }
.visit-shopfront img {
  width: 100%;
  aspect-ratio: 21 / 6;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}
.visit-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 60px;
  align-items: center;
}
.visit-details { margin: 34px 0; display: flex; flex-direction: column; gap: 22px; }
.visit-item { display: flex; gap: 16px; align-items: flex-start; }
.visit-item svg { width: 26px; height: 26px; color: var(--terracotta); flex-shrink: 0; margin-top: 2px; }
.visit-item div { display: flex; flex-direction: column; }
.visit-item strong { font-family: var(--font-display); font-size: 1.05rem; color: var(--espresso); }
.visit-item span { font-size: 0.9rem; color: var(--coffee-mid); }

.map-frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  aspect-ratio: 4 / 2.6;
  border: 6px solid var(--paper);
}
#map { width: 100%; height: 100%; background: var(--paper); filter: grayscale(1) contrast(1.05); }
.leaflet-container { font-family: var(--font-body); }
.leaflet-container img { max-width: none; }

/* ---------- Footer ---------- */
.site-footer { background: var(--espresso); color: var(--paper); padding-top: 80px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 50px;
  padding-bottom: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}
.footer-brand .logo { margin-bottom: 14px; }
.footer-brand .logo-img { height: 30px; }
.footer-brand p { color: rgba(255,255,255,0.7); font-size: 0.92rem; max-width: 28ch; }
.social-row { display: flex; gap: 12px; margin-top: 18px; }
.social-row a {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.social-row svg { width: 17px; height: 17px; }
.social-row a:hover { background: #FFFFFF; border-color: #FFFFFF; color: #000000; }

.footer-col h5 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}
.footer-col { display: flex; flex-direction: column; gap: 12px; }
.footer-col a { color: rgba(255,255,255,0.78); font-size: 0.92rem; transition: color 0.2s ease; }
.footer-col a:hover { color: var(--cream); }

.footer-bottom { padding-top: 24px; padding-bottom: 24px; }
.footer-bottom p { margin: 0; font-size: 0.8rem; color: rgba(255,255,255,0.5); text-align: center; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--espresso);
  color: var(--cream);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ============================
   Responsive
   ============================ */
@media (max-width: 980px) {
  .visit-grid { grid-template-columns: 1fr; }
  .menu-list { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .mobile-nav { display: none; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; }
  .gallery-grid .gallery-tile { grid-column: span 1 !important; grid-row: span 1 !important; }
  .lightbox { padding: 16px 60px; }
  .lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
  .visit-shopfront img { aspect-ratio: 4 / 3; }
  .about-photo { aspect-ratio: 4 / 3; }
  .footer-grid { grid-template-columns: 1fr; gap: 34px; }
  section { padding: 70px 0; }
  .hero { min-height: 72vh; }
  .hero-inner { padding-top: 50px; padding-bottom: 60px; }
  .hero-media img { object-position: 35% 38%; }
  .hero-copy {
    max-width: calc(100% - 36px);
    padding: 20px 22px;
    margin: -20px 0 -20px -22px;
  }
}

@media (max-width: 560px) {
  .menu-tabs { display: flex; overflow-x: auto; width: 100%; }
  .review-card { padding: 34px 26px; }
  .review-card p { font-size: 1.15rem; }
  .carousel-btn { width: 40px; height: 40px; }
  .carousel-btn svg { width: 16px; height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media img {
    animation: none !important;
  }
  .reveal { transition: none; opacity: 1; transform: none; }
}
