/*
Theme Name: Ngam Jing Beauty
Theme URI: https://ngamjing.com
Description: Child theme for งามจริง บิวตี้ / Ngam Jing Beauty, Phra Khanong, Bangkok.
  Carries the Thai-first typography, palette and block patterns. Built so the recurring
  work is adding a post, never rearranging a layout.
Author: Tom Hopkins
Template: twentytwentyfive
Version: 0.1.0
Text Domain: ngamjing
Requires at least: 6.8
Tested up to: 7.0
*/

/* Thai-specific typographic correction.
   Thai stacks vowels and tone marks above and below the baseline, so the generous
   line-height set in theme.json is load-bearing, not taste. Thai also has no
   uppercase and no italic tradition, so nothing here may lean on text-transform
   or font-style for hierarchy - weight and size carry it instead. */
:lang(th) h1, :lang(th) h2, :lang(th) h3 { letter-spacing: 0; }

/* Placeholder slots. Deliberately visible: they read as designed, not broken,
   but no one could mistake one for finished content. */
.ngj-placeholder {
  /* Column, not row: each line separated by <br> becomes its own anonymous flex
     item, so a row direction lays the lines out side by side instead of stacked. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px dashed color-mix(in srgb, var(--wp--preset--color--primary) 45%, transparent);
  border-radius: 2px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--wp--preset--color--surface) 92%, transparent),
      color-mix(in srgb, var(--wp--preset--color--base) 92%, transparent));
  color: color-mix(in srgb, var(--wp--preset--color--contrast) 62%, transparent);
  font-size: var(--wp--preset--font-size--small);
  line-height: 1.7;
}
.ngj-placeholder::before {
  content: "";
  display: block;
  width: 0.8em;
  height: 0.8em;
  margin-bottom: 0.75em;
  border: 2px solid currentColor;
  border-radius: 1px;
  opacity: 0.55;
}
.ngj-placeholder--photo { aspect-ratio: 4 / 3; }
.ngj-placeholder--portrait { aspect-ratio: 3 / 4; }
.ngj-placeholder--wide { aspect-ratio: 16 / 9; }

/* Language switcher. Small, quiet, and always reachable in the header - the one
   visitor who needs it needs it immediately, and everyone else should not notice. */
.ngj-languages {
  display: inline-flex;
  gap: 0.15em;
  align-items: center;
  font-size: var(--wp--preset--font-size--small);
  letter-spacing: 0.02em;
}
.ngj-languages a { color: inherit; text-decoration: none; opacity: 0.6; }
.ngj-languages a:hover, .ngj-languages a:focus { opacity: 1; text-decoration: underline; }
.ngj-languages [aria-current] { font-weight: 600; }

/* Sticky booking button - phones only.
   Desktop already keeps a booking CTA in view as you scroll; a phone does not, and
   the whole point of the site is to produce a LINE message. The body gets matching
   bottom padding so the bar never sits on top of the last line of the footer. */
.ngj-book { display: none; }

@media (max-width: 781px) {
  .ngj-book {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.25rem;
    padding: 0 1.25rem;
    border-radius: 2px;
    background: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--white);
    font-family: var(--wp--preset--font-family--display);
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  }
  .ngj-book:hover, .ngj-book:focus { background: var(--wp--preset--color--contrast); color: #fff; }
  body { padding-bottom: 5rem; }
}

/* Before and after. A single frame split in two, so the eye compares rather than
   scans - two separate images side by side read as "two photos", not "one change". */
.ngj-ba .wp-block-columns { gap: 2px !important; }
.ngj-ba figure { margin: 0; }
.ngj-ba img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 4; }
.ngj-ba .ngj-ba-label {
  margin: 0.5rem 0 0;
  font-size: var(--wp--preset--font-size--small);
  letter-spacing: 0.18em;
  opacity: 0.65;
}

/* Mobile menu overlay.
   Core gives the overlay no colours of its own, so it fell back to black on white
   and inherited the desktop bar's right alignment, which pushed the Thai labels off
   the edge. Both have to be set explicitly. */
.wp-block-navigation__responsive-container.is-menu-open {
  background-color: var(--wp--preset--color--band) !important;
  color: var(--wp--preset--color--white) !important;
  padding: clamp(1.5rem, 6vw, 3rem);
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
  align-items: flex-start;
  justify-content: flex-start;
  /* The overlay's own padding does not reach the content container, so set it here. */
  padding: 4.5rem clamp(1.5rem, 7vw, 3rem) 3rem;
  width: 100%;
  box-sizing: border-box;
}
/* The nav keeps its desktop alignment class (items-justified-right) inside the
   overlay, which pushes Thai labels past the right edge. Override all four. */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list,
.wp-block-navigation__responsive-container.is-menu-open .items-justified-right,
.wp-block-navigation__responsive-container.is-menu-open .items-justified-center,
.wp-block-navigation__responsive-container.is-menu-open .items-justified-space-between {
  align-items: flex-start !important;
  justify-content: flex-start !important;
  text-align: left !important;
  gap: 1.1rem;
  width: 100%;
}
/* Each item is a COLUMN flex container, so its cross axis is horizontal and the
   inherited align-items:flex-end pushed every link hard against the right edge -
   which is what was clipping the Thai labels, not the container alignment. */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
  width: 100%;
  align-items: flex-start !important;
}
.wp-block-navigation__responsive-container.is-menu-open a {
  color: var(--wp--preset--color--white) !important;
  font-family: var(--wp--preset--font-family--display);
  font-size: 1.5rem;
  font-weight: 500;
  text-decoration: none;
}
.wp-block-navigation__responsive-container.is-menu-open .current-menu-item a {
  color: var(--wp--preset--color--primary) !important;
}
.wp-block-navigation__responsive-container-close { color: var(--wp--preset--color--white) !important; }

/* Sticky button hides itself while a real booking button is on screen - two LINE
   buttons stacked on the hero read as a mistake, because they are one. */
.ngj-book.is-hidden { opacity: 0; pointer-events: none; transform: translateY(120%); }
.ngj-book { transition: opacity .18s ease, transform .18s ease; }

/* Hero video sits exactly where the cover's image background sits, so the
   photograph underneath is both the poster frame and the fallback - if the video
   is skipped, blocked or still loading, the hero simply stays a photograph. */
.ngj-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .ngj-hero-video { display: none; }
}
/* No desktop rule any more: whether the clip plays is decided at runtime from its
   shape, not from the viewport width, and the script handles resizes. */

/* Desktop hero crop.
   The hero photograph is a vertical phone shot. A phone frame shows nearly all of
   it; a wide desktop hero takes a 1.86:1 slice, and a slice through the middle is
   just hair. Pulling the crop up to the crown keeps the head, the mirror and the
   room in frame, so it reads as someone in a salon rather than as texture.
   Phones are left alone - there the whole photograph is already visible. */
/* The hardcoded desktop crop is gone. It overrode the crop point with !important,
   so once Nat could drag the hero's crop herself, her choice was silently ignored
   on every computer - a setting that lies on half the devices is worse than none.
   One crop, chosen by her, applies everywhere. */

/* The map.
   Three branches need three pins, and a Google embed shows exactly one - so this
   is Leaflet over OpenStreetMap tiles, with every pin still linking out to Google
   Maps because that is what people navigate with. */
.ngj-map__canvas {
  height: 340px;
  border-radius: 2px;
  background: #efe9e3;
  z-index: 0; /* keeps Leaflet's panes under the sticky booking bar */
}
.ngj-pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--wp--preset--color--primary, #b0651f);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(22, 18, 15, .45);
}
/* An approximate pin says so rather than pretending: hollow, not solid. */
.ngj-pin.is-approx {
  background: #fff;
  color: #8a5a2b;
  box-shadow: 0 0 0 2px #b0651f, 0 1px 4px rgba(22, 18, 15, .35);
}
.ngj-map__note {
  margin: .5rem 0 0;
  font-size: .85rem;
  color: #8a807a;
}
.ngj-map__list {
  margin: .9rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: shop;
}
/* Three columns looked tidy in my head and collapsed on a 390px phone: the Thai
   shop name was squeezed into a column one character wide and set itself
   vertically. Number on the left, everything else stacked beside it. */
.ngj-map__list li {
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: .6rem;
  row-gap: .15rem;
  padding: .7rem 0;
  border-top: 1px solid rgba(22, 18, 15, .1);
}
.ngj-map__list li::before {
  counter-increment: shop;
  content: counter(shop);
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(176, 101, 31, .15);
  color: #8a5a2b;
  font-size: .8rem;
  font-weight: 600;
}
.ngj-map__list strong,
.ngj-map__list span,
.ngj-map__list a { grid-column: 2; }
.ngj-map__list span { color: #4a423e; font-size: .95rem; }
.ngj-map__list a { font-size: .9rem; justify-self: start; }
