/* ============================================================================
   web-04 · บ้านร่มไม้ ดีไซน์ แอนด์ บิลด์

   Concept: homeowners are afraid of two things — the budget running away, and
   the work not matching the drawing. So the site is laid out like a set of shop
   drawings: a sheet number in the corner, a faint plotting grid behind
   everything, dimension lines drawn over the photographs, and real figures
   against every line item. Charcoal + kraft + heavy condensed type — the default
   contractor look — is avoided; the ground is lime plaster and the accent is
   the safety orange actually worn on site.

   Signature: the dimension line (.dim). Every number on it is the real
   measurement of the thing in the photograph. If it were decorative it would be
   cut.
   ============================================================================ */

:root {
  --plaster: #E4E0D6;
  --plaster-2: #D5D0C3;
  --ink: #191917;
  --safety: #FF5B25;
  --teak: #7A4A2B;
  --rule: #A9A497;

  --container: 1180px;
  --pad: clamp(20px, 5vw, 48px);
  --gap: clamp(72px, 9vw, 120px);
}

body {
  background: var(--plaster);
  color: var(--ink);
  font-family: 'IBM Plex Sans Thai', system-ui, sans-serif;
  line-height: 1.8;
  /* the plotting grid: the paper the whole site is drawn on */
  background-image: radial-gradient(var(--rule) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: var(--plaster); opacity: .78; pointer-events: none;
}

.mono, .num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: 'Bai Jamjuree', system-ui, sans-serif; font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.625rem, 3vw, 2.25rem); }

.wrap { max-width: var(--container); margin-inline: auto; padding-inline: var(--pad); }
.section { padding-block: var(--gap); position: relative; }
.section--alt { background: var(--plaster-2); }
.section--dark { background: var(--ink); color: var(--plaster); }
.lede { color: rgba(25,25,23,.72); max-width: 56ch; }
.section--dark .lede { color: rgba(228,224,214,.75); }
.tick { width: 40px; height: 3px; background: var(--safety); border: 0; margin: 0 0 20px; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.section--dark :focus-visible { outline-color: var(--safety); }

/* sheet number, top right of each section — real in a drawing set, so structure not ornament */
.sheet { position: absolute; top: 20px; right: var(--pad); font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--rule); }
@media (max-width: 860px) { .sheet { display: none; } }

/* -- buttons ---------------------------------------------------------------- */
.btn { display: inline-block; padding: 15px 30px; border-radius: 0; text-decoration: none; font-weight: 600; transition: background .2s, color .2s; }
.btn--primary { background: var(--safety); color: var(--ink); }
.btn--primary:hover { background: #e64f1f; }
.btn--dark { background: var(--ink); color: var(--plaster); }
.btn--ghost { border: 1px solid currentColor; }
.btn--ghost:hover { background: var(--ink); color: var(--plaster); border-color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* -- header ------------------------------------------------------------------ */
.header { position: sticky; top: 0; z-index: 30; background: var(--plaster); border-bottom: 1px solid var(--rule); }
.header__inner { max-width: var(--container); margin-inline: auto; padding: 12px var(--pad); display: flex; align-items: center; gap: 24px; }
.brand { font-family: 'Bai Jamjuree', sans-serif; font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.header__sheet { margin-left: auto; color: var(--rule); font-size: .75rem; }
.nav { display: flex; gap: 20px; margin-left: 20px; }
.nav__link { text-decoration: none; font-size: .9375rem; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav__link.is-active { color: var(--safety); border-bottom-color: var(--safety); }
.nav__link:hover { color: var(--safety); }
.burger { display: none; flex-direction: column; gap: 5px; padding: 8px; margin-left: auto; }
.burger span { display: block; width: 22px; height: 2px; background: var(--ink); }
@media (max-width: 900px) {
  .burger { display: flex; } .header__sheet { display: none; }
  .nav { position: fixed; inset: 0; z-index: 40; flex-direction: column; justify-content: center; align-items: center; gap: 26px; margin: 0; background: var(--plaster); transform: translateY(-100%); transition: transform .3s; }
  .nav.is-open { transform: none; }
  .nav__link { font-size: 1.25rem; }
  body.nav-open { overflow: hidden; }
}

/* -- SIGNATURE: dimension lines over a photograph ------------------------------ */
.shot { position: relative; overflow: hidden; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dim { position: absolute; pointer-events: none; }
.dim__line { position: absolute; background: var(--safety); }
/* horizontal: a rule with a tick at each end — Thai drawings use ticks, not arrowheads */
.dim--h { left: var(--x1); right: var(--x2); bottom: var(--y, 8%); height: 12px; }
.dim--h .dim__line { top: 5px; left: 0; right: 0; height: 1px; transform-origin: left; }
.dim--h::before, .dim--h::after { content: ''; position: absolute; top: 0; width: 1px; height: 12px; background: var(--safety); }
.dim--h::before { left: 0; } .dim--h::after { right: 0; }
/* vertical */
.dim--v { top: var(--y1); bottom: var(--y2); right: var(--x, 8%); width: 12px; }
.dim--v .dim__line { left: 5px; top: 0; bottom: 0; width: 1px; transform-origin: top; }
.dim--v::before, .dim--v::after { content: ''; position: absolute; left: 0; height: 1px; width: 12px; background: var(--safety); }
.dim--v::before { top: 0; } .dim--v::after { bottom: 0; }

.dim__label {
  position: absolute; font-family: 'IBM Plex Mono', monospace; font-size: .75rem;
  color: var(--safety); background: var(--plaster); padding: 1px 5px; white-space: nowrap;
}
.dim--h .dim__label { left: 50%; top: -10px; transform: translateX(-50%); }
.dim--v .dim__label { top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-90deg); }

/* the rule draws itself from one tick to the other, once */
.is-armed .dim--h .dim__line, .is-armed .dim--v .dim__line { transform: scale(0); }
.is-drawn .dim--h .dim__line { transform: scaleX(1); transition: transform .5s ease-out; }
.is-drawn .dim--v .dim__line { transform: scaleY(1); transition: transform .5s ease-out; }
.is-armed .dim__label { opacity: 0; }
.is-drawn .dim__label { opacity: 1; transition: opacity .3s .35s; }
@media (prefers-reduced-motion: reduce) {
  .is-armed .dim__line { transform: none; } .is-armed .dim__label { opacity: 1; }
}
@media (max-width: 640px) { .dim--v { display: none; } }

/* -- hero ---------------------------------------------------------------------- */
.hero__shot { height: min(76vh, 700px); }
.hero__tag { position: absolute; left: 0; bottom: 0; background: var(--ink); color: var(--plaster); font-family: 'IBM Plex Mono', monospace; font-size: .75rem; padding: 8px 14px; }
.hero__text { padding-top: 40px; }
.stats { display: flex; flex-wrap: wrap; margin-top: 36px; border-top: 1px solid var(--rule); }
.stats__item { padding: 18px 28px 18px 0; margin-right: 28px; border-right: 1px solid var(--rule); }
.stats__item:last-child { border-right: 0; }
.stats__n { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 1.75rem; color: var(--safety); }
.stats__label { font-size: .875rem; color: rgba(25,25,23,.65); }

/* -- BOQ-style tables ------------------------------------------------------------ */
.boq { width: 100%; max-width: 980px; margin-top: 36px; font-size: .9375rem; }
.boq thead th { font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--rule); font-weight: 400; padding-bottom: 8px; text-align: left; }
.boq th, .boq td { padding: 16px 20px 16px 0; border-top: 1px solid var(--rule); vertical-align: top; }
.boq tbody tr:last-child td, .boq tbody tr:last-child th { border-bottom: 1px solid var(--rule); }
.boq tbody tr:hover { background: var(--plaster-2); }
.boq .is-name { font-family: 'Bai Jamjuree', sans-serif; font-weight: 600; font-size: 1.0625rem; }
.boq .is-num { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.boq .is-desc { color: rgba(25,25,23,.7); }
@media (max-width: 860px) {
  .boq thead { display: none; }
  .boq, .boq tbody, .boq tr, .boq th, .boq td { display: block; width: auto; }
  .boq tr { padding: 16px 0; border-top: 1px solid var(--rule); }
  .boq th, .boq td { padding: 0; border: 0; }
  .boq .is-num { text-align: left; }
}

/* -- process rail ------------------------------------------------------------------ */
.steps { max-width: 940px; margin-top: 40px; border-left: 1px solid var(--rule); }
.step { position: relative; display: grid; grid-template-columns: .9fr .7fr 2.4fr; gap: 24px; padding: 26px 0 26px 32px; }
.step::before { content: ''; position: absolute; left: 0; top: 42px; width: 12px; height: 1px; background: var(--rule); }
.step + .step { border-top: 1px solid var(--rule); }
.step__n { position: absolute; left: -12px; top: 26px; font-family: 'IBM Plex Mono', monospace; font-size: 1.5rem; color: var(--safety); background: var(--plaster); padding-block: 2px; }
.section--alt .step__n { background: var(--plaster-2); }
.step h3 { font-size: 1.0625rem; }
.step__cost { font-family: 'IBM Plex Mono', monospace; font-size: .9375rem; }
.step__cost .free { color: var(--safety); }
.step p { color: rgba(25,25,23,.72); font-size: .9375rem; }
@media (max-width: 800px) { .step { grid-template-columns: 1fr; gap: 8px; } }

/* -- project cards -------------------------------------------------------------------- */
.projects { display: grid; grid-template-columns: repeat(3,1fr); gap: 32px; margin-top: 44px; }
@media (max-width: 900px) { .projects { grid-template-columns: 1fr; max-width: 480px; } }
.project__shot { aspect-ratio: 4/3; }
.project h3 { font-size: 1.125rem; margin-top: 14px; }
.project__where { font-family: 'IBM Plex Mono', monospace; font-size: .8125rem; color: var(--rule); }
.project__nums { font-family: 'IBM Plex Mono', monospace; font-size: .875rem; color: var(--safety); margin-top: 4px; }
.project p { color: rgba(25,25,23,.7); font-size: .9375rem; max-width: 34ch; margin-top: 8px; }

/* -- SIGNATURE 2: before/after comparison slider ----------------------------------- */
/* The range input is the control — visually hidden but fully operable, so arrow keys work
   and screen readers announce it. The visuals are driven from --pos, which JS mirrors. */
.ba { position: relative; --pos: 50%; }
.ba__frame { position: relative; overflow: hidden; aspect-ratio: 3/2; }
.ba__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); z-index: 2; }
.ba__handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: var(--safety); z-index: 3; pointer-events: none; }
.ba__handle::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 32px; height: 32px; border-radius: 50%; background: var(--safety); border: 2px solid var(--plaster);
}
.ba__tag { position: absolute; top: 10px; z-index: 4; background: var(--ink); color: var(--plaster); font-family: 'IBM Plex Mono', monospace; font-size: .6875rem; padding: 4px 8px; }
.ba__tag--before { left: 10px; } .ba__tag--after { right: 10px; }
.ba__range { position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.ba__range:focus-visible + .ba__handle::after { outline: 3px solid var(--ink); outline-offset: 2px; }

.case { max-width: 1040px; margin-inline: auto; }
.case + .case { margin-top: 88px; }
.case h3 { font-size: 1.25rem; margin-top: 18px; }
.case__where { font-family: 'IBM Plex Mono', monospace; font-size: .8125rem; color: var(--rule); }
.case__nums { font-family: 'IBM Plex Mono', monospace; font-size: .9375rem; color: var(--safety); margin-top: 4px; }
.case p { max-width: 62ch; color: rgba(25,25,23,.75); margin-top: 10px; }

/* -- warning box, borrowed from a real site sign -------------------------------------- */
.warn { position: relative; background: var(--ink); color: var(--plaster); padding: 24px 24px 24px 34px; margin-top: 32px; max-width: 900px; }
.warn::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 10px;
  background: repeating-linear-gradient(45deg, #FFC93C 0 8px, var(--ink) 8px 16px);
}
.warn p { max-width: 68ch; }
.warn .num { color: var(--safety); }

/* -- reject list ----------------------------------------------------------------------- */
.rejects { display: grid; grid-template-columns: repeat(3,1fr); gap: 32px; margin-top: 40px; }
@media (max-width: 860px) { .rejects { grid-template-columns: 1fr; } }
.reject h3 { font-size: 1.0625rem; margin: 12px 0 6px; }
.reject p { color: rgba(25,25,23,.72); font-size: .9375rem; max-width: 32ch; }
.reject__x { width: 24px; height: 24px; }

/* -- queue / service-area bars ----------------------------------------------------------- */
.qbar { margin-top: 8px; }
.qbar__track { height: 8px; background: rgba(25,25,23,.1); }
.qbar__fill { height: 100%; background: var(--safety); width: var(--w); }
.qrow { padding: 16px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: baseline; }
.qrow:last-child { border-bottom: 1px solid var(--rule); }
.qrow .is-num { font-family: 'IBM Plex Mono', monospace; }
.qrow .qbar { grid-column: 1 / -1; }

/* -- contact --------------------------------------------------------------------------- */
.two-col { display: grid; grid-template-columns: 46fr 54fr; gap: clamp(28px,4vw,56px); align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .two-col > .is-map { order: -1; } }
.locator { width: 100%; border: 1px solid var(--rule); display: block; }
.dl__row { padding: 14px 0; border-top: 1px solid var(--rule); }
.dl__row:last-child { border-bottom: 1px solid var(--rule); }
.dl__label { font-family: 'IBM Plex Mono', monospace; font-size: .75rem; color: var(--safety); }
.hours { max-width: 520px; margin-top: 20px; }
.hours tr { border-top: 1px solid var(--rule); }
.hours tr:last-child { border-bottom: 1px solid var(--rule); }
.hours th, .hours td { padding: 12px 0; font-weight: 400; }
.hours td { text-align: right; font-family: 'IBM Plex Mono', monospace; }
.hours tr.is-today th { font-weight: 600; }

/* -- CTA band with hazard edges ------------------------------------------------------------ */
.band { background: var(--safety); color: var(--ink); padding-block: clamp(48px,6vw,80px); position: relative; text-align: center; }
.band::before, .band::after {
  content: ''; position: absolute; left: 0; right: 0; height: 8px;
  background: repeating-linear-gradient(45deg, #FFC93C 0 10px, var(--ink) 10px 20px);
}
.band::before { top: 0; } .band::after { bottom: 0; }
.band .btn-row { justify-content: center; }
.band .btn--dark { background: var(--ink); color: var(--plaster); }
.band .btn--ghost { border-color: var(--ink); }

/* -- footer ---------------------------------------------------------------------------------- */
.footer { background: var(--ink); color: var(--plaster); padding-block: 56px 28px; }
.footer__grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 32px; font-size: .9375rem; color: rgba(228,224,214,.72); }
@media (max-width: 800px) { .footer__grid { grid-template-columns: 1fr; } }
.footer__brand { font-family: 'Bai Jamjuree', sans-serif; font-weight: 700; color: var(--plaster); margin-bottom: 8px; }
.footer__label { font-size: .8125rem; color: var(--safety); margin-bottom: 6px; }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer__note { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(228,224,214,.2); font-size: .8125rem; }

/* -- mobile bar ------------------------------------------------------------------------------- */
.mobilebar { display: none; }
@media (max-width: 640px) {
  .mobilebar { display: grid; grid-template-columns: auto 1fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--safety); }
  .mobilebar .btn { padding: 12px 16px; text-align: center; font-size: .9375rem; }
  body { padding-bottom: 72px; }
}
