/*
Theme Name: เฮาฮักพะเยา
Theme URI: https://haohuck-phayao.local
Author: Phayao TV
Description: ธีมพรีเมี่ยมสำหรับเว็บไซต์ "เฮาฮักพะเยา" เนื่องในโอกาสครบรอบ 50 ปี การสถาปนาจังหวัดพะเยา (พ.ศ. 2520–2570) ดีไซน์เรียบหรู โทนสีน้ำเงินฟ้ากว๊านพะเยาและบานเย็น พร้อมนับถอยหลังวันสถาปนาบนหน้าแรก
Version: 1.0.0
Requires PHP: 7.4
Text Domain: hao-hak-phayao
*/

/* ==========================================================================
   DESIGN TOKENS — เฮาฮักพะเยา 50 ปี
   ========================================================================== */
:root{
  /* สี — สายน้ำกว๊านพะเยา (blue) + บานเย็น (rose) + ทองหรู (premium hairline) */
  --phy-blue-deep:    #12335F;   /* น้ำเงินกว๊านพะเยายามค่ำ — หัวเรื่อง */
  --phy-blue:         #1B4B8F;   /* น้ำเงินฟ้าหลัก */
  --phy-blue-soft:    #E9F0FA;   /* พื้นรองรับโทนฟ้า */
  --phy-rose:         #B0356E;   /* บานเย็น — accent หลัก */
  --phy-rose-soft:    #F7E7EF;   /* พื้นรองรับโทนบานเย็น */
  --phy-gold:         #B8935A;  /* เส้นทอง — จุดหรูจุดเดียว ใช้แต่น้อย */
  --phy-cream:        #FBF8F3;  /* พื้นหลักของเว็บ อบอุ่น ไม่ใช่ขาวจัด */
  --phy-cream-2:      #F3EEE4;
  --phy-ink:          #1B1B26;  /* ตัวอักษรหลัก */
  --phy-ink-soft:      #5B5B68;

  /* ตัวอักษร */
  --font-display: 'Kanit', sans-serif;
  --font-body:    'Sarabun', sans-serif;
  --font-quote:   'Noto Serif Thai', serif;

  /* เลเยอร์ */
  --shadow-soft: 0 20px 60px -25px rgba(18,51,95,.35);
  --radius-lg: 28px;
  --radius-md: 16px;

  --container: 1180px;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  background:var(--phy-cream);
  color:var(--phy-ink);
  font-family:var(--font-body);
  font-size:17px;
  line-height:1.7;
  -webkit-font-smoothing:antialiased;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
h1,h2,h3,h4{
  font-family:var(--font-display);
  color:var(--phy-blue-deep);
  margin:0 0 .5em;
  line-height:1.2;
  font-weight:600;
}
.container{
  max-width:var(--container);
  margin:0 auto;
  padding:0 28px;
}
.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-family:var(--font-body);
  font-weight:600;
  letter-spacing:.14em;
  text-transform:uppercase;
  font-size:13px;
  color:var(--phy-rose);
}
.eyebrow::before{
  content:'';
  width:26px; height:1px;
  background:var(--phy-gold);
}

/* Focus visibility (accessibility) */
a:focus-visible, button:focus-visible{
  outline:2px solid var(--phy-rose);
  outline-offset:3px;
  border-radius:4px;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; scroll-behavior:auto !important; }
}

/* ==========================================================================
   SITE HEADER
   ========================================================================== */
.site-header{
  position:sticky; top:0; z-index:50;
  background:rgba(251,248,243,.86);
  backdrop-filter:blur(10px);
  border-bottom:1px solid rgba(18,51,95,.08);
}
.site-header .container{
  display:flex; align-items:center; justify-content:space-between;
  padding-top:16px; padding-bottom:16px;
}
.site-brand{ display:flex; align-items:center; gap:12px; }
.site-brand .mark{
  width:38px;height:38px;border-radius:50%;
  background:conic-gradient(from 200deg, var(--phy-blue), var(--phy-rose), var(--phy-blue));
}
.site-brand .name{
  font-family:var(--font-display);
  font-weight:600; font-size:19px; color:var(--phy-blue-deep);
}
.site-brand .name small{
  display:block; font-family:var(--font-body); font-weight:400;
  font-size:11px; letter-spacing:.08em; color:var(--phy-ink-soft);
}
.primary-nav ul{ display:flex; gap:30px; list-style:none; margin:0; padding:0; }
.primary-nav a{
  font-size:15px; font-weight:500; color:var(--phy-ink);
  position:relative; padding:4px 0;
}
.primary-nav a::after{
  content:''; position:absolute; left:0; right:100%; bottom:0; height:2px;
  background:var(--phy-rose); transition:right .25s ease;
}
.primary-nav a:hover::after{ right:0; }
.nav-toggle{ display:none; }

@media (max-width: 860px){
  .primary-nav{ display:none; }
  .nav-toggle{ display:block; }
}

/* ==========================================================================
   HERO + COUNTDOWN  (หน้าแรก signature section)
   ========================================================================== */
.hero{
  position:relative;
  padding:96px 0 70px;
  overflow:hidden;
  background:
    radial-gradient(60% 55% at 82% -6%, rgba(27,75,143,.10), transparent 60%),
    radial-gradient(46% 40% at 4% 8%, rgba(176,53,110,.08), transparent 60%);
}
.hero-grid{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap:56px;
  align-items:center;
}
.hero-copy h1{
  font-size:clamp(34px, 4.6vw, 58px);
  letter-spacing:-.01em;
}
.hero-copy h1 .accent{ color:var(--phy-rose); }
.hero-copy .lede{
  font-size:18px;
  color:var(--phy-ink-soft);
  max-width:46ch;
  margin-top:18px;
}
.hero-dates{
  margin-top:26px;
  display:flex; align-items:center; gap:16px;
  font-family:var(--font-display); font-weight:500;
  color:var(--phy-blue-deep); font-size:15px;
}
.hero-dates .y{ font-size:22px; font-weight:600; }
.hero-dates .span-line{
  flex:0 0 60px; height:1px;
  background:linear-gradient(90deg, var(--phy-blue), var(--phy-rose));
  position:relative;
}
.hero-dates .span-line::after{
  content:''; position:absolute; right:-3px; top:-3px;
  width:7px; height:7px; border-radius:50%; background:var(--phy-rose);
}
.hero-cta{ margin-top:34px; display:flex; gap:16px; flex-wrap:wrap; }
.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:14px 26px; border-radius:999px;
  font-family:var(--font-display); font-weight:500; font-size:15px;
  transition:transform .2s ease, box-shadow .2s ease;
}
.btn-primary{
  background:var(--phy-blue-deep); color:#fff;
  box-shadow:var(--shadow-soft);
}
.btn-primary:hover{ transform:translateY(-2px); }
.btn-ghost{
  border:1px solid rgba(18,51,95,.25); color:var(--phy-blue-deep);
}
.btn-ghost:hover{ border-color:var(--phy-rose); color:var(--phy-rose); }

/* --- Countdown ring cluster: "ระลอกน้ำกว๊าน" motif --- */
.kwan-countdown{
  position:relative;
  background:#fff;
  border-radius:var(--radius-lg);
  padding:36px 30px 30px;
  box-shadow:var(--shadow-soft);
  border:1px solid rgba(184,147,90,.25);
}
.kwan-countdown::before{
  /* single gold hairline — the one premium accessory */
  content:'';
  position:absolute; inset:10px;
  border:1px solid rgba(184,147,90,.35);
  border-radius:calc(var(--radius-lg) - 8px);
  pointer-events:none;
}
.kwan-countdown .cd-eyebrow{
  text-align:center; margin-bottom:20px;
}
.cd-eyebrow .label{
  font-family:var(--font-body); font-size:13px; letter-spacing:.12em;
  text-transform:uppercase; color:var(--phy-ink-soft);
}
.cd-eyebrow .target-date{
  font-family:var(--font-display); font-size:17px; color:var(--phy-blue-deep);
  margin-top:4px; font-weight:600;
}
.cd-rings{
  display:grid; grid-template-columns:repeat(4,1fr); gap:14px;
}
.cd-unit{ text-align:center; }
.cd-ring-wrap{
  position:relative; width:100%; aspect-ratio:1/1;
}
.cd-ring-wrap svg{ width:100%; height:100%; transform:rotate(-90deg); }
.cd-ring-track{ fill:none; stroke:var(--phy-cream-2); stroke-width:6; }
.cd-ring-fill{
  fill:none; stroke-width:6; stroke-linecap:round;
  stroke-dasharray: var(--wave-pattern, none);
  transition:stroke-dashoffset 1s linear;
}
.cd-unit:nth-child(1) .cd-ring-fill{ stroke:var(--phy-blue); }
.cd-unit:nth-child(2) .cd-ring-fill{ stroke:#3E6FB0; }
.cd-unit:nth-child(3) .cd-ring-fill{ stroke:#8B4A8E; }
.cd-unit:nth-child(4) .cd-ring-fill{ stroke:var(--phy-rose); }
.cd-value{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-weight:600;
  font-size:clamp(18px,2.6vw,26px);
  color:var(--phy-blue-deep);
}
.cd-unit .cd-label{
  margin-top:10px; font-size:12.5px; color:var(--phy-ink-soft);
  letter-spacing:.06em;
}
.kwan-countdown .cd-note{
  margin-top:22px; text-align:center; font-size:13.5px; color:var(--phy-ink-soft);
}
.kwan-countdown .cd-note strong{ color:var(--phy-rose); }

@media (max-width: 940px){
  .hero-grid{ grid-template-columns:1fr; }
}
@media (max-width: 480px){
  .cd-rings{ gap:8px; }
  .cd-value{ font-size:15px; }
}

/* ==========================================================================
   WAVE DIVIDER — สายกว๊าน motif reused across sections
   ========================================================================== */
.wave-divider{ line-height:0; }
.wave-divider svg{ width:100%; height:64px; display:block; }

/* ==========================================================================
   SECTION: preview cards (เส้นเวลา / แผนที่ / เรื่องเล่า)
   ========================================================================== */
.section{ padding:76px 0; }
.section-head{ max-width:640px; margin:0 0 42px; }
.section-head h2{ font-size:clamp(26px,3vw,36px); }
.section-head p{ color:var(--phy-ink-soft); margin-top:10px; }

.card-grid{
  display:grid; grid-template-columns:repeat(3,1fr); gap:26px;
}
.pillar-card{
  background:#fff; border-radius:var(--radius-md);
  padding:30px 26px; border:1px solid rgba(18,51,95,.08);
  transition:transform .25s ease, box-shadow .25s ease;
}
.pillar-card:hover{ transform:translateY(-4px); box-shadow:var(--shadow-soft); }
.pillar-card .icon{
  width:44px;height:44px;border-radius:12px;
  background:var(--phy-blue-soft);
  display:flex;align-items:center;justify-content:center;
  margin-bottom:18px;
}
.pillar-card:nth-child(2) .icon{ background:var(--phy-rose-soft); }
.pillar-card h3{ font-size:19px; margin-bottom:8px; }
.pillar-card p{ color:var(--phy-ink-soft); font-size:15px; margin:0 0 16px; }
.pillar-card .go{
  font-size:14px; font-weight:600; color:var(--phy-rose);
  display:inline-flex; align-items:center; gap:6px;
}

@media (max-width:860px){
  .card-grid{ grid-template-columns:1fr; }
}

/* Quote / community story strip using Noto Serif Thai */
.story-quote{
  font-family:var(--font-quote);
  font-size:22px; line-height:1.8; color:var(--phy-blue-deep);
  max-width:760px; margin:0 auto; text-align:center; padding:0 20px;
}
.story-quote cite{
  display:block; margin-top:18px; font-family:var(--font-body);
  font-style:normal; font-size:14px; color:var(--phy-ink-soft);
}

/* ==========================================================================
   แกลอรีภาพ + เสียง/คลิปยูทูป (จัดการผ่านปลั๊กอิน "เฮาฮักพะเยา — แกลอรีและสื่อ")
   ========================================================================== */

/* --- แกลอรีภาพ --- */
.hhp-gallery-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
  gap:14px;
}
.hhp-gallery-item{
  padding:0; border:none; background:none; cursor:pointer;
  border-radius:14px; overflow:hidden; aspect-ratio:1/1;
  box-shadow:0 8px 20px -12px rgba(18,51,95,.3);
  transition:transform .25s ease, box-shadow .25s ease;
}
.hhp-gallery-item:hover{ transform:translateY(-3px); box-shadow:var(--shadow-soft); }
.hhp-gallery-item img{
  width:100%; height:100%; object-fit:cover; display:block;
}

.hhp-lightbox{
  position:fixed; inset:0; z-index:200;
  background:rgba(18,51,95,.92);
  display:flex; align-items:center; justify-content:center;
  opacity:0; visibility:hidden; transition:opacity .25s ease;
  padding:40px;
}
.hhp-lightbox.is-open{ opacity:1; visibility:visible; }
.hhp-lightbox figure{ margin:0; max-width:90vw; max-height:85vh; text-align:center; }
.hhp-lightbox img{
  max-width:100%; max-height:75vh; border-radius:10px;
  box-shadow:0 30px 80px rgba(0,0,0,.5);
}
.hhp-lightbox figcaption{
  color:#fff; font-family:var(--font-body); font-size:14px;
  margin-top:14px; opacity:.85;
}
.hhp-lightbox-close, .hhp-lightbox-nav{
  position:absolute; background:rgba(255,255,255,.12); color:#fff;
  border:none; border-radius:50%; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .2s ease;
}
.hhp-lightbox-close:hover, .hhp-lightbox-nav:hover{ background:rgba(255,255,255,.24); }
.hhp-lightbox-close{
  top:24px; right:24px; width:44px; height:44px; font-size:26px; line-height:1;
}
.hhp-lightbox-nav{
  top:50%; transform:translateY(-50%); width:52px; height:52px; font-size:30px;
}
.hhp-lightbox-prev{ left:20px; }
.hhp-lightbox-next{ right:20px; }
@media (max-width:640px){
  .hhp-lightbox{ padding:16px; }
  .hhp-lightbox-nav{ width:40px; height:40px; font-size:22px; }
  .hhp-lightbox-prev{ left:6px; }
  .hhp-lightbox-next{ right:6px; }
}

/* --- เสียง / คลิปยูทูป --- */
.hhp-media-grid{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));
  gap:26px;
}
.hhp-media-card{
  background:#fff; border-radius:var(--radius-md);
  border:1px solid rgba(18,51,95,.08); overflow:hidden;
  box-shadow:0 10px 26px -18px rgba(18,51,95,.35);
}
.hhp-media-card h3{
  font-size:16.5px; margin:16px 20px 4px;
}
.hhp-media-card p{
  font-size:14px; color:var(--phy-ink-soft); margin:0 20px 18px;
}
.hhp-media-video{ position:relative; width:100%; aspect-ratio:16/9; background:#0c1c33; }
.hhp-media-video iframe{ position:absolute; inset:0; width:100%; height:100%; border:0; }
.hhp-media-audio{
  display:flex; align-items:center; gap:14px;
  padding:22px 20px 6px;
}
.hhp-media-audio-icon{
  width:40px; height:40px; border-radius:50%; flex-shrink:0;
  background:var(--phy-rose-soft); color:var(--phy-rose);
  display:flex; align-items:center; justify-content:center; font-size:18px;
}
.hhp-media-audio audio{ width:100%; }

/* ==========================================================================
   COMMUNITY PARTICIPATION — forms, alerts, map, timeline
   (ส่งเรื่องเล่า / ปักหมุดแผนที่ความทรงจำ / เสนอเหตุการณ์เข้าเส้นเวลา)
   ========================================================================== */

.hhp-alert{
  margin:20px 0; padding:14px 18px; border-radius:12px; font-size:14.5px;
}
.hhp-alert-success{ background:#EAF6EE; color:#1E6B3A; border:1px solid #BFE6CB; }
.hhp-alert-error{ background:#FBEAEF; color:#8E1D45; border:1px solid #F2C4D3; }

.hhp-form{
  margin-top:28px; background:#fff; border-radius:var(--radius-lg);
  padding:32px; border:1px solid rgba(18,51,95,.08); box-shadow:var(--shadow-soft);
}
.hhp-field{ margin-bottom:20px; }
.hhp-field-row{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:560px){ .hhp-field-row{ grid-template-columns:1fr; } }
.hhp-field label{
  display:block; font-family:var(--font-display); font-weight:500;
  font-size:14.5px; color:var(--phy-blue-deep); margin-bottom:8px;
}
.hhp-field input[type="text"],
.hhp-field input[type="file"],
.hhp-field textarea{
  width:100%; font-family:var(--font-body); font-size:15px;
  padding:12px 14px; border-radius:10px;
  border:1px solid rgba(18,51,95,.18); background:var(--phy-cream);
  color:var(--phy-ink);
}
.hhp-field textarea{ resize:vertical; min-height:120px; }
.hhp-field input:focus, .hhp-field textarea:focus{
  outline:none; border-color:var(--phy-rose);
  box-shadow:0 0 0 3px rgba(176,53,110,.12);
}
.hhp-form button.btn{ border:none; cursor:pointer; }
.hhp-form-note{ margin-top:12px; font-size:13px; color:var(--phy-ink-soft); }

/* honeypot — ซ่อนจากคนจริง แต่บอทยังมองเห็นและมักจะกรอก */
.hhp-hp{ position:absolute; left:-9999px; top:-9999px; }

.hhp-field-row input[type="date"]{
  width:100%; font-family:var(--font-body); font-size:15px;
  padding:12px 14px; border-radius:10px;
  border:1px solid rgba(18,51,95,.18); background:var(--phy-cream);
  color:var(--phy-ink);
}
.hhp-field-row input[type="date"]:focus{
  outline:none; border-color:var(--phy-rose); box-shadow:0 0 0 3px rgba(176,53,110,.12);
}

/* --- ปฏิทินกิจกรรม --- */
.hhp-agenda-tabs{
  display:flex; gap:10px; margin-bottom:24px; flex-wrap:wrap;
}
.hhp-tab{
  font-family:var(--font-display); font-weight:500; font-size:14px;
  padding:10px 20px; border-radius:999px; border:1px solid rgba(18,51,95,.18);
  background:#fff; color:var(--phy-ink-soft); cursor:pointer;
  transition:all .2s ease;
}
.hhp-tab.is-active{
  background:var(--phy-blue-deep); border-color:var(--phy-blue-deep); color:#fff;
}
.hhp-tab:hover:not(.is-active){ border-color:var(--phy-rose); color:var(--phy-rose); }

.hhp-agenda-month{
  font-family:var(--font-display); font-size:15px; font-weight:600;
  color:var(--phy-rose); letter-spacing:.04em; margin:28px 0 14px;
  text-transform:uppercase;
}
.hhp-agenda-month:first-child{ margin-top:0; }

.hhp-event-card{
  display:grid; grid-template-columns:64px 1fr; gap:18px;
  background:#fff; border-radius:var(--radius-md);
  border:1px solid rgba(18,51,95,.08); padding:18px 20px; margin-bottom:14px;
}
.hhp-event-badge{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  background:var(--phy-blue-soft); border-radius:12px; padding:10px 4px; height:64px;
}
.hhp-event-badge .d{ font-family:var(--font-display); font-weight:700; font-size:22px; color:var(--phy-blue-deep); line-height:1; }
.hhp-event-badge .w{ font-size:11.5px; color:var(--phy-ink-soft); margin-top:4px; }
.hhp-event-body img{
  width:100%; max-height:180px; object-fit:cover; border-radius:10px; margin-bottom:10px;
}
.hhp-event-body h4{ font-family:var(--font-display); font-size:16.5px; color:var(--phy-blue-deep); margin:0 0 4px; }
.hhp-event-meta{ font-size:13px; color:var(--phy-rose); margin:0 0 6px; font-weight:500; }
.hhp-event-body p:not(.hhp-event-meta){ font-size:14.5px; color:var(--phy-ink-soft); margin:0; }

@media (max-width:560px){
  .hhp-event-card{ grid-template-columns:48px 1fr; gap:12px; }
  .hhp-event-badge{ height:48px; }
  .hhp-event-badge .d{ font-size:17px; }
}

/* --- แผนที่ความทรงจำ --- */
.hhp-map{
  width:100%; height:460px; border-radius:var(--radius-lg);
  border:1px solid rgba(18,51,95,.12); box-shadow:var(--shadow-soft);
  overflow:hidden;
}
.hhp-map-hint{
  margin-top:14px; text-align:center; font-size:14px; color:var(--phy-ink-soft);
}
.hhp-pin-popup{ font-family:var(--font-body); max-width:200px; }
.hhp-pin-popup strong{ font-family:var(--font-display); color:var(--phy-blue-deep); }
.hhp-pin-popup p{ margin:4px 0 0; font-size:13.5px; }

/* --- เส้นเวลา 50 ปี --- */
.hhp-timeline-rail{ margin-top:10px; }
.hhp-timeline-list{
  list-style:none; margin:0; padding:0;
  position:relative;
}
.hhp-timeline-list::before{
  content:''; position:absolute; left:70px; top:6px; bottom:6px; width:2px;
  background:linear-gradient(180deg, var(--phy-blue), var(--phy-rose));
}
.hhp-timeline-item{
  position:relative; display:grid;
  grid-template-columns:56px 28px 1fr; column-gap:14px;
  margin-bottom:28px;
}
.hhp-timeline-year{
  font-family:var(--font-display); font-weight:600; color:var(--phy-blue-deep);
  font-size:15px; text-align:right; padding-top:14px;
}
.hhp-timeline-dot{
  position:relative; display:flex; justify-content:center;
}
.hhp-timeline-dot::after{
  content:''; width:14px; height:14px; border-radius:50%;
  background:var(--phy-rose); border:3px solid var(--phy-cream);
  box-shadow:0 0 0 2px var(--phy-rose); margin-top:16px;
}
.hhp-timeline-card{
  background:#fff; border-radius:var(--radius-md);
  border:1px solid rgba(18,51,95,.08); padding:18px 20px;
}
.hhp-timeline-card img{
  width:100%; max-height:220px; object-fit:cover; border-radius:10px; margin-bottom:12px;
}
.hhp-timeline-card h3{ font-size:17px; margin-bottom:6px; }
.hhp-timeline-card p{ font-size:14.5px; color:var(--phy-ink-soft); margin:0; }

@media (max-width:640px){
  .hhp-timeline-list::before{ left:44px; }
  .hhp-timeline-item{ grid-template-columns:34px 20px 1fr; }
  .hhp-timeline-year{ font-size:13px; }
  .hhp-map{ height:340px; }
}

/* ==========================================================================
   SITE FOOTER
   ========================================================================== */
.site-footer{
  background:var(--phy-blue-deep); color:#fff;
  padding:56px 0 30px;
}
.site-footer a{ color:#fff; opacity:.85; }
.site-footer a:hover{ opacity:1; color:var(--phy-rose); }
.footer-grid{
  display:grid; grid-template-columns:1.4fr 1fr 1fr; gap:40px;
  padding-bottom:36px; border-bottom:1px solid rgba(255,255,255,.14);
}
.footer-grid h4{ color:#fff; font-size:15px; margin-bottom:14px; }
.footer-grid ul{ list-style:none; margin:0; padding:0; }
.footer-grid li{ margin-bottom:10px; font-size:14.5px; }
.footer-bottom{
  padding-top:22px; display:flex; justify-content:space-between;
  font-size:13px; opacity:.7; flex-wrap:wrap; gap:10px;
}
@media (max-width:760px){
  .footer-grid{ grid-template-columns:1fr; }
}
