/* ============================================================
   Bonfire Cloud — site-wide styles (responsive, theme, utils)
   ============================================================ */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-latin);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}

img { max-width: 100%; display: block; }

button { font-family: inherit; }

/* ----- Container ----- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}
@media (max-width: 640px) {
  .container { padding: 0 20px; }
}

/* Section vertical rhythm */
.section { padding: 96px 0; }
.section-sm { padding: 64px 0; }
@media (max-width: 860px) {
  .section { padding: 64px 0; }
  .section-sm { padding: 48px 0; }
}

/* ----- Hairline ----- */
.hr { height: 1px; background: var(--border); border: none; margin: 0; }

/* ----- Tiny util classes ----- */
.eyebrow-brand {
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand);
}
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mono { font-family: var(--font-mono); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  /* Modifier: on tablet, keep only the first 2 items visible
     (used on home sections where 3rd card would orphan). */
  .grid-tab-2 > :nth-child(n+3) { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ----- Card ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.card.hover:hover {
  box-shadow: 0 12px 28px rgba(20, 20, 60, 0.10), 0 4px 10px rgba(20, 20, 60, 0.06);
  transform: translateY(-2px);
  border-color: transparent;
}
a.card, a.card:focus, a.card:focus-visible, a.card:active {
  outline: none;
  text-decoration: none;
}

/* ----- Top nav ----- */
.bc-nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] .bc-nav { background: rgba(247, 250, 253, 0.85); }
[data-theme="dark"] .bc-nav  { background: rgba(10, 14, 36, 0.85); }

.bc-nav-inner {
  display: flex; align-items: center; gap: 28px;
  padding: 14px 28px;
  max-width: 1200px; margin: 0 auto;
}
.bc-nav-brand { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; border: none; }
.bc-nav-brand img { display: block; width: auto; }

/* Desktop: full lockup with text */
.bc-nav-lockup { height: 34px; }
/* Mobile/tablet: mark only */
.bc-nav-mark { height: 32px; display: none; }

.bc-nav-links {
  display: flex; gap: 4px; flex: 1;
  justify-content: center;
  align-items: center;
}
.bc-nav-links .bc-nav-link,
.bc-nav-links a {
  font-family: inherit;
  font-size: 14px; font-weight: 500;
  line-height: 1;
  color: var(--text-primary);
  padding: 8px 12px; border-radius: 6px;
  border: none; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center;
  white-space: nowrap;
  font-family: inherit;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.bc-nav-links .bc-nav-link:hover { background: var(--surface-alt); color: var(--text-primary); }
.bc-nav-links .bc-nav-link.active { color: var(--brand); background: var(--surface-alt); }

/* Dropdown groups */
.bc-nav-group { position: relative; }
.bc-nav-dropdown {
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 260px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(10,14,36,0.12), 0 2px 6px rgba(10,14,36,0.05);
  padding: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  z-index: 30;
}
.bc-nav-group.open .bc-nav-dropdown {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.bc-nav-dropdown a {
  display: block !important;
  padding: 10px 12px !important;
  border-radius: 8px !important;
  text-decoration: none;
  color: var(--text-primary) !important;
  background: transparent !important;
}
.bc-nav-dropdown a:hover { background: var(--surface-alt) !important; }
.bc-nav-dd-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
.bc-nav-dd-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }

/* Mobile group headings */
.bc-nav-mobile-group { margin-top: 18px; }
.bc-nav-mobile-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); font-weight: 700;
  padding: 10px 0 4px;
  border-bottom: 1px solid var(--border);
}
.bc-nav-mobile-group a {
  font-size: 16px !important;
  padding: 12px 0 !important;
}

.bc-nav-tools {
  display: flex; align-items: center; gap: 10px;
}

.bc-iconbtn {
  width: 36px; height: 36px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-primary);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.bc-iconbtn:hover { background: var(--surface-alt); }

.bc-lang {
  height: 36px; padding: 0 10px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.bc-lang:hover { background: var(--surface-alt); }

/* Mobile nav */
.bc-nav-mobile-btn { display: none; }
.bc-nav-mobile { display: none; }

@media (max-width: 1080px) {
  .bc-nav-links { display: none; }
  .bc-nav-mobile-btn { display: inline-flex; }
  .bc-nav-lockup { height: 32px; }
  .bc-nav-desktop-only { display: none !important; }
  .bc-nav-tools { margin-left: auto; }
}

.bc-nav-mobile.open {
  display: flex;
  flex-direction: column;
  position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 40;
  padding: 24px 28px; overflow-y: auto;
}
.bc-nav-mobile-links { display: flex; flex-direction: column; }
.bc-nav-mobile .bc-nav-mobile-tools { margin-top: auto; }
.bc-nav-mobile a {
  display: block; padding: 14px 0;
  font-size: 18px; font-weight: 600; color: var(--text-primary);
  border: none; border-bottom: 1px solid var(--border);
}
.bc-nav-mobile a.active { color: var(--brand); }
.bc-nav-mobile-tools {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bc-nav-mobile-tools-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.bc-nav-mobile-tools-row .bc-lang,
.bc-nav-mobile-tools-row .bc-iconbtn {
  height: 44px;
}

/* ----- Footer ----- */
.bc-footer {
  background: var(--midnight-navy);
  color: #fff;
  padding: 72px 28px 32px;
  margin-top: 0;
}
.bc-footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid;
  /* Brand column gets 3fr; the three link columns share the remaining
     space evenly. Was 2fr 1fr 1fr 1fr — link columns were over-wide
     since each only has 2-5 short labels. Bigger brand block lets
     the tagline + social icons breathe. */
  grid-template-columns: 3fr 1fr 1fr 1fr;
  gap: 56px;
}
@media (max-width: 980px) {
  .bc-footer-inner { grid-template-columns: 1fr 1fr 1fr; gap: 40px; }
  .bc-footer-brand { grid-column: 1 / -1; margin-bottom: 8px; }
}
@media (max-width: 600px) {
  .bc-footer-inner { grid-template-columns: 1fr 1fr; }
}
.bc-footer h5 {
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin: 0 0 16px;
}
.bc-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.bc-footer a {
  color: rgba(255,255,255,0.78);
  font-size: 14px; border: none;
  transition: color var(--dur) var(--ease);
}
.bc-footer a:hover { color: #fff; border-bottom: none; }
.bc-footer-brand img { height: 36px; width: auto; display: block; }
.bc-footer-logos {
  display: inline-flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
}
.bc-footer-logo-link {
  display: inline-flex; align-items: center;
  border: none; padding: 4px 2px; border-radius: 6px;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}
.bc-footer-logo-link:hover { opacity: 0.85; transform: translateY(-1px); border: none; }
.bc-footer-logo-sep {
  width: 1px; height: 28px;
  background: rgba(255,255,255,0.18);
}
.bc-footer-brand p { font-size: 13px; color: rgba(255,255,255,0.65); line-height: 1.6; max-width: 320px; margin: 0; }

.bc-footer-bottom {
  max-width: 1200px; margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: 12px; color: rgba(255,255,255,0.55);
}
.bc-footer-legal-links { display: flex; gap: 20px; }

/* ----- Hero utilities ----- */
.cloud-gradient-bg {
  background: var(--cloud-gradient);
  color: #fff;
}
.hero-headline {
  font-size: clamp(36px, 5.2vw, 64px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  text-wrap: balance;
}

/* ----- Buttons (extend tokens.css) ----- */
.btn { text-decoration: none; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
/* Neutralize the global a:hover underline when a button is rendered as an <a> */
a.btn:hover { border-bottom-color: transparent; }

/* Contact-page "Other ways to reach us" cards. The global tokens.css
   a:hover rule paints a 1px border-bottom across the WHOLE link, which
   on these full-width flex-row cards looked like an underline cutting
   the row in half. Replace with a card-style background fill on hover. */
a.bc-contact-card { border-bottom: none !important; }
a.bc-contact-card:hover {
  background: var(--surface-alt);
  border-bottom-color: transparent !important;
}

/* ----- Input ----- */
.bc-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.bc-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }
textarea.bc-input { height: auto; padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.6; }

.bc-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.bc-select {
  height: 44px;
  padding: 0 36px 0 14px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  appearance: none;
  cursor: pointer;
}
.bc-select:focus { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }

/* ----- Badge ----- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--surface-alt); color: var(--royal-blue);
}
[data-theme="dark"] .badge { background: rgba(60,160,200,0.15); color: var(--sky); }
.badge.ember { background: rgba(210,45,0,0.12); color: var(--ember); }
[data-theme="dark"] .badge.ember { background: rgba(240,90,0,0.15); color: var(--flame); }
.badge.ok { background: #DFF4E6; color: #0E7A3B; }
[data-theme="dark"] .badge.ok { background: rgba(14,122,59,0.2); color: #6BD89A; }

/* ----- Page-level hero block (non-home) ----- */
.page-hero {
  position: relative;
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.page-hero h1 {
  font-size: clamp(32px, 4.4vw, 56px);
  line-height: 1.1;
  margin: 12px 0 14px;
  letter-spacing: -0.02em;
  text-wrap: balance;
  /* Cap at the same 640px column the lead uses, so the title and
     lead form a single coherent text block. Sub-pages don't have a
     hero image alongside, so the unconstrained full-container width
     made the title sprawl awkwardly — capping at 640 gives it a
     tight readable shape that pairs better with the lead below. */
  max-width: 640px;
  /* Force breaks ONLY at explicit whitespace, never inside a Thai
     word via dictionary segmentation. Otherwise the browser splits
     compound Thai words mid-syllable and orphans suffixes onto the
     next line. Same logic the home hero uses. */
  word-break: keep-all;
  overflow-wrap: normal;
}
.page-hero p.lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0;
  /* Avoid orphan widows — last 1-2 words on their own line.
     Modern browsers (Chrome 117+, Safari 17.5+, Firefox 121+).
     Older browsers ignore the property and wrap normally. */
  text-wrap: pretty;
  /* Same Thai mid-word-break protection as the h1. */
  word-break: keep-all;
  overflow-wrap: normal;
}

/* Subtle decorative gradient on page hero */
.page-hero::before {
  content: "";
  position: absolute; top: -200px; right: -200px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60,160,200,0.18), transparent);
  pointer-events: none;
  filter: blur(20px);
}
[data-theme="dark"] .page-hero::before {
  background: radial-gradient(closest-side, rgba(60,160,200,0.25), transparent);
}

/* Stat mono numerals */
.stat-kpi {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.stat-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-top: 4px;
}

/* Hide chrome when printing */
@media print {
  .bc-nav, .bc-footer { display: none; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Footer socials */
.bc-social {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 180ms var(--ease), transform 180ms var(--ease);
  border: none;
}
.bc-social:hover { background: var(--flame); color: #fff; transform: translateY(-1px); }

/* Compare page — stack row */
.route-fade { animation: route-in 240ms var(--ease); }
@keyframes route-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.compare-rows { display: flex; flex-direction: column; gap: 12px; }
.compare-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 16px;
  row-gap: 14px;
  align-items: start;
  padding: 16px 18px;
}
.compare-row-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-alt); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  grid-row: 1; grid-column: 1;
}
.compare-row-fields {
  grid-row: 1; grid-column: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 10px; min-width: 0;
}
.compare-row-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.compare-row-field .bc-select { width: 100%; }

.compare-row-controls {
  grid-row: 2; grid-column: 2;
  display: flex; align-items: center; gap: 12px;
  padding-top: 4px;
}
.compare-qty { display: inline-flex; align-items: center; gap: 6px; }
.compare-qty .bc-iconbtn { width: 28px; height: 28px; }
.compare-qty-input {
  width: 56px; height: 28px; padding: 0;
  text-align: center; text-align-last: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.compare-qty-input::-webkit-inner-spin-button,
.compare-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.compare-unit { font-size: 12px; color: var(--text-muted); flex: 1; }
.compare-price {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.compare-price-mo { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.compare-remove { width: 28px; height: 28px; }

@media (max-width: 520px) {
  .compare-row-fields { grid-template-columns: 1fr; }
  .compare-row-controls { grid-column: 1 / -1; }
}

/* Alt section backgrounds — light-tinted wash for rhythm */
.section-tint { position: relative; overflow: hidden; }
[data-theme="light"] .section-tint {
  background: #EFF6FC;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .section-tint {
  background: #111736;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Home news — tinted cohesive wash (theme-aware) */
.home-news { position: relative; overflow: hidden; }
.home-news-bg {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
}
[data-theme="light"] .home-news { background: #EFF6FC; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
[data-theme="light"] .home-news-bg {
  background:
    radial-gradient(900px 420px at 90% 15%, rgba(60,160,200,0.10), transparent 60%),
    radial-gradient(600px 320px at 5% 95%, rgba(240,135,0,0.05), transparent 60%);
}
[data-theme="dark"] .home-news { background: #111736; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
[data-theme="dark"] .home-news-bg {
  background:
    radial-gradient(900px 420px at 90% 15%, rgba(60,160,200,0.14), transparent 60%);
}

/* ============================================================
   Home hero — theme-aware cinematic treatment
   ============================================================ */
.home-hero {
  position: relative; overflow: hidden;
  min-height: min(820px, 92vh);
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}
.home-hero-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  /* LQIP gradient under the JPG — shows instantly on slow connections so
     the hero never looks empty while the full image downloads. The JPG is
     also preloaded in <head> with fetchpriority=high. */
  background-color: #0f2548;
  background-image: linear-gradient(135deg, #0b1638 0%, #1c3a6e 35%, #2a6b9c 65%, #1f5a8a 100%), url('../assets/main-kv-cloud.jpg');
  background-image: url('../assets/main-kv-cloud.jpg'), linear-gradient(135deg, #0b1638 0%, #1c3a6e 35%, #2a6b9c 65%, #1f5a8a 100%);
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
}
/* Tablet / mobile — center the key visual so the focal point doesn't crop off */
@media (max-width: 1000px) {
  .home-hero-bg { background-position: center center; }
}
@media (max-width: 640px) {
  .home-hero-bg { background-size: cover; background-position: 50% 50%; }
}
.home-hero-scrim,
.home-hero-fade,
.home-hero-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
}
.home-hero-glow {
  inset: auto; right: -6%; top: 10%;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(240,135,0,0.22), transparent 70%);
  filter: blur(20px); mix-blend-mode: screen;
}
.home-hero-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0.9;
}
[data-theme="light"] .home-hero-particles { opacity: 0.55; mix-blend-mode: plus-lighter; }
@media (prefers-reduced-motion: reduce) {
  .home-hero-particles { display: none; }
}
.home-hero-inner {
  position: relative; z-index: 2;
  padding: 88px 28px 120px;
  display: flex; flex-direction: column; justify-content: center;
  width: 100%;
}

/* --- DARK theme: cinematic navy scrim, white text --- */
[data-theme="dark"] .home-hero { color: #fff; }
[data-theme="dark"] .home-hero-scrim {
  background:
    linear-gradient(100deg, rgba(10,14,36,0.80) 0%, rgba(10,14,36,0.55) 28%, rgba(10,14,36,0.15) 55%, transparent 75%);
}
[data-theme="dark"] .home-hero-fade {
  background: linear-gradient(180deg, rgba(10,14,36,0.55) 0%, rgba(10,14,36,0.20) 35%, rgba(10,14,36,0.55) 85%, var(--bg) 100%);
}
[data-theme="dark"] .home-hero-eyebrow {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
}
[data-theme="dark"] .home-hero-title { color: #fff; text-shadow: 0 2px 24px rgba(10,14,36,0.55); }
[data-theme="dark"] .home-hero-sub { color: rgba(255,255,255,0.88); text-shadow: 0 1px 12px rgba(10,14,36,0.5); }
[data-theme="dark"] .home-hero-ghost-btn {
  background: transparent !important;
  color: #fff !important;
  border: 1.5px solid var(--bonfire-cyan) !important;
}
[data-theme="dark"] .home-hero-ghost-btn:hover {
  background: rgba(60,160,200,0.16) !important;
  border-color: var(--sky) !important;
  color: #fff !important;
}
[data-theme="dark"] .home-hero-stats {
  background: rgba(10,14,36,0.55);
  border: 1px solid rgba(255,255,255,0.12);
}
[data-theme="dark"] .home-hero-stat { border-left: 1px solid rgba(255,255,255,0.12); }
[data-theme="dark"] .home-hero-stat[data-first="true"] { border-left: none; }
[data-theme="dark"] .home-hero-stat-k { color: #fff; }
[data-theme="dark"] .home-hero-stat-l { color: rgba(255,255,255,0.65); }

/* --- LIGHT theme: bright frosted scrim, dark text --- */
[data-theme="light"] .home-hero { color: var(--text-primary); }
[data-theme="light"] .home-hero-scrim {
  background:
    linear-gradient(100deg, rgba(20,20,60,0.22) 0%, rgba(20,20,60,0.10) 32%, rgba(20,20,60,0.02) 58%, transparent 78%);
}
[data-theme="light"] .home-hero-fade {
  background:
    linear-gradient(180deg, rgba(20,20,60,0.10) 0%, transparent 22%, transparent 72%, rgba(238,242,247,0.7) 92%, var(--bg) 100%);
}
[data-theme="light"] .home-hero-eyebrow {
  background: rgba(10,14,36,0.55);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .home-hero-title {
  color: #fff;
  text-shadow: 0 2px 28px rgba(10,14,36,0.45), 0 1px 2px rgba(10,14,36,0.25);
}
[data-theme="light"] .home-hero-sub {
  color: rgba(255,255,255,0.92);
  text-shadow: 0 1px 14px rgba(10,14,36,0.4);
}
[data-theme="light"] .home-hero-ghost-btn {
  background: rgba(255,255,255,0.10) !important;
  color: #fff !important;
  border: 1.5px solid rgba(255,255,255,0.75) !important;
  backdrop-filter: blur(6px);
}
[data-theme="light"] .home-hero-ghost-btn:hover {
  background: rgba(255,255,255,0.18) !important;
  border-color: #fff !important;
  color: #fff !important;
}
[data-theme="light"] .home-hero-stats {
  background: rgba(10,14,36,0.38);
  border: 1px solid rgba(255,255,255,0.28);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
[data-theme="light"] .home-hero-stat { border-left: 1px solid rgba(255,255,255,0.22); }
[data-theme="light"] .home-hero-stat[data-first="true"] { border-left: none; }
[data-theme="light"] .home-hero-stat-k { color: #fff; }
[data-theme="light"] .home-hero-stat-l { color: rgba(255,255,255,0.78); }

/* Shared hero typography */
.home-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 26px;
}
.home-hero-eyebrow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--flame);
  box-shadow: 0 0 12px var(--flame);
}
/* Partner lockup above the eyebrow */
.home-hero-partner {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 10px 16px 10px 18px; border-radius: 999px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.home-hero-partner-label {
  font-size: 16px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: none;
}
.home-hero-partner-logo { height: 22px; width: auto; display: block; }

[data-theme="dark"] .home-hero-partner {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
}
[data-theme="dark"] .home-hero-partner-label { color: rgba(255,255,255,0.78); }

[data-theme="light"] .home-hero-partner {
  background: rgba(20, 20, 60, 0.85);
  border: 1px solid rgba(20, 20, 60, 0.95);
  box-shadow: 0 4px 14px rgba(20, 20, 60, 0.18);
}
[data-theme="light"] .home-hero-partner-label { color: rgba(255,255,255,0.82); }

.home-hero-title {
  /* Width bumped 760 -> 820 so the Thai title fits with one
     break at the writer's chosen space rather than being squeezed. */
  max-width: 820px;
  /* Force line breaks ONLY at explicit whitespace, never in the middle
     of a Thai word. Without this, the browser can break "เต็มที่" into
     "เต็ม" + "ที่" via dictionary-based segmentation, which orphans
     suffix syllables onto the next line. keep-all tells the browser
     "break only at spaces" — gives clean breaks at the natural phrase
     boundaries the writer chose. Same logic applies for EN (always
     breaks at spaces anyway). */
  word-break: keep-all;
  overflow-wrap: normal;
}
.home-hero-copy {
  max-width: 720px;
  /* Reserve the height of the longest-language version so switching doesn't reflow the stats below */
  min-height: 560px;
}
.home-hero-sub {
  font-size: clamp(16px, 1.45vw, 19px); line-height: 1.65;
  /* Width bumped 580 -> 820 to match .home-hero-title. The long
     Thai subtitle "เราช่วยดูแลเซิร์ฟเวอร์และแก้ปัญหาตอนตีสาม..."
     was wrapping awkwardly at 580; matching the title width keeps
     the hero text block visually unified. */
  max-width: 820px; margin: 0 0 34px;
  text-wrap: pretty;  /* avoid orphan widows */
  word-break: keep-all;  /* Thai mid-word-break protection */
  overflow-wrap: normal;
}
.home-hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 22px 28px;
  border-radius: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.home-hero-stat { padding: 4px 20px; }
.home-hero-stat-k {
  font-size: clamp(22px, 2.4vw, 30px); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
}
.home-hero-stat-l {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-top: 6px;
}

@media (max-width: 900px) {
  .home-hero-stats { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .home-hero-stat:nth-child(3) { border-left: none !important; }
}
@media (max-width: 520px) {
  .home-hero-stats { grid-template-columns: 1fr; }
  [data-theme="dark"] .home-hero-stat { border-left: none !important; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 14px; }
  [data-theme="light"] .home-hero-stat { border-left: none !important; border-top: 1px solid var(--border); padding-top: 14px; }
  .home-hero-stat[data-first="true"] { border-top: none !important; padding-top: 0; }
}

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Links default — many of our links are .btn or in nav, body links get underline on hover already from tokens */

/* ========================================================================== */
/* Cookie banner                                                              */
/* ========================================================================== */

.bc-cookie {
  position: fixed;
  left: 20px; bottom: 20px;
  z-index: 100;
  width: min(440px, calc(100vw - 40px));
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow:
    0 24px 48px rgba(10, 14, 36, 0.18),
    0 4px 12px rgba(10, 14, 36, 0.08);
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 280ms var(--ease),
    transform 280ms var(--ease),
    width 280ms var(--ease);
  overflow: hidden;
}
[data-theme="dark"] .bc-cookie {
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}
.bc-cookie.in { opacity: 1; transform: translateY(0); }
.bc-cookie.expanded { width: min(560px, calc(100vw - 40px)); }

/* Accent strip on the left */
.bc-cookie::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--flame) 0%, var(--bonfire-cyan) 100%);
}

/* Compact state */
.bc-cookie-compact {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-areas:
    "icon body"
    "actions actions";
  gap: 14px 14px;
  padding: 20px 20px 18px 22px;
}
.bc-cookie-icon {
  grid-area: icon;
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in oklab, var(--brand) 12%, transparent);
  color: var(--brand);
}
.bc-cookie-body { grid-area: body; min-width: 0; }
.bc-cookie-title {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.bc-cookie-copy {
  font-size: 13px; line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}
.bc-cookie-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px;
  font-size: 12px; font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}
.bc-cookie-link:hover { text-decoration: underline; }

.bc-cookie-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 6px;
}
.bc-cookie-actions .btn { font-size: 13px !important; }
.bc-cookie-customize {
  grid-column: 1 / -1;
  background: none; border: none;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 0 0;
  text-align: center;
}
.bc-cookie-customize:hover { color: var(--text-primary); text-decoration: underline; }

/* Expanded state */
.bc-cookie-expanded {
  padding: 20px 22px 18px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.bc-cookie-expanded-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
}
.bc-cookie-close {
  width: 28px; height: 28px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.bc-cookie-close:hover { background: var(--surface-alt); color: var(--text-primary); }

.bc-cookie-cats {
  display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
}
.bc-cookie-cat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 12px 4px;
  align-items: flex-start;
}
.bc-cookie-cat + .bc-cookie-cat {
  border-top: 1px solid var(--border);
}
.bc-cookie-cat-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 3px;
}
.bc-cookie-cat-desc {
  font-size: 12px; line-height: 1.5; color: var(--text-muted);
}
.bc-cookie-cat.disabled .bc-cookie-cat-title::after {
  content: " · Always on";
  font-weight: 500; color: var(--text-muted); font-size: 11px;
  letter-spacing: 0.02em;
}

/* Toggle switch */
.bc-cookie-toggle { display: inline-block; cursor: pointer; margin-top: 2px; }
.bc-cookie-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.bc-cookie-toggle-track {
  display: inline-block; position: relative;
  width: 34px; height: 20px; border-radius: 999px;
  background: var(--border);
  transition: background var(--dur) var(--ease);
}
.bc-cookie-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform var(--dur) var(--ease);
}
.bc-cookie-toggle.on .bc-cookie-toggle-track { background: var(--brand); }
.bc-cookie-toggle.on .bc-cookie-toggle-thumb { transform: translateX(14px); }
.bc-cookie-toggle.disabled { cursor: not-allowed; }
.bc-cookie-toggle.disabled .bc-cookie-toggle-track { opacity: 0.6; }

.bc-cookie-expanded-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.bc-cookie-expanded-actions .btn { font-size: 13px !important; }

/* Mobile */
@media (max-width: 560px) {
  .bc-cookie {
    left: 12px; right: 12px; bottom: 12px;
    width: auto; max-width: none;
    border-radius: 14px;
  }
  .bc-cookie.expanded { width: auto; }
  .bc-cookie-compact { padding: 18px 18px 16px 20px; }
  .bc-cookie-expanded { padding: 18px 18px 16px 20px; }
  .bc-cookie-actions { grid-template-columns: 1fr; }
  .bc-cookie-expanded-actions { flex-direction: column; align-items: stretch; }
  .bc-cookie-expanded-actions .btn { width: 100%; }
  .bc-cookie-expanded-actions .bc-cookie-link { margin: 0 0 4px; }
}

/* ===== Mobile fine-tuning (items 12, 13, 18) ===== */

/* 12: Home hero "Authorized partner of" pill — stays on 1 line on mobile.
   inline-flex + fit-content → hugs content, no full-width stretch.
   flex-wrap: nowrap + white-space: nowrap → label + logo never break to a second line.
   Scaled-down label/logo/padding keep the pill inside even narrow (≤360px) viewports. */
@media (max-width: 640px) {
  .home-hero-partner {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    max-width: 100%;
    gap: 8px;
    padding: 8px 14px;
  }
  .home-hero-partner-label {
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .home-hero-partner-logo {
    height: 16px;
    flex-shrink: 0;
  }
}

/* 13: Hero-level button rows stack full-width on mobile so paired CTAs match width */
@media (max-width: 640px) {
  .hero-btn-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .hero-btn-row > .btn { width: 100%; }
}

/* 18: Compare page — show "Monthly total" card before "Your stack" when stacked on mobile */
@media (max-width: 1000px) {
  .compare-layout > div:first-child { order: 2; }
  .compare-layout .compare-results { order: 1; }
}

/* 19: About page — office photo hover. Subtle zoom on the image
   plus reveal of the "Open in Maps" hint chip. The chip is
   inline-positioned in the JSX with opacity:0 by default; this
   rule flips it on hover. Image transition is also defined in
   the inline style so non-hover browsers still get the smooth
   feel if they support it. */
.about-office-photo:hover img { transform: scale(1.03); }
.about-office-photo:hover .about-office-hint { opacity: 1; }
