/* responsive.css — loaded last on every public page. Global breakpoints + phone-friendliness fixes
   (bigger tap targets, readable Thai text, quick-contact bar). */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
}
/* quote form bot trap (index.php): off-screen, never shown to people */
.hp-field{position:absolute!important;left:-10000px!important;top:auto;width:1px;height:1px;overflow:hidden}
/* large monitors (1920px and up): a little wider so the side margins don't dominate */
@media (min-width: 1680px) {
  .container { max-width: 1440px; }
}

/* ── SEO headings kept visually quiet ──────────────────────────────────── */
/* Hero H1 lead line "รับสร้างบ้านภาคอีสาน · ขอนแก่น" */
.hero-title .line0{display:block;margin-bottom:14px;color:#E7C873;font-size:clamp(.82rem,1.15vw,.98rem);font-weight:500;letter-spacing:.06em;line-height:1.5;text-shadow:0 1px 10px rgba(0,0,0,.5)}
/* House page H1 lead line "แบบบ้าน 2 ชั้น 3 ห้องนอน 180 ตร.ม." */
.detail-h1-sub{display:block;margin-bottom:12px;color:var(--accent,#6b7a88);font-size:clamp(.95rem,1.3vw,1.1rem);font-weight:400;letter-spacing:0;line-height:1.5}
/* Server-rendered list of every house page (crawlable without JavaScript) */
.houses-index{margin-top:34px;padding-top:18px;border-top:1px solid var(--surface-border,#e5e7eb);font-size:.84rem}
.houses-index > summary{list-style:none;display:inline-flex;align-items:center;gap:8px;cursor:pointer;margin-bottom:8px}
.houses-index > summary::-webkit-details-marker{display:none}
.houses-index-label{color:var(--gray,#6B7280);font-weight:600}
.houses-index-count{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;padding:0 7px;border-radius:999px;background:rgba(10,46,78,.07);color:var(--deep-ocean,#0A2E4E);font-size:.72rem;font-weight:600}
.houses-index-links{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 18px}
.houses-index a{color:var(--deep-ocean,#0A2E4E);text-decoration:none;padding:4px 0}
.houses-index a:hover{text-decoration:underline}
.houses-index a small{color:var(--gray,#6B7280);font-size:.78rem}
/* phones: folded by default (index.php), opens into a compact two-column grid */
@media (max-width: 600px){
  .houses-index > summary{display:flex;justify-content:space-between;width:100%;min-height:48px;margin:0}
  .houses-index > summary::after{content:'';width:8px;height:8px;margin:0 4px 4px auto;border-right:1.5px solid var(--gray,#6B7280);border-bottom:1.5px solid var(--gray,#6B7280);transform:rotate(45deg);transition:transform .2s}
  .houses-index[open] > summary::after{transform:rotate(-135deg);margin-bottom:-4px}
  .houses-index-count{margin-left:8px}
  .houses-index > summary .houses-index-label{flex:0 0 auto}
  .houses-index-links{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:6px 0 4px}
  .houses-index a{display:flex;flex-direction:column;justify-content:center;gap:1px;min-height:52px;padding:8px 12px;border:1px solid var(--surface-border,#e5e7eb);border-radius:4px;background:#fff;font-weight:600}
  .houses-index a small{font-weight:400;font-size:.74rem}
}

/* ── Quick-contact bar (phones & small tablets) ─────────────────────────── */
.m-cta{display:none}
@media (max-width: 900px){
  .m-cta{
    position:fixed;left:0;right:0;bottom:0;z-index:95;
    display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:8px;
    padding:8px 10px calc(8px + env(safe-area-inset-bottom));
    background:rgba(255,255,255,.96);border-top:1px solid var(--surface-border,#e5e7eb);
    box-shadow:0 -6px 24px rgba(10,46,78,.08);backdrop-filter:blur(10px);
  }
  .m-cta-btn{
    display:flex;align-items:center;justify-content:center;gap:7px;min-height:48px;padding:0 8px;
    border:1px solid var(--surface-border,#dfe3e8);border-radius:6px;background:#fff;
    color:var(--deep-ocean,#0A2E4E);font-size:.9rem;font-weight:600;white-space:nowrap;
  }
  .m-cta-btn svg{width:19px;height:19px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  .m-cta-line{border-color:#06C755;color:#06893c}
  .m-cta-primary{background:var(--deep-ocean,#0A2E4E);border-color:var(--deep-ocean,#0A2E4E);color:#fff}
  /* keep page content (and the footer) clear of the bar */
  body{padding-bottom:calc(66px + env(safe-area-inset-bottom))}
  /* the full-screen hero ends behind the bar — lift its buttons and slide dots above it */
  #hero .hero-content{padding-bottom:calc(120px + env(safe-area-inset-bottom))}
  #hero .slide-dots{bottom:calc(90px + env(safe-area-inset-bottom))}
  #toast{bottom:calc(84px + env(safe-area-inset-bottom));right:12px;left:12px;text-align:center}
  /* never cover pop-ups, the open menu, or the compare bar */
  body:has(#modal-overlay.open) .m-cta,
  body:has(#portfolio-modal-overlay.open) .m-cta,
  body:has(#compare-overlay.open) .m-cta,
  body:has(#compare-picker-overlay.open) .m-cta,
  body:has(#compare-bar.visible) .m-cta,
  body:has(#navbar.menu-open) .m-cta{display:none}
}

/* ── Phone readability & tap targets ────────────────────────────────────── */
@media (max-width: 600px){
  /* Thai text below ~12px is hard to read on a phone */
  .maslow-level-name{font-size:.68rem;letter-spacing:.12em}
  .portfolio-overlay-title{font-size:.8rem}
  .portfolio-overlay-loc{font-size:.72rem}
  .editorial-journal-meta{font-size:.72rem}
  .editorial-card-link{font-size:.8rem}

  /* The three promises under "ออกแบบบ้านได้ตามใจคุณ": one per row, comfortable size */
  .editorial-trust-grid{grid-template-columns:1fr}
  .editorial-trust-item,.editorial-trust-item:first-child{padding:22px 4px}
  .editorial-trust-item+ .editorial-trust-item{border-left:0;border-top:1px solid var(--surface-border,#e5e7eb)}
  .editorial-trust-item:nth-child(3){grid-column:auto}
  .editorial-trust-item h3{font-size:1.02rem}
  .editorial-trust-item p{font-size:.88rem;line-height:1.7}

  /* Text links get a finger-sized hit area */
  .editorial-arrow-link{min-height:44px;font-size:.84rem}
  .house-card-seo-link{display:inline-flex;align-items:center;min-height:44px}

  /* Phone numbers become separate, easy-to-tap buttons */
  .contact-phones{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .contact-phones a{
    display:flex;align-items:center;justify-content:center;min-height:46px;padding:0 10px;
    border:1px solid var(--surface-border,#dfe3e8);border-radius:999px;background:#fff;
    color:var(--deep-ocean,#0A2E4E);font-size:.92rem;font-weight:600;
  }
  .contact-val a[href^="mailto:"]{display:inline-flex;align-items:center;min-height:44px}
}

/* ── "How it works": swipe sideways instead of five tall cards ─────────── */
@media (max-width: 700px){
  .steps-row{
    grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:78%;
    gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;
    margin-left:-16px;margin-right:-16px;padding:2px 16px 14px;scrollbar-width:thin;
  }
  .step-card{scroll-snap-align:start}
  .step-img-wrap{height:150px}
}

/* ── Maslow: larger list text, "เราตอบด้วย:" label, Thai pyramid names on phones ── */
.pyr-name-th{display:none;font-family:'Prompt',sans-serif;text-anchor:middle;fill:var(--deep-ocean,#0A2E4E);font-weight:500}
.maslow-answer-label{font-weight:600;color:var(--deep-ocean,#0A2E4E)}
.maslow-level-name{font-size:.72rem;letter-spacing:.14em}
.maslow-heading{font-size:1.04rem}
.maslow-answer{font-size:.92rem;line-height:1.65}
@media (min-width: 1001px){
  .maslow-num{font-size:1.6rem}
  .maslow-level-name{font-size:.72rem;letter-spacing:.14em}
  .maslow-heading{margin:5px 0 3px;font-size:1.04rem}
  .maslow-answer{font-size:.92rem;line-height:1.6}
}
@media (max-width: 600px){
  .pyr-no,.pyr-name{display:none}
  .pyr-name-th{display:inline;font-size:27px}
  .maslow-level-name{font-size:.74rem;letter-spacing:.1em}
  .maslow-heading{font-size:1.06rem}
  .maslow-answer{font-size:.94rem}
}

/* ── House pop-up ───────────────────────────────────────────────────────── */
.img-viewer{touch-action:none} /* the viewer handles pinch/drag itself (modal.js) */
@media (max-width: 600px){
  .modal-close{width:44px;height:44px;top:8px;right:8px;font-size:1.2rem;z-index:12;box-shadow:0 2px 10px rgba(0,0,0,.12)}
  .img-btn{min-height:40px;padding:8px 14px}
  .thumb{width:76px;height:57px}
}

/* ── House detail page: show the house first on phones ──────────────────── */
@media (max-width: 900px){
  .house-detail-hero .detail-main-image{order:-1}
  .house-detail-hero .detail-main-image img{aspect-ratio:4/3}
  .house-detail-hero .detail-copy{padding:26px 0 44px}
}

/* ── Portfolio project page + province (area) page ─────────────────────── */
.detail-project-desc{margin:0 0 28px;color:#4b5660;font-size:1rem;line-height:1.85}
/* Upright photos (frames from phone videos): 3:4 tiles, three across, no stretched feature image */
.detail-gallery.detail-gallery--portrait{grid-template-columns:repeat(3,minmax(0,1fr));max-width:1380px}
.detail-gallery.detail-gallery--portrait img,
.detail-gallery.detail-gallery--portrait img:first-child:nth-last-child(odd){grid-column:auto;aspect-ratio:3/4;object-position:center 45%}
@media (max-width: 600px){
  .detail-gallery.detail-gallery--portrait{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
}
.area-intro{max-width:920px;padding-top:40px}
.area-intro h1{margin:0 0 28px;color:var(--deep-ocean);font-size:clamp(2.3rem,4.6vw,4.2rem);font-weight:300;line-height:1.13;letter-spacing:-.04em}
.area-intro > p{margin:0 0 18px;color:#4b5660;font-size:1.02rem;line-height:1.9}
.area-facts{display:flex;flex-wrap:wrap;gap:0;margin:30px 0;border-top:1px solid var(--surface-border);border-bottom:1px solid var(--surface-border)}
.area-facts div{flex:1 1 160px;padding:16px 16px 16px 0}
.area-facts strong{display:block;font-size:1.3rem;font-weight:400;color:var(--deep-ocean)}
.area-facts span{display:block;margin-top:3px;color:#8a939b;font-size:.74rem}
.area-intro .detail-primary-btn{display:inline-block}
.footer-areas{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 14px;margin:0 0 .7rem;font-size:.8rem;color:rgba(255,255,255,.6)}
.footer-areas a{color:rgba(255,255,255,.82);text-decoration:none}
.footer-areas a:hover{color:#fff;text-decoration:underline}
@media (max-width: 600px){
  .area-intro{padding-top:8px}
  .area-intro h1{font-size:2.3rem}
}

/* ── Phones: nothing below 12px, and every link/button big enough for a thumb (≈44px) ──
   "html body" lifts these just above the page rules they correct; the look stays the same,
   only tiny labels grow and tap areas get invisible padding. */
@media (max-width: 600px){
  html body :is(.section-label,.editorial-kicker,.tips-kicker,.tip-tag,.detail-kicker,.detail-section-heading p,
    .article-meta,.editorial-journal-meta,.maslow-level-name,.filter-group label,.contact-label,.form-notice,
    .tips-hero-author span,.lang-btn,.detail-cta p,.detail-breadcrumb,.detail-breadcrumb a,.detail-breadcrumb span,.breadcrumb a,.breadcrumb span,
    .detail-related-card small,.detail-related-card em,.detail-spec-grid span,footer p,footer a,.footer-areas span){font-size:12px!important}
  html body .section-label,html body .editorial-kicker,html body .tips-kicker{letter-spacing:.12em}

  /* tap areas */
  html body :is(.detail-breadcrumb,.breadcrumb) a{display:inline-flex;align-items:center;min-height:44px}
  html body .detail-breadcrumb{padding-top:6px;padding-bottom:6px}
  html body .tip-read-more{min-height:44px;padding-bottom:0}
  html body .video-card-link{min-height:44px}
  html body .houses-index a{min-height:44px}
  html body .editorial-journal-card h3 a,html body .tip-title a{display:inline-block;padding:6px 0}
  html body .lang-btn{min-width:40px;min-height:40px}
  html body footer a{display:inline-flex;align-items:center;min-height:40px}
}
/* Desktop menu links: taller click area, same look */
@media (min-width: 901px){
  html body .nav-link{padding-top:11px;padding-bottom:11px}
}