/*
 * Stylesheet for the Strathmore Arms website
 *
 * The design favours a warm, welcoming palette reminiscent of a country pub.
 * Colours are defined as CSS variables at the root for easy tweaking. A
 * combination of serif fonts for headings and sans‑serif for body text
 * improves readability while maintaining a traditional feel.
 */

/* CSS reset and global variables */
:root {
  --primary-color: #4a3f35;     /* dark brown reminiscent of timber beams */
  --secondary-color: #8c3a11;   /* warm russet accent reminiscent of ale */
  --background-color: #f4f1ea;  /* soft parchment background */
  --text-color: #333333;        /* dark grey for comfortable contrast */
  --accent-color: #b58f5a;      /* muted gold for highlights */
  --header-height: 70px;
  --font-family-heading: Georgia, "Times New Roman", serif;
  --font-family-body: Arial, Helvetica, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-body);
  color: var(--text-color);
  background-color: var(--background-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation bar */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--primary-color);
  height: var(--header-height);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo a {
  color: #ffffff;
  font-family: var(--font-family-heading);
  font-size: 1.4rem;
  text-decoration: none;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.2rem;
}

nav ul li a {
  color: #ffffff;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

nav ul li a:hover {
  color: var(--accent-color);
}

/* Hero section */
.hero {
  position: relative;
  height: 65vh;
  background-image: url('images/exterior.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.hero-overlay {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #ffffff;
  padding: 0 1rem;
}

.hero-overlay h1 {
  font-family: var(--font-family-heading);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero-overlay p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.button {
  display: inline-block;
  background-color: var(--secondary-color);
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.button:hover {
  background-color: var(--accent-color);
}

/* Highlights section */
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 3rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.highlight {
  background-color: #ffffff;
  padding: 2rem;
  border: 1px solid #e0d8ce;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.highlight h2 {
  font-family: var(--font-family-heading);
  margin-bottom: 0.8rem;
  font-size: 1.4rem;
  color: var(--primary-color);
}

.highlight p {
  font-size: 0.95rem;
}

/* Generic page banner */
.page-banner {
  position: relative;
  height: 40vh;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-banner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
}

.page-banner h1 {
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-family: var(--font-family-heading);
  font-size: 2.2rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Content areas */
.content {
  max-width: 1000px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.content h2 {
  font-family: var(--font-family-heading);
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.content p {
  margin-bottom: 1.1rem;
  font-size: 1rem;
}

.content img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 6px;
  margin: 1.5rem 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Menu tables */
.menu-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.menu-item {
  background-color: #ffffff;
  border: 1px solid #e0d8ce;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.menu-item h3 {
  font-family: var(--font-family-heading);
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
  color: var(--primary-color);
}

.menu-item p {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.menu-item .price {
  font-weight: bold;
  color: var(--secondary-color);
}

/* Contact form */
.contact-details {
  margin-bottom: 2rem;
}

.contact-form {
  background-color: #ffffff;
  padding: 2rem;
  border-radius: 6px;
  border: 1px solid #e0d8ce;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  max-width: 600px;
}

.contact-form label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: bold;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.contact-form textarea {
  height: 120px;
  resize: vertical;
}

.contact-form button {
  background-color: var(--secondary-color);
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.contact-form button:hover {
  background-color: var(--accent-color);
}

/* Events list styles */
.events-list {
  list-style: disc;
  margin-left: 1.5rem;
}

.events-list li {
  margin-bottom: 0.5rem;
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.gallery-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
/* Footer */
footer {
  margin-top: auto;
  background-color: var(--primary-color);
  color: #ffffff;
  text-align: center;
  padding: 1.2rem 0;
  font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-overlay h1 {
    font-size: 2rem;
  }
  .hero-overlay p {
    font-size: 1rem;
  }
  nav ul {
    gap: 0.6rem;
  }
  .content h2 {
    font-size: 1.6rem;
  }
}

/* Footer links: ensure contrast and clear affordance */
footer a {
  color: #ffffff;
  text-decoration: underline;
  font-weight: 600;
}
footer a:hover,
footer a:focus-visible {
  color: var(--accent-color);
  text-decoration: underline;
}


/* Lightbox modal for gallery images */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.lightbox.open {
  display: flex;
}
.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.lightbox .controls {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}
.lightbox button {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.lightbox button:hover,
.lightbox button:focus-visible {
  background: rgba(255,255,255,0.2);
}
.lightbox .nav {
  position: fixed;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.lightbox .nav button {
  pointer-events: all;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox .prev { left: 12px; }
.lightbox .next { right: 12px; }

/* Make gallery items obviously clickable */
.gallery-grid img {
  cursor: zoom-in;
}


/* Gallery category filters */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1rem 0 1.25rem;
}
.gallery-filters .filter-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.1);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}
.gallery-filters .filter-btn.is-active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}


/* --- Fancy gallery toolbar --- */
.gallery-filters {
  position: sticky;
  top: 0.5rem;
  z-index: 100;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  overflow-x: auto;
  white-space: nowrap;
}
.gallery-filters .filter-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(245,245,245,0.9));
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .01em;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.gallery-filters .filter-btn:hover,
.gallery-filters .filter-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}
.gallery-filters .filter-btn.is-active {
  background: linear-gradient(135deg, var(--accent-color, #2b7a78), #1f5f5c);
  color: #fff;
  border-color: transparent;
}

/* --- Gallery grid cards --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.gallery-grid img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  transition: transform .2s ease, box-shadow .2s ease;
  background: #f3f3f3;
}
.gallery-grid img:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 26px rgba(0,0,0,0.16);
}

/* Placeholder cards */
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 12px;
  background: repeating-linear-gradient(45deg, #fafafa, #fafafa 10px, #f2f2f2 10px, #f2f2f2 20px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  height: 220px;
  text-align: center;
  color: #555;
  gap: 8px;
}
.photo-placeholder > img {
  max-height: 120px;
  width: auto;
  opacity: 0.85;
}
.photo-placeholder figcaption {
  font-weight: 600;
  opacity: 0.9;
}

@media (max-width: 640px) {
  .gallery-filters { top: 0; border-radius: 0 0 12px 12px; }
}


/* Center gallery UI to align with .content width */
.gallery-filters,
.gallery-grid {
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}
.gallery-filters { margin-top: 0.5rem; padding-left: 1rem; padding-right: 1rem; }
.gallery-grid { padding-left: 1rem; padding-right: 1rem; }

/* ===========================================
   Rustic "snazz" pass — subtle grain, vignettes,
   small-caps logo, gentle ornaments.
   =========================================== */
:root{
  --grain-opacity: .18;
  --surface: #fffdfa;
  --surface-border: #e6dccf;
  --ink: #2f2924;
  --evergreen: #3e5a47;
}

/* Paper background with film grain */
body{
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(0,0,0,.05), transparent 60%),
    var(--background-color);
  position: relative;
}
body::before{
  content:"";
  position: fixed;
  inset: 0;
  background-image: url('images/noise.png');
  background-size: 128px 128px;
  opacity: var(--grain-opacity);
  pointer-events: none;
  z-index: 0;
}

/* Elevated content cards */
.content{
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.92));
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 2rem 1.25rem;
  box-shadow: 0 12px 28px rgba(0,0,0,.06);
}
@media (min-width: 640px){
  .content{ padding: 2.25rem 2rem; }
}

/* H2 ornaments */
.content h2{
  position: relative;
  padding-bottom: .2rem;
}
.content h2::after{
  content:"";
  display:block;
  width: 140px;
  height: 16px;
  margin: .75rem auto 0;
  background: url('images/flourish.svg') no-repeat center / contain;
  opacity: .6;
}

/* Header: rustic glass + small-caps logo + underline on active */
header{
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  background-color: rgba(74,63,53,.94);
}
.logo a{
  font-variant: small-caps;
  letter-spacing: .06em;
  text-shadow: 0 1px 0 rgba(0,0,0,.4), 0 0 16px rgba(181,143,90,.25);
}
nav ul li a{
  position: relative;
  font-weight: 600;
  letter-spacing: .02em;
}
nav ul li a::after{
  content:"";
  position:absolute;
  left: 12%;
  right: 12%;
  bottom: -10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color) 20%, var(--accent-color) 80%, transparent);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .18s ease, transform .18s ease;
}
nav ul li a:hover::after,
nav ul li a.active::after{
  opacity: 1;
  transform: translateY(0);
}

/* Hero: soft vignette & parallax where safe */
.hero{
  background-attachment: fixed;
}
@media (max-width:1024px){
  .hero{ background-attachment: scroll; }
}
.hero::after{
  background:
    radial-gradient(120% 100% at 50% 0, rgba(0,0,0,.55), rgba(0,0,0,.35) 45%, rgba(0,0,0,.55)),
    linear-gradient(to bottom, rgba(0,0,0,.25), rgba(0,0,0,.45));
}
.hero-overlay{
  text-shadow: 0 3px 14px rgba(0,0,0,.35);
}

/* Buttons: pill, tactile */
.button{
  border: 1px solid rgba(255,255,255,.35);
  border-bottom-width: 2px;
  border-radius: 999px;
  padding: .65rem 1.2rem;
  box-shadow: 0 8px 22px rgba(139,58,17,.25);
}
.button:active{ transform: translateY(1px); }

/* Footer: subtle divider glow */
footer{
  position: relative;
}
footer::before{
  content:"";
  display:block;
  height: 6px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  margin-bottom: 12px;
  opacity: .35;
}

/* Gallery: crisper cards & modal details */
.gallery-grid img{
  border: 1px solid rgba(0,0,0,.06);
}
.lightbox img{
  outline: 1px solid rgba(255,255,255,.15);
}
.lightbox .controls button,
.lightbox .nav button{
  border-color: rgba(255,255,255,.35);
}

/* Strong focus states for a11y */
:focus-visible{
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Link color inside content areas */
.content a{
  color: #6f3d1c;
  font-weight: 600;
}
.content a:hover,
.content a:focus-visible{
  color: var(--secondary-color);
  text-decoration: underline;
}


/* Food menu image presentation */
.menu-figure {
  margin: 1rem 0 0.5rem;
  text-align: center;
}
.menu-figure figcaption {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 0.5rem;
}
.menu-image {
  width: 100%;
  height: auto;
  max-height: none; /* override generic .content img constraint */
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.06);
}


/* Center helper */
.content .center { text-align: center; }
.content .center .button { display: inline-block; }

/* --- Mobile nav --- */
.nav-toggle{
  display:none;
  margin-left:auto;
  border:0;
  background:transparent;
  padding:.4rem .55rem;
  border-radius:10px;
  cursor:pointer;
  /* Ensure the toggle stays above any sliding panels */
  position: relative;
  z-index: 1100;
}
.nav-toggle:focus-visible{ outline:3px solid var(--accent-color); outline-offset:2px; }
.nav-toggle .bar{
  display:block; width:22px; height:2px; background:#fff; margin:5px 0;
  box-shadow:0 1px 0 rgba(0,0,0,.25);
}

@media (max-width: 820px){
  header{ height: var(--header-height); }
  nav{ gap:.5rem; }
  .nav-toggle{ display:inline-block; }

  /* When the mobile menu is open, force the header to be fixed so it never scrolls out */
  html.nav-open header { position: fixed; top: 0; left: 0; right: 0; }

  nav ul{
    position:fixed; left:0; right:0; top:var(--header-height);
    background: rgba(74,63,53,.98);
    display:flex; flex-direction:column; align-items:flex-start;
    transform: translateY(-120%);
    transition: transform .18s ease-out;
    max-height: calc(100vh - var(--header-height));
    overflow-y:auto; padding: .5rem 1rem 1rem;
    gap:0;
    /* Keep menu below the header so the toggle never gets covered, but above content */
    z-index:950;
  }
  nav ul.open{ transform: translateY(0); }
  nav ul li a{
    display:block; width:100%;
    padding:.9rem 0; font-size:1.05rem; border-bottom:1px solid rgba(255,255,255,.08);
  }
  nav ul li:last-child a{ border-bottom:0; }
  /* kill desktop underline flourish on mobile */
  nav ul li a::after{ display:none; }

  /* Smaller hero/banner & tighter gallery cards on phones */
  .hero{ height:50vh; }
  .page-banner{ height:32vh; }
  .gallery-grid img{ height:160px; }
  .lightbox img{ max-width:96vw; }
  /* Ensure sticky filters aren’t hidden under the header */
  .gallery-filters{ top: calc(var(--header-height) + 6px); }
}

/* --- Mobile overflow fixes (drop-in) --- */
html, body { max-width: 100%; overflow-x: clip; }  /* kill horizontal scroll */
img, svg, video { max-width: 100%; height: auto; } /* belt & braces */

/* Header/nav: allow wrapping and truncate the unbreakable logo string */
header { height: auto; } /* let it grow if it needs to */
nav { padding: 0 clamp(10px, 2vw, 16px); }
nav ul { flex-wrap: wrap; row-gap: .25rem; }
nav .logo { min-width: 0; }
nav .logo a{
  display: inline-block;
  max-width: 60vw;            /* avoid pushing viewport wider */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;     /* truncates “The Strathmore Arms” on very small screens */
}

/* Index hero text: never force horizontal scrolling */
.hero-overlay { max-width: 92vw; overflow-wrap: anywhere; }

/* Gallery toolbar + grid: keep inside viewport on narrow phones */
.gallery-filters { padding-left: 12px; padding-right: 12px; }
.gallery-grid   { padding-left: 12px; padding-right: 12px; }
@media (max-width: 520px){
  .gallery-grid { grid-template-columns: 1fr; } /* hard collapse to single column if needed */
}

/* Lightbox: clamp to viewport to avoid stray scrollbars */
.lightbox { position: fixed; inset: 0; }
.lightbox img { max-width: 96vw; max-height: 88vh; }

/* ===== Mobile fixes: header flush, 3-box stack, gallery toolbar ===== */

/* 1) Keep things inside the viewport */
html, body { max-width: 100%; overflow-x: clip; }
img, svg, video { max-width: 100%; height: auto; }

/* 2) Make the header bar and nav sit flush, even when links wrap */
@media (max-width: 820px){
  header { height: auto; }                    /* allow 2nd row of links */
  nav { align-items: flex-start; padding-top: .5rem; padding-bottom: .5rem; }
  nav ul { flex-wrap: wrap; row-gap: .25rem; }
  .logo a { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* 3) Home page “3 boxes”: force vertical stack on phones and stop overflow */
@media (max-width: 700px){
  .highlights { grid-template-columns: 1fr; padding: 1.5rem .75rem; }
}
.highlights, .highlight { min-width: 0; }
.highlight h2, .highlight p { overflow-wrap: anywhere; }

/* 4) Gallery toolbar: make it *flush* with the top bar and wrap on small screens */
.gallery-filters { top: 0; margin-top: 0; }   /* remove floating gap under header */
@media (max-width: 560px){
  .gallery-filters {
    white-space: normal;      /* was nowrap – caused sideways creep */
    overflow-x: visible;
    flex-wrap: wrap;
    gap: .5rem;
    padding-left: .75rem;
    padding-right: .75rem;
  }
  .gallery-grid { grid-template-columns: 1fr; padding-left: .75rem; padding-right: .75rem; }
}

/* 5) Lightbox: clamp to viewport to avoid stray scrollbars */
.lightbox { position: fixed; inset: 0; }
.lightbox img { max-width: 96vw; max-height: 88vh; }

/* === Sticky header alignment + dropdown fixes === */
:root { --header-height: 70px; } /* fallback; JS below will sync actual height */

/* Put any dropdown/panel flush against the header, no gap, never hidden */
nav ul.open,
nav .nav-panel,
nav .menu-panel { position: fixed; left: 0; right: 0; top: var(--header-height); margin-top: 0; }
.gallery-filters { position: sticky; top: var(--header-height) !important; z-index: 900; overflow: visible; }
.gallery-select, #folder-select { position: sticky; top: var(--header-height); z-index: 900; }

/* Prevent header + sticky elements overlap from clipping menus */
header { z-index: 1000; }

/* Home hero heading must not split “Arms” */
.hero-overlay, .hero-overlay h1 { overflow-wrap: normal; word-break: normal; hyphens: manual; }

/* Force the three home boxes to stack on phones */
@media (max-width: 720px){ .highlights { grid-template-columns: 1fr; } }

/* Kill stray horizontal scrollbars */
html, body { max-width: 100%; overflow-x: clip; }

/* Desktop nav: slightly larger */
@media (min-width: 821px){
  nav { padding-block: .5rem; }             /* taller bar */
  .logo a { font-size: 1.7rem; }             /* was ~1.4rem */
  nav ul { gap: 1.4rem; }                    /* was ~1.2rem */
  nav ul li a {
    font-size: 1.04rem;                      /* was ~0.95rem */
    padding-block: .35rem;                   /* bigger hit area */
  }
}
