/* ============================================
   Hakuba Global — Sandan Koyo Design System
   Concept C: สามสี สามฤดู ที่เดียว
   Three Colors, Three Seasons, One Place
   ============================================ */

/* Note: Fonts are loaded via <link> in HTML head — no @import needed */

/* --- CSS Variables — Sandan Koyo Palette --- */
:root {
  /* Core: Three Colors of Sandan Koyo */
  --color-midnight: #0A1628;
  --color-navy: #12243D;
  --color-navy-light: #1E3556;
  --color-autumn-red: #C62828;
  --color-autumn-red-light: #E53935;
  --color-orange: #FF5722;
  --color-orange-hover: #E64A19;
  --color-orange-glow: rgba(255, 87, 34, 0.15);
  --color-forest: #2E7D32;
  --color-forest-light: #43A047;
  --color-gold: #E8A825;
  --color-gold-light: #F5C842;

  /* Neutrals */
  --color-snow: #FAFBFC;
  --color-cream: #F7F2EC;
  --color-warm-gray: #F0EBE3;
  --color-glacier: #B8D4E3;
  --color-glacier-light: #D6E8F2;
  --color-white: #FFFFFF;
  --color-text: #1A1A2E;
  --color-text-secondary: #5A6274;
  --color-text-light: #6B7280; /* Improved contrast: ~4.6:1 on white (WCAG AA) */
  --color-border: #E2E6EC;
  --color-border-light: #F0F2F5;

  /* Typography */
  --font-display: 'Kanit', sans-serif;
  --font-body: 'Sarabun', sans-serif;
  --font-accent: 'Outfit', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Layout */
  --container-max: 1280px;
  --container-narrow: 800px;
  --container-wide: 1440px;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(10, 22, 40, 0.08);
  --shadow-lg: 0 8px 32px rgba(10, 22, 40, 0.12);
  --shadow-xl: 0 16px 48px rgba(10, 22, 40, 0.16);
  --shadow-card: 0 2px 12px rgba(10, 22, 40, 0.06), 0 0 1px rgba(10, 22, 40, 0.1);
  --shadow-card-hover: 0 12px 40px rgba(10, 22, 40, 0.14), 0 0 1px rgba(10, 22, 40, 0.12);

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --transition-fast: 200ms var(--ease-out-expo);
  --transition-base: 400ms var(--ease-out-expo);
  --transition-slow: 600ms var(--ease-out-expo);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-snow);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 700; }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.35rem); }

p {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--color-text-secondary);
}

.text-accent {
  font-family: var(--font-accent);
}

.text-label {
  font-family: var(--font-accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.85rem 2rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  min-height: 44px;
}

.btn--primary {
  background: transparent;
  color: var(--color-white);
  border: 2px solid rgba(255, 255, 255, 0.8);
  min-height: 44px;
}

.btn--primary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-white);
}

.btn--autumn {
  background: transparent;
  color: var(--color-white);
  border: 2px solid rgba(255, 255, 255, 0.6);
  min-height: 44px;
}

.btn--autumn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-white);
}

.btn--outline {
  background: transparent;
  color: var(--color-white);
  border: 2px solid rgba(255, 255, 255, 0.4);
  min-height: 44px;
}

.btn--outline:hover {
  border-color: var(--color-white);
  background: rgba(255, 255, 255, 0.1);
}

.btn--dark {
  background: var(--color-midnight);
  color: var(--color-white);
  border: 2px solid var(--color-midnight);
  min-height: 44px;
}

.btn--dark:hover {
  background: var(--color-navy);
  border-color: var(--color-navy);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 0.85rem 1rem;
  min-height: 44px;
}

.btn--ghost:hover {
  border-color: var(--color-text);
  background: transparent;
}

.btn .btn-arrow {
  transition: transform var(--transition-fast);
}

.btn:hover .btn-arrow {
  transform: translateX(4px);
}

/* --- Section Spacing --- */
.section {
  padding: var(--space-5xl) 0;
}

.section--compact {
  padding: var(--space-3xl) 0;
}

.section--cream {
  background: var(--color-cream);
}

.section--warm {
  background: var(--color-warm-gray);
}

.section--dark {
  background: var(--color-midnight);
  color: var(--color-white);
}

.section--dark p {
  color: var(--color-glacier);
}

/* --- Section Headers --- */
.section-header {
  margin-bottom: var(--space-lg);
}

.section-title {
  margin-bottom: var(--space-md);
}

.section-desc {
  max-width: 560px;
}

/* --- Cards --- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out-expo);
}

.card:hover .card__image img {
  transform: none;
}

.card__badge {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  padding: 0.35rem 0.85rem;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(10px);
  color: var(--color-white);
  font-family: var(--font-accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.card__badge--autumn {
  background: rgba(198, 40, 40, 0.85);
}

.card__badge--winter {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.card__body {
  padding: var(--space-lg) var(--space-xl);
}

.card__date {
  font-family: var(--font-accent);
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-bottom: var(--space-sm);
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__excerpt {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__read-more {
  font-family: var(--font-accent);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-orange);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap var(--transition-fast);
}

.card:hover .card__read-more {
  gap: 0.7rem;
}

/* --- Tag --- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  background: var(--color-glacier-light);
  color: var(--color-navy);
  font-family: var(--font-accent);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--color-glacier);
}

.tag--active {
  background: var(--color-midnight);
  color: var(--color-white);
}

.tag--autumn {
  background: rgba(198, 40, 40, 0.1);
  color: var(--color-autumn-red);
}

.tag--winter {
  background: rgba(10, 22, 40, 0.08);
  color: var(--color-navy);
}

/* --- Scroll Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }

/* --- WCAG 2.5.8: Minimum Target Size (24×24px) --- */
/* Interactive elements must have at least 24×24 CSS pixel touch target */
.nav-link {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}

.footer__link {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}

/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: 0.6rem 1.2rem;
  background: var(--color-midnight);
  color: var(--color-white);
  font-family: var(--font-accent);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: var(--space-md);
}

/* --- Focus Visible (Keyboard Navigation) --- */
:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Remove outline on mouse click (preserve for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- Scroll Margin for Fixed Header (WCAG 2.4.11) --- */
/* Prevents focused elements from being hidden behind the sticky header */
:target,
:focus {
  scroll-margin-top: 80px;
}

/* --- Reduced Motion (WCAG 2.3.3) --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Show reveal elements immediately without animation */
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --- Decorative elements (hidden from screen readers via CSS) --- */
.category-card__arrow,
.btn-arrow {
  speak: never;
}

/* --- Responsive Utilities --- */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .section { padding: var(--space-3xl) 0; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
