/* =========================================================================
 * Hashbox V2 — Phase 2 Surface Components
 * Depends on: tokens.css, primitives.css
 *
 * Components:
 *   8.  Card (.hb-card + variants: glass, gradient-border, interactive)
 *   9.  Container (.hb-container, .hb-container--sm/md/lg/xl)
 *   10. Section (.hb-section + .hb-section__head)
 *   11. Bento Grid (.hb-bento + .hb-bento__cell + span utilities)
 *   12. Stat Block (.hb-stat + .hb-stats__grid)
 *   13. Divider (.hb-divider, .hb-divider--gradient)
 *   14. Eyebrow + Tag rail (.hb-rail)
 * ========================================================================= */

/* -------------------------------------------------------------------------
 * 8. CARD
 * ----------------------------------------------------------------------- */

.hb-card {
  --card-bg: var(--hb-surface-1);
  --card-border: var(--hb-border);
  --card-fg: var(--hb-text);

  display: flex;
  flex-direction: column;
  gap: var(--hb-space-4);
  position: relative;
  background: var(--card-bg);
  color: var(--card-fg);
  border: 1px solid var(--card-border);
  border-radius: var(--hb-radius-lg);
  padding: var(--hb-space-6);
  box-shadow: var(--hb-shadow-xs);
  transition: border-color var(--hb-duration-normal) var(--hb-ease-out),
              transform var(--hb-duration-normal) var(--hb-ease-out-expo),
              box-shadow var(--hb-duration-normal) var(--hb-ease-out);
}

.hb-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--hb-space-4);
}

.hb-card__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--hb-radius-sm);
  background: var(--hb-surface-2);
  color: var(--hb-accent-blue);
  border: 1px solid var(--hb-border);
}

.hb-card__title {
  font-family: var(--hb-font-display);
  font-size: var(--hb-text-xl);
  font-weight: var(--hb-weight-semibold);
  line-height: var(--hb-leading-snug);
  color: var(--hb-text-strong);
  margin: 0;
}

.hb-card__body {
  color: var(--hb-text);
  font-size: var(--hb-text-base);
  line-height: var(--hb-leading-relaxed);
  margin: 0;
}

.hb-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hb-space-3);
  padding-top: var(--hb-space-3);
  border-top: 1px solid var(--hb-border);
  margin-top: auto;
  font-size: var(--hb-text-sm);
  color: var(--hb-text-muted);
}

/* Card variant: glass (backdrop blur) */
.hb-card--glass {
  --card-bg: var(--hb-glass-1);
  --card-border: oklch(100% 0 0 / 0.06);
  backdrop-filter: blur(var(--hb-glass-blur));
  -webkit-backdrop-filter: blur(var(--hb-glass-blur));
  box-shadow: var(--hb-shadow-md);
}

/* Card variant: elevated (more depth) */
.hb-card--elevated {
  --card-bg: var(--hb-surface-2);
  box-shadow: var(--hb-shadow-md);
}

/* Card variant: gradient border on hover */
.hb-card--gradient-border {
  position: relative;
}
.hb-card--gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: var(--hb-grad-primary);
  border-radius: inherit;
  padding: 1px;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--hb-duration-normal) var(--hb-ease-out);
  pointer-events: none;
}
.hb-card--gradient-border:hover::before {
  opacity: 1;
}

/* Card variant: interactive (clickable) */
.hb-card--interactive {
  cursor: pointer;
  text-decoration: none;
}
.hb-card--interactive:hover {
  border-color: var(--hb-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--hb-shadow-lg);
}
.hb-card--interactive:active {
  transform: translateY(0);
}
.hb-card--interactive:focus-visible {
  outline: none;
  box-shadow: var(--hb-shadow-md), var(--hb-focus-ring);
}

/* Accent bar across top of card */
.hb-card__accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--hb-radius-lg) var(--hb-radius-lg) 0 0;
  background: var(--hb-grad-primary);
  opacity: 0.7;
}
.hb-card__accent--blue    { background: var(--hb-accent-blue); }
.hb-card__accent--violet  { background: var(--hb-accent-violet); }
.hb-card__accent--cyan    { background: var(--hb-accent-cyan); }
.hb-card__accent--emerald { background: var(--hb-accent-emerald); }
.hb-card__accent--amber   { background: var(--hb-accent-amber); }

/* -------------------------------------------------------------------------
 * 9. CONTAINER
 * ----------------------------------------------------------------------- */

.hb-container {
  width: 100%;
  max-width: var(--hb-container-lg);
  margin-inline: auto;
  padding-inline: var(--hb-section-x);
}

.hb-container--xs { max-width: var(--hb-container-xs); }
.hb-container--sm { max-width: var(--hb-container-sm); }
.hb-container--md { max-width: var(--hb-container-md); }
.hb-container--lg { max-width: var(--hb-container-lg); }
.hb-container--xl { max-width: var(--hb-container-xl); }
.hb-container--full { max-width: 100%; }

/* -------------------------------------------------------------------------
 * 10. SECTION
 * ----------------------------------------------------------------------- */

.hb-section {
  padding-block: var(--hb-section-y);
  position: relative;
}

.hb-section--surface {
  background: var(--hb-surface-1);
}

.hb-section--surface-2 {
  background: var(--hb-surface-2);
}

.hb-section--gradient {
  background:
    radial-gradient(circle at 20% 20%, color-mix(in oklch, var(--hb-accent-blue) 8%, transparent), transparent 50%),
    radial-gradient(circle at 80% 80%, color-mix(in oklch, var(--hb-accent-violet) 8%, transparent), transparent 50%),
    var(--hb-bg);
}

.hb-section__head {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
  margin-bottom: var(--hb-space-12);
  max-width: var(--hb-container-md);
}

.hb-section__head--center {
  margin-inline: auto;
  text-align: center;
  align-items: center;
}

.hb-section__sub {
  font-size: var(--hb-text-lg);
  line-height: var(--hb-leading-relaxed);
  color: var(--hb-text-muted);
  max-width: 65ch;
  margin: 0;
}

/* -------------------------------------------------------------------------
 * 11. BENTO GRID (signature)
 * ----------------------------------------------------------------------- */

.hb-bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(180px, auto);
  gap: var(--hb-space-4);
}

@media (max-width: 1024px) {
  .hb-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .hb-bento { grid-template-columns: minmax(0, 1fr); }
}

/* Cell span utilities */
.hb-bento__cell--c2 { grid-column: span 2; }
.hb-bento__cell--c3 { grid-column: span 3; }
.hb-bento__cell--c4 { grid-column: span 4; }
.hb-bento__cell--r2 { grid-row: span 2; }
.hb-bento__cell--r3 { grid-row: span 3; }

@media (max-width: 1024px) {
  .hb-bento__cell--c3,
  .hb-bento__cell--c4 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .hb-bento__cell--c2,
  .hb-bento__cell--c3,
  .hb-bento__cell--c4 { grid-column: span 1; }
}

/* Bento cell = card by default */
.hb-bento__cell {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
  padding: var(--hb-space-6);
  background: var(--hb-surface-1);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius-xl);
  position: relative;
  overflow: hidden;
  transition: border-color var(--hb-duration-normal) var(--hb-ease-out),
              transform var(--hb-duration-normal) var(--hb-ease-out-expo);
}

.hb-bento__cell:hover {
  border-color: var(--hb-border-strong);
}

/* Bento highlight (featured cell) */
.hb-bento__cell--feature {
  background:
    radial-gradient(circle at 100% 0%, color-mix(in oklch, var(--hb-accent-blue) 15%, transparent), transparent 60%),
    var(--hb-surface-2);
  border-color: oklch(100% 0 0 / 0.08);
}

/* Bento label (eyebrow inside cell) */
.hb-bento__label {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-xs);
  color: var(--hb-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--hb-tracking-wider);
}

/* -------------------------------------------------------------------------
 * 12. STAT BLOCK
 * ----------------------------------------------------------------------- */

.hb-stat {
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-2);
}

.hb-stat__value {
  font-family: var(--hb-font-mono);
  font-feature-settings: 'tnum', 'lnum';
  font-variant-numeric: tabular-nums lining-nums;
  font-size: var(--hb-text-5xl);
  font-weight: var(--hb-weight-semibold);
  line-height: var(--hb-leading-none);
  letter-spacing: var(--hb-tracking-tight);
  color: var(--hb-text-strong);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.hb-stat__value--gradient {
  background: var(--hb-grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hb-stat__unit {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-xl);
  font-weight: var(--hb-weight-medium);
  color: var(--hb-text-muted);
  line-height: 1;
}

.hb-stat__label {
  font-size: var(--hb-text-sm);
  font-weight: var(--hb-weight-medium);
  color: var(--hb-text);
  line-height: var(--hb-leading-snug);
  margin: 0;
}

.hb-stat__caption {
  font-size: var(--hb-text-xs);
  color: var(--hb-text-faint);
  line-height: var(--hb-leading-snug);
  margin: 0;
}

.hb-stat__delta {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-xs);
  font-weight: var(--hb-weight-medium);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: var(--hb-radius-xs);
  width: fit-content;
}

.hb-stat__delta--up   { color: var(--hb-accent-emerald); background: color-mix(in oklch, var(--hb-accent-emerald) 12%, transparent); }
.hb-stat__delta--down { color: var(--hb-accent-rose);    background: color-mix(in oklch, var(--hb-accent-rose) 12%, transparent); }

/* Stats grid layout (use inside bento or section) */
.hb-stats__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--hb-space-6) var(--hb-space-8);
  padding-block: var(--hb-space-6);
}

.hb-stats__grid--divided > .hb-stat:not(:last-child) {
  padding-right: var(--hb-space-8);
  border-right: 1px solid var(--hb-border);
}

@media (max-width: 768px) {
  .hb-stats__grid--divided > .hb-stat { padding-right: 0; border-right: none; }
}

/* -------------------------------------------------------------------------
 * 13. DIVIDER
 * ----------------------------------------------------------------------- */

.hb-divider {
  border: none;
  height: 1px;
  background: var(--hb-border);
  margin-block: var(--hb-space-8);
}

.hb-divider--gradient {
  background: linear-gradient(90deg, transparent, var(--hb-border-strong) 50%, transparent);
}

/* -------------------------------------------------------------------------
 * 14. RAIL (tag list / pill rail)
 * ----------------------------------------------------------------------- */

.hb-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hb-space-2);
}

.hb-rail--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: var(--hb-space-2);
}
.hb-rail--scroll::-webkit-scrollbar { display: none; }

/* =========================================================================
 * .hb-section--light — White chapter (Services, Portfolio, About, FAQ)
 * Scoped color reassignment, no global overrides. Adjacent dark sections
 * keep their look. Soft 64px transition band fades dark→light→dark.
 * ========================================================================= */
.hb-section--light {
  background: var(--hb-light-bg);
  color: var(--hb-light-text);

  /* Re-bind surface tokens inside light section */
  --hb-surface-1:     var(--hb-light-surface-1);
  --hb-surface-2:     var(--hb-light-surface-2);
  --hb-surface-3:     var(--hb-light-surface-3);
  --hb-border:        var(--hb-light-border);
  --hb-border-strong: var(--hb-light-border-strong);
  --hb-text-strong:   var(--hb-light-text-strong);
  --hb-text:          var(--hb-light-text);
  --hb-text-muted:    var(--hb-light-text-muted);
  --hb-text-faint:    var(--hb-light-text-faint);
}

.hb-section--light h1,
.hb-section--light h2,
.hb-section--light h3,
.hb-section--light h4,
.hb-section--light h5,
.hb-section--light h6 {
  color: var(--hb-light-text-strong);
}

.hb-section--light p,
.hb-section--light li,
.hb-section--light span {
  color: var(--hb-light-text);
}

/* Card on light bg — soft elevation, no border */
.hb-section--light .hb-card {
  --card-bg: var(--hb-light-surface-1);
  border-color: var(--hb-light-border);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 4px 12px rgba(15, 23, 42, 0.06);
}

.hb-section--light .hb-card--elevated {
  --card-bg: var(--hb-light-bg);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.05),
    0 12px 32px rgba(15, 23, 42, 0.08);
}

.hb-section--light .hb-card--glass {
  background: color-mix(in oklch, var(--hb-light-bg) 80%, transparent);
  backdrop-filter: blur(12px);
}

/* Icon tiles flip to subtle gray fill instead of dark surface */
.hb-section--light .hb-card__icon {
  background: var(--hb-light-surface-2);
  color: var(--hb-light-text-strong);
}

/* Amber needs darker shade on white for AA contrast */
.hb-section--light .hb-card__accent--amber {
  background: #B45309;  /* amber 700 */
}
/* Flat white sections - no gradient bands (per design direction) */
.hb-section--light::before,
.hb-section--light::after { content: none; }

/* Subtle dot pattern overlay (optional atmosphere on white) */
.hb-section--light--dotted {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.06) 1px, transparent 0);
  background-size: 24px 24px;
}

/* V1 token namespace override inside light section
   (some templates still use .section-title / .section-sub / --color-text) */
.hb-section--light,
.section--light {
  --color-bg:            var(--hb-light-bg);
  --color-surface:       var(--hb-light-surface-1);
  --color-surface-light: var(--hb-light-surface-2);
  --color-border:        var(--hb-light-border);
  --color-text:          var(--hb-light-text-strong);
  --color-text-muted:    var(--hb-light-text-muted);
  --color-text-dim:      var(--hb-light-text-faint);
}

/* .section--light alias (templates not yet on .hb-section--*) */
.section--light {
  background: var(--hb-light-bg);
  color: var(--hb-light-text);
  position: relative;
}

.section--light h1,
.section--light h2,
.section--light h3,
.section--light h4 { color: var(--hb-light-text-strong); }
.section--light p,
.section--light li,
.section--light .section-sub { color: var(--hb-light-text-muted); }

/* Light-mode section-label: blue stays, but darker shade for contrast */
.section--light .section-label {
  color: #4338CA;  /* blue 700 */
}
/* Flat white V1 alias - no gradient bands */
.section--light::before,
.section--light::after { content: none; }

/* =========================================================================
 * EDITORIAL POLISH for .hb-section--light
 * Flat white background, rich content design via type + spacing + restraint.
 * Direction: Linear × Stripe × Vercel — pro restraint over decoration.
 * ========================================================================= */

/* --- Eyebrow tag: indigo dot + uppercase mono ---------------------------- */
.hb-section--light .hb-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-xs);
  font-weight: var(--hb-weight-medium);
  color: var(--hb-accent-blue-strong);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.hb-section--light .hb-eyebrow::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hb-accent-blue-strong);
}

/* --- Section head: tighter, more editorial ------------------------------- */
.hb-section--light .hb-section__head {
  gap: var(--hb-space-4);
  margin-bottom: var(--hb-space-16);
}
.hb-section--light .hb-h2 {
  letter-spacing: -0.035em;
  font-weight: 600;
  color: var(--hb-light-text-strong);
}
.hb-section--light .hb-section__sub {
  color: var(--hb-light-text-muted);
  font-size: var(--hb-text-lg);
  max-width: 56ch;
}

/* --- Services: editorial card with numbered hang + indigo accent strip --- */
.hb-section--light .hb-service {
  position: relative;
  background: var(--hb-light-bg);
  border: 1px solid var(--hb-light-border);
  border-radius: 16px;
  padding: var(--hb-space-8) var(--hb-space-7) var(--hb-space-7);
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-4);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 200ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 200ms;
  overflow: hidden;
}
.hb-section--light .hb-service::before {
  /* Indigo accent strip top-left, grows on hover */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 56px;
  background: var(--hb-accent-blue-strong);
  border-radius: 0 0 3px 0;
  transition: width 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.hb-section--light .hb-service:hover {
  transform: translateY(-4px);
  border-color: var(--hb-light-border-strong);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.08);
}
.hb-section--light .hb-service:hover::before {
  width: 100%;
}
.hb-section--light .hb-service__num {
  font-family: var(--hb-font-mono);
  font-size: var(--hb-text-xs);
  font-weight: var(--hb-weight-medium);
  color: var(--hb-light-text-faint);
  letter-spacing: 0.15em;
}
.hb-section--light .hb-service__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in oklch, var(--hb-accent-blue-strong) 8%, transparent);
  color: var(--hb-accent-blue-strong);
  margin-bottom: var(--hb-space-2);
}
.hb-section--light .hb-service__title {
  font-size: var(--hb-text-xl);
  font-weight: 600;
  color: var(--hb-light-text-strong);
  letter-spacing: -0.02em;
  margin: 0;
}
.hb-section--light .hb-service__desc {
  font-size: var(--hb-text-sm);
  line-height: 1.6;
  color: var(--hb-light-text-muted);
  margin: 0;
}
.hb-section--light .hb-service__stack {
  font-family: var(--hb-font-mono);
  font-size: 0.75rem;
  color: var(--hb-light-text-faint);
  padding-top: var(--hb-space-4);
  margin-top: auto;
  border-top: 1px dashed var(--hb-light-border);
  letter-spacing: 0.01em;
}
.hb-section--light .hb-service__link {
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: var(--hb-accent-blue-strong);
  margin-top: var(--hb-space-2);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  transition: gap 200ms;
}
.hb-section--light .hb-service:hover .hb-service__link {
  gap: 0.7em;
}

/* --- Portfolio: replace heavy gradient bg with subtle off-white cards ---- */
.hb-section--light .hb-case {
  /* override the inline gradient bg from PHP per-card with a flat-pro look */
  background: var(--hb-light-surface-1) !important;
  color: var(--hb-light-text-strong);
  border: 1px solid var(--hb-light-border);
  border-radius: 16px;
  padding: var(--hb-space-7);
  display: flex;
  flex-direction: column;
  gap: var(--hb-space-3);
  text-decoration: none;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 200ms,
              border-color 200ms;
  position: relative;
  overflow: hidden;
  min-height: 240px;
}
.hb-section--light .hb-case::after {
  /* Indigo corner glow on hover */
  content: '';
  position: absolute;
  inset: auto -40% -40% auto;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, color-mix(in oklch, var(--hb-accent-blue-strong) 18%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 280ms;
  pointer-events: none;
}
.hb-section--light .hb-case:hover {
  transform: translateY(-4px);
  border-color: var(--hb-accent-blue-strong);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 16px 40px rgba(15, 23, 42, 0.10);
}
.hb-section--light .hb-case:hover::after { opacity: 1; }

.hb-section--light .hb-case__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--hb-space-3);
}
.hb-section--light .hb-case__industry {
  font-family: var(--hb-font-mono);
  font-size: 0.7rem;
  color: var(--hb-light-text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hb-section--light .hb-badge {
  background: var(--hb-light-surface-2);
  color: var(--hb-light-text-muted);
  border: 1px solid var(--hb-light-border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--hb-font-mono);
  letter-spacing: 0.06em;
}
.hb-section--light .hb-case__name {
  font-size: var(--hb-text-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--hb-light-text-strong);
  margin: var(--hb-space-2) 0 0;
}
.hb-section--light .hb-case__metric {
  font-family: var(--hb-font-display);
  font-size: clamp(2.5rem, 1.8rem + 2vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--hb-accent-blue-strong);
  margin: 0;
  line-height: 1;
}
.hb-section--light .hb-case__desc {
  font-size: var(--hb-text-sm);
  line-height: 1.55;
  color: var(--hb-light-text-muted);
  margin: 0;
  flex: 1;
}
.hb-section--light .hb-case__cta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--hb-text-sm);
  font-weight: 600;
  color: var(--hb-light-text-strong);
  padding-top: var(--hb-space-3);
  border-top: 1px solid var(--hb-light-border);
  margin-top: var(--hb-space-2);
}
.hb-section--light .hb-case__cta-arrow {
  transition: transform 200ms;
}
.hb-section--light .hb-case:hover .hb-case__cta-arrow {
  transform: translateX(4px);
}

/* "ดูผลงานทั้งหมด" button on white */
.hb-section--light .hb-btn--outline {
  border-color: var(--hb-light-border-strong);
  color: var(--hb-light-text-strong);
  background: transparent;
}
.hb-section--light .hb-btn--outline:hover {
  background: var(--hb-light-surface-1);
  border-color: var(--hb-accent-blue-strong);
  color: var(--hb-accent-blue-strong);
}

/* --- FAQ: numbered Q, indigo left-border on open ------------------------- */
.hb-section--light .hb-accordion {
  border-top: 1px solid var(--hb-light-border);
}
.hb-section--light .hb-accordion__item {
  border-bottom: 1px solid var(--hb-light-border);
  position: relative;
  transition: background 200ms;
}
.hb-section--light .hb-accordion__item[open] {
  background: var(--hb-light-surface-1);
}
.hb-section--light .hb-accordion__item::before {
  /* indigo left-border accent when open */
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--hb-accent-blue-strong);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.hb-section--light .hb-accordion__item[open]::before {
  transform: scaleY(1);
}
.hb-section--light .hb-accordion__trigger {
  font-family: var(--hb-font-display);
  font-size: var(--hb-text-lg);
  font-weight: 500;
  color: var(--hb-light-text-strong);
  padding: var(--hb-space-5) var(--hb-space-6);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--hb-space-4);
  transition: color 160ms;
}
.hb-section--light .hb-accordion__trigger::-webkit-details-marker { display: none; }
.hb-section--light .hb-accordion__trigger::after {
  content: '+';
  font-family: var(--hb-font-mono);
  font-size: 1.25rem;
  color: var(--hb-light-text-faint);
  font-weight: 300;
  transition: transform 200ms, color 160ms;
  flex-shrink: 0;
}
.hb-section--light .hb-accordion__item[open] .hb-accordion__trigger::after {
  transform: rotate(45deg);
  color: var(--hb-accent-blue-strong);
}
.hb-section--light .hb-accordion__trigger:hover {
  color: var(--hb-accent-blue-strong);
}
.hb-section--light .hb-accordion__content {
  padding: 0 var(--hb-space-6) var(--hb-space-5);
  color: var(--hb-light-text-muted);
  font-size: var(--hb-text-base);
  line-height: 1.7;
}
.hb-section--light .hb-accordion__content p { margin: 0; }

/* =========================================================================
 * Portfolio section padding/margin fixes
 * - Kill inline --case-bg gradient bleed on white
 * - Increase head→cards breathing room
 * - Larger card padding for hierarchy
 * ========================================================================= */
.hb-section--light#portfolio {
  padding-block: clamp(5rem, 4rem + 4vw, 8rem);
}
.hb-section--light#portfolio .hb-section__head {
  margin-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}

/* Override base .hb-case::before that bleeds inline gradient */
.hb-section--light .hb-case::before {
  background: none !important;
  opacity: 0 !important;
}
.hb-section--light .hb-case:hover::before {
  opacity: 0 !important;
}

/* Larger card padding + min-height for breathing room */
.hb-section--light .hb-case {
  padding: clamp(1.75rem, 1.25rem + 1.5vw, 2.5rem);
  gap: var(--hb-space-4);
  min-height: 280px;
  border-radius: 20px;
}

/* Grid gap larger on white */
.hb-section--light#portfolio > .hb-container > div[style*="grid-template-columns"] {
  gap: var(--hb-space-6) !important;
}

/* Pull metric closer to name, push desc down for clearer hierarchy */
.hb-section--light .hb-case__name { margin-top: 0; }
.hb-section--light .hb-case__metric {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}
.hb-section--light .hb-case__desc {
  margin-top: auto;
  padding-top: var(--hb-space-2);
}

/* "ดูผลงานทั้งหมด" margin-top bigger after cards */
.hb-section--light#portfolio > .hb-container > div[style*="text-align:center"] {
  margin-top: clamp(3rem, 2rem + 3vw, 5rem) !important;
}

/* =========================================================================
 * Services section (What we do) — padding/margin/grid polish
 * Match portfolio breathing room. Equalize 3 service cards (3-col grid).
 * ========================================================================= */
.hb-section--light#services {
  padding-block: clamp(5rem, 4rem + 4vw, 8rem);
}

.hb-section--light#services .hb-section__head {
  margin-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}

/* Override bento c2+c2+c4 → 3 equal columns inside services on white
   (clearer service hierarchy when 3 cards have equal weight) */
.hb-section--light#services .hb-bento {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: clamp(1rem, 0.75rem + 1vw, 1.75rem);
}
.hb-section--light#services .hb-bento__cell--c2,
.hb-section--light#services .hb-bento__cell--c4 {
  grid-column: span 1;
}

@media (max-width: 1024px) {
  .hb-section--light#services .hb-bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hb-section--light#services .hb-bento__cell--c4 {
    grid-column: span 2;  /* third card full-width on tablet */
  }
}

@media (max-width: 640px) {
  .hb-section--light#services .hb-bento {
    grid-template-columns: minmax(0, 1fr);
  }
  .hb-section--light#services .hb-bento__cell--c2,
  .hb-section--light#services .hb-bento__cell--c4 {
    grid-column: span 1;
  }
}

/* Service card breathing room: bigger padding, consistent min-height */
.hb-section--light .hb-service {
  padding: clamp(1.75rem, 1.25rem + 1.5vw, 2.5rem);
  gap: var(--hb-space-3);
  min-height: 360px;
  border-radius: 20px;
}

/* Tighter rhythm inside card: num→icon→title→desc→stack→link */
.hb-section--light .hb-service__num {
  margin-bottom: var(--hb-space-1);
}
.hb-section--light .hb-service__icon {
  margin-bottom: var(--hb-space-2);
}
.hb-section--light .hb-service__title {
  margin-bottom: var(--hb-space-1);
}
.hb-section--light .hb-service__desc {
  margin-bottom: var(--hb-space-3);
  line-height: 1.65;
}
.hb-section--light .hb-service__stack {
  margin-top: auto;
  padding-top: var(--hb-space-4);
}
.hb-section--light .hb-service__link {
  margin-top: var(--hb-space-3);
  padding-top: var(--hb-space-3);
  border-top: 1px solid var(--hb-light-border);
}

/* =========================================================================
 * FAQ section — match white-section breathing room
 * ========================================================================= */
.hb-section--light#faq {
  padding-block: clamp(5rem, 4rem + 4vw, 8rem);
}
.hb-section--light#faq .hb-section__head {
  margin-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}
.hb-section--light#faq .hb-accordion {
  border-top: 1px solid var(--hb-light-border);
  border-radius: 0;
}
.hb-section--light#faq .hb-accordion__trigger {
  padding: clamp(1.25rem, 1rem + 0.5vw, 1.75rem) clamp(1.25rem, 1rem + 1vw, 2rem);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  font-weight: 500;
}
.hb-section--light#faq .hb-accordion__content {
  padding: 0 clamp(1.25rem, 1rem + 1vw, 2rem) clamp(1.25rem, 1rem + 0.5vw, 1.75rem);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1rem);
}

/* =========================================================================
 * Pricing section — match section rhythm + tier polish
 * (Dark section, but apply consistent padding/margin treatment)
 * ========================================================================= */
#pricing.hb-section {
  padding-block: clamp(5rem, 4rem + 4vw, 8rem);
}
#pricing .hb-section__head {
  margin-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}
#pricing .hb-tier {
  padding: clamp(1.75rem, 1.25rem + 1.5vw, 2.5rem);
  gap: var(--hb-space-4);
  border-radius: 20px;
  min-height: 480px;
}
#pricing .hb-tier__price {
  font-size: clamp(2rem, 1.5rem + 1.5vw, 2.75rem);
  margin: var(--hb-space-2) 0;
}
#pricing .hb-tier__features {
  gap: var(--hb-space-3);
  padding: var(--hb-space-4) 0;
  border-top: 1px solid var(--hb-border);
  border-bottom: 1px solid var(--hb-border);
  margin: var(--hb-space-2) 0;
}
#pricing > .hb-container > div[style*="grid-template-columns"] {
  gap: clamp(1rem, 0.75rem + 1vw, 1.75rem) !important;
}

/* Featured tier ribbon: ensure AA contrast (already via indigo token swap) */
.hb-tier__ribbon {
  padding: 6px 14px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
}

/* =========================================================================
 * Override inline 3-col grids on tablet + mobile (portfolio, pricing, etc)
 * Inline styles need !important to defeat in CSS — using attribute selector
 * ========================================================================= */
@media (max-width: 1024px) {
  div[style*="grid-template-columns:repeat(3,1fr)"],
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 640px) {
  div[style*="grid-template-columns:repeat(3,1fr)"],
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
