/* ============================================================
   Aberaeron, Wales — Main Stylesheet
   ============================================================
   HOW TO UPDATE:
   - Colours: change the CSS variables at the top of :root {}
   - Fonts: change --font-body and --font-heading
   - Layout width: change --max-width
   ============================================================ */

/* Google Fonts loaded via <link> tags in HTML <head> for better performance */

/* ---- Variables ---- */
:root {
  --primary:       #1e5f5f;
  --primary-light: #2a8080;
  --primary-dark:  #14403f;
  --accent:        #c8a030;
  --text:          #333;
  --text-light:    #666;
  --light-bg:      #f4f7f7;
  --border:        #dce8e8;
  --white:         #fff;
  --max-width:     1100px;
  --font-body:     'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading:  'Merriweather', Georgia, serif;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: #e8eded;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--primary); }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.3;
  color: var(--primary-dark);
}

/* ---- Header & Navigation ---- */
.site-header {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.site-title a {
  color: var(--white);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.site-title a span {
  color: var(--accent);
}

/* Nav */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 0;
}

.main-nav li { position: relative; }

.main-nav a {
  display: block;
  color: var(--white);
  text-decoration: none;
  padding: 20px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav li.active > a {
  background: var(--primary-dark);
  color: var(--accent);
}

/* Dropdown — visibility/opacity approach allows CSS transition */
.dropdown-menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--primary-dark);
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 200;
  /* Hidden state */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
  /* Bridge any hover gap between trigger and menu */
  padding-top: 4px;
  margin-top: -4px;
}

.dropdown-menu li { width: 100%; }

.dropdown-menu a {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.85rem;
}

.main-nav li:hover .dropdown-menu,
.main-nav li.open .dropdown-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Hamburger toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 2px solid rgba(255,255,255,0.5);
  color: var(--white);
  font-size: 1.3rem;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}

/* ---- Hero (homepage) ---- */
.hero {
  position: relative;
  background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Oswestry_-_Historic_buildings_in_town_centre.jpg/1280px-Oswestry_-_Historic_buildings_in_town_centre.jpg');
  background-size: 100% auto;
  background-position: center top;
  background-repeat: no-repeat;
  background-color: var(--primary-dark);
  /* Maintain the image's natural proportions — approx 2:1 ratio */
  padding-bottom: 50%;
  height: 0;
  overflow: hidden;
}

.hero-bg { display: none; } /* not needed with this approach */

.hero-content {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  padding: 20px;
  text-align: center;
}

.hero-content h1 {
  font-size: clamp(1.6rem, 5vw, 3rem);
  color: var(--white);
  text-shadow: 1px 2px 5px rgba(0,0,0,0.8);
  margin-bottom: 10px;
}

.hero-content p {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  text-shadow: 1px 1px 4px rgba(0,0,0,0.9);
}

.hero-content a {
  color: #ffe88a;
  text-decoration: none;
}

.hero-content a:hover { text-decoration: underline; }

/* ---- Page Banner (inner pages) ---- */
.page-banner {
  background: var(--primary);
  color: var(--white);
  padding: 28px 20px;
  text-align: center;
}

.page-banner h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--white);
}

.page-banner p {
  opacity: 0.85;
  margin-top: 6px;
}

/* ---- Main Content Wrapper ---- */
.content-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  background: var(--white);
  box-shadow: 0 0 20px rgba(0,0,0,0.12);
}

/* ---- Content Sections ---- */
.section {
  padding: 40px 32px;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-alt {
  background: var(--light-bg);
}

.section h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.section h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: var(--primary);
}

.section p {
  margin-bottom: 14px;
  max-width: 75ch;
}

.section p:last-child { margin-bottom: 0; }

/* ---- Image layouts ---- */
.img-float-right {
  float: right;
  margin: 0 0 16px 24px;
  max-width: 45%;
}

.img-float-left {
  float: left;
  margin: 0 24px 16px 0;
  max-width: 45%;
}

.img-caption {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 4px;
}

.clearfix::after { content: ''; display: table; clear: both; }

/* ---- Full-width image ---- */
.img-full {
  width: 100%;
  height: auto;
  display: block;
}

/* ---- Card grid ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.card img { width: 100%; height: 200px; object-fit: cover; }

.card-body { padding: 20px; }

.card-body h3 { margin-bottom: 8px; }

.card-body p { font-size: 0.9rem; margin-bottom: 0; }

/* ---- Accommodation listing ---- */
.accom-item {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.accom-item:last-child { border-bottom: none; }

.accom-item h3 { margin-bottom: 6px; }

.accom-item .contact-info {
  background: var(--light-bg);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.9rem;
}

.accom-item .contact-info p { margin-bottom: 4px; }

/* ---- Two-column content ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* ---- Booking widget wrapper ---- */
.booking-wrap {
  margin: 24px 0;
  background: var(--light-bg);
  padding: 20px;
  border-radius: 6px;
}

.booking-wrap p { margin-bottom: 12px; font-weight: 600; }

/* ---- Links list ---- */
.links-list { list-style: none; padding: 0; }

.links-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.links-list li:last-child { border-bottom: none; }

.links-list a {
  font-weight: 600;
  font-size: 0.95rem;
}

.links-list .link-desc {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* ---- CTA box ---- */
.cta-box {
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px 28px;
  text-align: center;
  margin: 24px 0;
}

.cta-box h3 { margin-bottom: 10px; }

.cta-box .btn {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  padding: 10px 24px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 10px;
  transition: background 0.2s;
}

.cta-box .btn:hover { background: var(--primary-dark); color: var(--white); }

/* ---- Wales Towns Directory ---- */
/* ============================================================
   UPDATE TOWNS: Edit the links inside .towns-grid below
   ============================================================ */
.towns-directory {
  background: var(--light-bg);
  padding: 32px;
  border-top: 2px solid var(--border);
}

.towns-directory h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  margin-bottom: 6px;
}

.towns-intro {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.towns-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.towns-grid a {
  display: inline-block;
  padding: 5px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s;
}

.towns-grid a:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.towns-grid a.current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  font-weight: 600;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-footer a { color: var(--accent); }
.site-footer a:hover { color: var(--white); }

/* ---- Responsive ---- */
@media (max-width: 768px) {

  .nav-toggle { display: block; }

  .main-nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }

  .main-nav ul.open { display: flex; }

  .main-nav a { padding: 14px 20px; }

  .dropdown-menu {
    /* Reset desktop transition approach for mobile stacked layout */
    display: none;
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: none;
    position: static;
    box-shadow: none;
    background: rgba(0,0,0,0.15);
    padding-top: 0;
    margin-top: 0;
  }

  .main-nav li.open .dropdown-menu { display: flex; }

  .two-col { grid-template-columns: 1fr; }

  .img-float-right,
  .img-float-left {
    float: none;
    max-width: 100%;
    margin: 0 0 16px 0;
  }

  .section { padding: 24px 16px; }

  .towns-directory { padding: 24px 16px; }
}

@media (max-width: 480px) {
  .hero { padding-bottom: 60%; background-size: 100% auto; }
  .card-grid { grid-template-columns: 1fr; }
}
