/* ==== Reset / base ==== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Sticky header would otherwise cover anchor targets */
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Noto Sans Thai", system-ui, sans-serif;
  font-size: var(--fs-md);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* height:auto is required — the width/height attributes on <img> are
   presentational hints that would otherwise beat aspect-ratio */
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

h1, h2, h3 { line-height: var(--lh-heading); text-wrap: balance; }
p { text-wrap: pretty; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 var(--gutter); }

/* ==== Accessibility utilities ==== */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 999;
  background: var(--surface-3); color: var(--ink);
  border: 1px solid var(--border-strong);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md); font-size: var(--fs-base); font-weight: 600;
  transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

/* Keyboard users must always see where they are */
:focus-visible {
  outline: 3px solid var(--brand-ink);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ==== Topbar ==== */
.topbar { background: var(--brand); }
.topbar-inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); min-height: 36px;
  padding-top: var(--sp-1); padding-bottom: var(--sp-1);
}
.topbar-link {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--on-brand);
  letter-spacing: 0.01em;
  min-height: 28px;
}
.topbar-link:hover { color: rgba(11, 11, 16, 0.72); }
.topbar-social { display: flex; gap: var(--sp-2); }
.social-square {
  position: relative;
  width: 26px; height: 26px;
  background: var(--on-brand); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
/* Hit area larger than the visual square (mobile reaches 44px) */
.social-square::after { content: ""; position: absolute; inset: -4px; }
.social-square:hover { background: var(--surface-3); transform: translateY(-1px); }

/* ==== Header ==== */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: rgba(11, 11, 16, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.site-header.scrolled {
  box-shadow: var(--sh-md);
  border-bottom-color: transparent;
}
.header-inner {
  display: flex; justify-content: space-between; align-items: center;
  min-height: var(--header-h); gap: var(--sp-6);
  transition: min-height var(--dur) var(--ease-out);
}
.site-header.scrolled .header-inner { min-height: 68px; }

.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand img { width: 46px; height: auto; transition: width var(--dur) var(--ease-out); }
.site-header.scrolled .brand img { width: 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name {
  font-size: var(--fs-xl); font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-tagline { font-size: var(--fs-xs); color: var(--ink-muted); }

.main-nav {
  display: flex; flex-wrap: wrap; align-items: center;
  column-gap: var(--sp-1); row-gap: 0;
  margin-left: auto;
}
.main-nav a {
  position: relative;
  font-size: var(--fs-base); font-weight: 500; color: var(--ink-2);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.main-nav a::after {
  content: ""; position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: 2px;
  height: 2px; background: var(--brand); border-radius: var(--r-full);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}
.main-nav a:hover { color: var(--ink); background: var(--surface-3); }
.main-nav a:hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 44px; height: 44px; border-radius: var(--r-sm);
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--ink);
  border-radius: var(--r-full);
  transition: transform var(--dur) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==== Footer ==== */
.site-footer {
  background: var(--dark-bg); color: var(--dark-text);
  position: relative;
  border-top: 1px solid var(--dark-border);
}
/* Gold hairline echoes the topbar — bookends the page */
.site-footer::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand) 18%, var(--brand) 82%, transparent);
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 0.8fr 1fr;
  gap: var(--sp-10) var(--sp-16);
  padding-top: var(--sp-16); padding-bottom: var(--sp-16);
  align-items: start;
}
.footer-brand-row { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.footer-logo { width: 64px; height: auto; }
.footer-brand-name { font-size: var(--fs-2xl); font-weight: 900; color: #fff; line-height: 1.2; letter-spacing: -0.01em; }
.footer-brand-tagline { font-size: var(--fs-sm); color: var(--dark-muted); margin-top: 2px; }
.footer-desc {
  font-size: var(--fs-base); color: var(--dark-muted);
  line-height: var(--lh-body); margin-bottom: var(--sp-6); max-width: 44ch;
}
.footer-social { display: flex; gap: var(--sp-2); }
.social-square-dark {
  width: 40px; height: 40px; background: var(--dark-surface); color: var(--dark-text);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--dark-border); border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.social-square-dark:hover {
  background: var(--brand); color: var(--on-brand);
  border-color: var(--brand); transform: translateY(-2px);
}
.footer-heading {
  color: var(--brand); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: var(--sp-4); padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--dark-border);
}
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 0; }
.footer-links a {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-base); color: var(--dark-muted);
  padding: var(--sp-1) 0; min-height: 34px;
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.footer-links a::before {
  content: ""; width: 5px; height: 5px; border-radius: var(--r-full);
  background: var(--dark-border); flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease-out);
}
.footer-links a:hover { color: var(--brand); transform: translateX(3px); }
.footer-links a:hover::before { background: var(--brand); }
.footer-bottom {
  border-top: 1px solid var(--dark-border);
  padding: var(--sp-5) 0; text-align: center;
}
.footer-bottom p { font-size: var(--fs-sm); color: var(--dark-muted); }
