/* ============================================================
   Header, nav, footer, floating contact dock
   ============================================================ */

/* -- Header -------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-med) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out);
}
.site-header.is-stuck {
  border-bottom-color: var(--rule);
  box-shadow: 0 1px 20px rgb(43 39 36 / 0.04);
}

.site-header__inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

/* Stacked wordmark: wide-tracked name over a smaller descriptor. */
.brand {
  display: grid;
  gap: 0.2rem;
  line-height: 1;
  white-space: nowrap;
}
/* Hangul is already dense, so the wordmark tracks much tighter than
   the Latin descender line under it. */
.brand__name {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.375rem;
  letter-spacing: 0.08em;
}
:root:lang(en) .brand__name,
:root:lang(vi) .brand__name { letter-spacing: 0.24em; font-size: 1.25rem; }

.brand__sub {
  font-size: 0.5rem;
  letter-spacing: 0.26em;
  color: var(--accent-text);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 1.8vw, 2rem);
}
/* Short Korean labels ("홈", "저널") are only ~13px wide on their own.
   The min box keeps every nav item a 24px target without changing how
   any of them look. */
.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-80);
  padding-block: 0.4rem;
  transition: color var(--dur-fast);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width var(--dur-med) var(--ease-out);
}
.nav__link:hover { color: var(--ink); }
.nav__link:hover::after,
.nav__link[aria-current="page"]::after { width: 100%; }
.nav__link[aria-current="page"] { color: var(--ink); }

.header__actions { display: flex; align-items: center; gap: var(--space-lg); }

.langs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
}
/* --ink-40 reads as "inactive" but only clears 2.9:1 at this size. */
.langs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
  color: var(--ink-60);
  transition: color var(--dur-fast);
}
.langs a:hover { color: var(--ink); }
.langs a[aria-current="true"] { color: var(--ink); font-weight: 600; }
/* aria-hidden punctuation is exempt from 1.4.3, but at --ink-40 it was
   also just hard to see. Matching the inactive links costs nothing. */
.langs span[aria-hidden] { color: var(--ink-60); }

.nav-toggle {
  display: none;
  /* flex:none or the flex parent shrinks this below the 44px
     minimum tap target. */
  flex: none;
  width: 2.75rem; height: 2.75rem;
  margin-right: -0.75rem;
  place-items: center;
}
.nav-toggle__bars { display: block; width: 22px; height: 10px; position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--dur-med) var(--ease-out);
}
.nav-toggle__bars::before { top: 0; }
.nav-toggle__bars::after  { bottom: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(4.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after  { transform: translateY(-4.25px) rotate(-45deg); }

/* The nav collapses early: six items plus the locale switcher and a
   button need real room before they stop being a single clean line. */
@media (max-width: 68rem) {
  .nav, .header__actions .langs { display: none; }
  .nav-toggle { display: grid; }
}
@media (max-width: 30rem) {
  .header__actions .btn--outline { display: none; }
}

/* -- Mobile drawer ------------------------------------------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--coal);
  color: var(--paper);
  padding: var(--header-h) var(--gutter) var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xl);
  opacity: 0;
  transform: translateY(-1rem);
  transition: opacity var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out);
}
.drawer.is-open { opacity: 1; transform: none; }
/* The [hidden] attribute is what actually takes the drawer out of the
   page - display:flex above would otherwise beat the UA rule. Keeping
   visibility out of it matters: a transitioning `visibility: hidden`
   makes the first link unfocusable at the moment the menu opens. */
.drawer[hidden] { display: none; }

.drawer__nav { display: flex; flex-direction: column; gap: var(--space-sm); }
.drawer__nav a {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 8vw, 2.75rem);
  line-height: 1.2;
}
.drawer__nav a[aria-current="page"] { color: var(--accent-dark); }

.drawer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid rgb(255 255 255 / 0.18);
  font-size: var(--fs-small);
}
/* Without a floor this inherits its height from the line box, which
   makes the tap target depend on the locale's line-height - Korean
   cleared 24px and the other two did not. */
.drawer__meta a[href^="tel"] {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.drawer .langs a { color: rgb(255 255 255 / 0.55); }
.drawer .langs a:hover,
.drawer .langs a[aria-current="true"] { color: var(--paper); }
.drawer .langs span[aria-hidden] { color: rgb(255 255 255 / 0.3); }

body.is-locked { overflow: hidden; }

/* -- Floating contact dock ----------------------------------- */

/* Vietnamese clients reach for Zalo, Korean clients for KakaoTalk.
   Both have to be one thumb-tap away at any scroll depth. */
.dock {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: var(--z-float);
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: var(--space-sm);
}

.dock__toggle {
  width: 3.25rem; height: 3.25rem;
  display: grid; place-items: center;
  background: var(--coal);
  color: var(--paper);
  border-radius: 50%;
  box-shadow: 0 6px 24px rgb(43 39 36 / 0.26);
  transition: background var(--dur-fast), transform var(--dur-med) var(--ease-out);
}
.dock__toggle:hover { background: var(--accent-text); }
.dock__toggle[aria-expanded="true"] { transform: rotate(45deg); }

.dock__items {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out),
              visibility var(--dur-med);
}
.dock__items.is-open { opacity: 1; visibility: visible; transform: none; }
/* Closed dock links must leave the tab order, not just fade out. */
.dock__items:not(.is-open) a { pointer-events: none; }

.dock__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.55rem 1rem 0.55rem 0.55rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  font-size: var(--fs-small);
  white-space: nowrap;
  box-shadow: 0 4px 18px rgb(43 39 36 / 0.14);
  transition: transform var(--dur-fast) var(--ease-out);
}
.dock__item:hover { transform: translateX(-3px); }
.dock__item svg { flex: none; width: 1.625rem; height: 1.625rem; border-radius: 50%; }

/* -- Footer -------------------------------------------------- */

.site-footer {
  background: var(--sand-200);
  border-top: 1px solid var(--rule);
  padding-block: var(--space-3xl) var(--space-lg);
}

.footer__grid {
  display: grid;
  gap: var(--space-2xl) var(--gutter);
  padding-bottom: var(--space-2xl);
}
@media (min-width: 40rem) {
  .footer__grid { grid-template-columns: repeat(3, 1fr); }
  .footer__brand, .footer__cta { grid-column: span 3; }
}
@media (min-width: 64rem) {
  .footer__grid {
    grid-template-columns: 1.6fr repeat(3, 1fr) 1.4fr;
    gap: var(--space-xl) var(--gutter);
  }
  .footer__brand, .footer__cta { grid-column: auto; }
}

.footer__brand { display: grid; gap: var(--space-md); align-content: start; }
.brand--footer .brand__name { font-size: 1.125rem; }
.footer__brand p { max-width: 28ch; }

.socials { display: flex; gap: var(--space-sm); }
.socials a {
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  margin-left: -0.5rem;
  color: var(--accent-text);
  transition: color var(--dur-fast);
}
.socials a:first-child { margin-left: -0.5rem; }
.socials a:hover { color: var(--ink); }
.socials svg { width: 1.125rem; height: 1.125rem; }

.footer__col { display: grid; gap: var(--space-md); align-content: start; }

.footer__title {
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--ink-60);
}
.footer__list { display: flex; flex-direction: column; gap: 0.5rem; font-size: var(--fs-small); }
/* 24px is the WCAG 2.2 minimum target. Left to the line box these
   land at 22.75px in Latin and 24.05px in Korean - a tap target that
   passes or fails depending on the locale is not a tap target. */
.footer__list a {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  color: var(--ink-80);
  transition: color var(--dur-fast);
}
.footer__list a:hover { color: var(--accent-text); }

.footer__cta { display: grid; gap: var(--space-md); align-content: start; justify-items: start; }
.footer__cta p { max-width: 30ch; }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  justify-content: space-between;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  color: var(--ink-60);
}
