/* ==========================================================================
   LinnyLand Fun and Farm — Client Website
   Amusement Park · Cafe · Farm — Khao Kho, Phetchabun, Thailand
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Colors — nature/farm palette */
  --color-bg: #fefdfb;
  --color-text: #1a2e0a;
  --color-text-secondary: #2d4a14;
  --color-text-muted: #4a6e3a;
  --color-border: #c4d4b8;
  --color-accent: #2d5016;
  --color-accent-light: #e8f0e0;
  --color-button-bg: #2d5016;
  --color-button-text: #ffffff;
  --color-hover: #1a3a08;
  --color-shadow-light: rgba(45, 80, 22, 0.12);
  --color-shadow-dark: rgba(26, 46, 10, 0.25);
  --color-focus: rgba(45, 80, 22, 0.4);
  --color-error: #b91c1c;
  --color-success: #15803d;
  --color-overlay-dark: rgba(0, 0, 0, 0.6);
  --color-overlay-mid: rgba(0, 0, 0, 0.2);
  --color-footer-text: rgba(255, 255, 255, 0.7);
  --color-footer-muted: rgba(255, 255, 255, 0.5);
  --color-footer-rule: rgba(255, 255, 255, 0.15);

  /* Typography */
  --font-heading: "Hedvig Letters Serif", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-accent: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Sizing */
  --content-width: 720px;
  --wide-width: 1200px;
  --block-gap: 1.5rem;

  /* Responsive font sizes (clamp with fallback) */
  --fs-h1: clamp(2.032rem, 2.032rem + ((1vw - 0.2rem) * 2.896), 3.625rem);
  --fs-h2: clamp(1.6rem, 1.6rem + ((1vw - 0.2rem) * 1.6), 2.625rem);
  --fs-h3: clamp(1.378rem, 1.378rem + ((1vw - 0.2rem) * 0.8), 1.875rem);
  --fs-body: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.455), 1.125rem);
  --fs-small: clamp(0.75rem, 0.75rem + ((1vw - 0.2rem) * 0.25), 0.875rem);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-accent);
  text-decoration: underline;
  transition: color 0.2s ease;
}

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

/* ---------- Focus Styles ---------- */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1.5rem;
  background: var(--color-accent);
  color: var(--color-button-text);
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  font-family: var(--font-accent);
  font-size: var(--fs-small);
  font-weight: 600;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); margin-bottom: 1rem; }
h3 { font-size: var(--fs-h3); margin-bottom: 0.75rem; }

p {
  margin-bottom: 1.5rem;
}

/* ---------- Layout ---------- */
main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-accent);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.85rem 2rem;
  border-radius: 4px;
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  min-height: 44px;
}

.btn-primary {
  background: var(--color-button-bg);
  color: var(--color-button-text);
  border-color: var(--color-button-bg);
}

.btn-primary:hover {
  background: var(--color-hover);
  border-color: var(--color-hover);
  color: var(--color-button-text);
}

.btn-outline {
  background: transparent;
  color: var(--color-bg);
  border-color: var(--color-bg);
}

.btn-outline:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: 0 2px 8px var(--color-shadow-light);
}

.header-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0.75rem clamp(1.5rem, 5vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo img {
  max-height: 50px;
  width: auto;
}

.site-logo a {
  text-decoration: none;
}

/* Primary Navigation */
.primary-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-nav a {
  font-family: var(--font-accent);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--color-text);
  padding: 0.5rem 0.25rem;
  position: relative;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.primary-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.primary-nav a:hover::after {
  width: 100%;
}

/* Mobile hamburger */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.75rem;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 80vh;
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem clamp(1.5rem, 5vw, 3rem);
  background: linear-gradient(to top, var(--color-overlay-dark) 0%, var(--color-overlay-mid) 60%, transparent 100%);
  color: var(--color-bg);
}

.hero-overlay h1 {
  font-family: var(--font-heading);
  color: var(--color-bg);
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  margin-bottom: 0.25rem;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: var(--fs-h3);
  margin-bottom: 0.25rem;
  opacity: 0.95;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.hero-tagline-en {
  display: block;
  font-size: var(--fs-body);
  opacity: 0.85;
  font-style: italic;
  margin-top: 0.15rem;
}

.hero-subtitle {
  font-family: var(--font-accent);
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.hero-cta-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Article Content ---------- */
.article-content {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 3rem clamp(1.5rem, 5vw, 2rem);
  scroll-margin-top: 5rem;
}

.article-content h2 {
  font-family: var(--font-heading);
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
  color: var(--color-accent);
}

.article-content h3 {
  font-family: var(--font-heading);
  margin-top: 2rem;
}

.article-content p {
  line-height: 1.8;
  color: var(--color-text-secondary);
}

.article-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Image Gallery Grid ---------- */
.gallery-grid {
  display: grid;
  gap: var(--block-gap);
  margin: 2rem 0;
}

.gallery-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.gallery-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.gallery-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.gallery-grid picture {
  display: block;
  overflow: hidden;
  border-radius: 4px;
}

.gallery-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 3 / 4;
}

.gallery-grid--landscape img {
  aspect-ratio: 3 / 2;
}

.gallery-grid picture:hover img {
  transform: scale(1.02);
  box-shadow: 0 4px 16px var(--color-shadow-light);
}

/* ---------- Info Box / Callout ---------- */
.info-box {
  background: var(--color-accent-light);
  border-left: 3px solid var(--color-accent);
  padding: 1.5rem clamp(1rem, 3vw, 2rem);
  margin: 2rem 0;
  font-size: var(--fs-small);
  border-radius: 0 4px 4px 0;
}

.info-box-title {
  font-family: var(--font-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  font-size: var(--fs-small);
  color: var(--color-accent);
}

.info-box p {
  margin-bottom: 0.5rem;
}

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

/* ---------- Map Container ---------- */
.map-container {
  margin: 2rem 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--color-shadow-light);
}

.map-container iframe {
  display: block;
  width: 100%;
}

.directions-cta {
  margin-top: 1.5rem;
  text-align: center;
}

/* ---------- Contact Section ---------- */
.contact-section {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 4rem clamp(1.5rem, 5vw, 2rem);
  background: var(--color-accent-light);
  scroll-margin-top: 5rem;
}

.contact-section h2 {
  text-align: center;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.contact-intro {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: 2.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.contact-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.contact-channels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-content: start;
}

.contact-card {
  background: var(--color-bg);
  padding: 1.25rem;
  border-radius: 4px;
  box-shadow: 0 1px 4px var(--color-shadow-light);
}

.contact-card-title {
  font-family: var(--font-accent);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  color: var(--color-text-muted);
}

.contact-card a {
  font-size: var(--fs-body);
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.contact-card a:hover {
  text-decoration: underline;
}

/* ---------- Contact Form ---------- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-title {
  font-family: var(--font-accent);
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  color: var(--color-accent);
}

.form-group {
  display: flex;
  flex-direction: column;
}

.contact-form label {
  display: block;
  font-family: var(--font-accent);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  color: var(--color-text-secondary);
}

.required {
  color: var(--color-error);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: var(--color-bg);
}

.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus);
  outline: none;
}

.contact-form input.invalid,
.contact-form textarea.invalid {
  border-color: var(--color-error);
}

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

.form-error {
  font-size: var(--fs-small);
  color: var(--color-error);
  min-height: 1.25rem;
  margin-top: 0.25rem;
}

.form-status {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-family: var(--font-accent);
  font-size: var(--fs-small);
  text-align: center;
  display: none;
}

.form-status.success {
  display: block;
  background: #dcfce7;
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.form-status.error {
  display: block;
  background: #fef2f2;
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-text);
  color: var(--color-bg);
  padding: 4rem clamp(1.5rem, 5vw, 2rem) 2rem;
}

.footer-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}

.footer-heading {
  font-family: var(--font-heading);
  font-size: var(--fs-body);
  margin-bottom: 1rem;
  color: var(--color-bg);
}

.footer-col p {
  font-size: var(--fs-small);
  color: var(--color-footer-text);
  line-height: 1.7;
}

.footer-col a {
  color: var(--color-footer-text);
  text-decoration: none;
  font-size: var(--fs-small);
  display: block;
  padding: 0.35rem 0;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--color-bg);
}

.footer-social {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--fs-small);
}

.footer-bottom {
  max-width: var(--wide-width);
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-footer-rule);
  text-align: center;
  font-size: var(--fs-small);
  color: var(--color-footer-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 781px) {
  .header-inner {
    flex-direction: row;
    justify-content: space-between;
  }

  .primary-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    padding: 1rem;
    box-shadow: 0 4px 12px var(--color-shadow-light);
  }

  .primary-nav a {
    padding: 0.75rem 1rem;
    min-height: 44px;
  }

  .primary-nav.active {
    display: flex;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .hero {
    aspect-ratio: 4 / 3;
    max-height: 50vh;
  }

  .gallery-grid--3,
  .gallery-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-channels {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  .gallery-grid--2,
  .gallery-grid--3,
  .gallery-grid--4 {
    grid-template-columns: 1fr;
  }

  .hero-overlay h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .hero-tagline {
    font-size: var(--fs-body);
  }

  .hero-cta-group {
    flex-direction: column;
  }

  .hero-cta-group .btn {
    text-align: center;
  }

  .article-content {
    padding: 2rem 1rem;
  }

  .contact-channels {
    grid-template-columns: 1fr;
  }

  .contact-section {
    padding: 2.5rem 1rem;
  }
}

/* ---------- Utility: Screen Reader ---------- */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .site-footer,
  .contact-section,
  .mobile-menu-toggle,
  .map-container,
  .hero-cta-group {
    display: none;
  }

  .article-content {
    max-width: 100%;
    padding: 0;
  }
}
