/* SolveDemy — site styles on top of the Waranyu brand kit (assets/brand/brand.css).
   Rules followed: ivory ground, charcoal dark sections, cobalt signal, accents sparingly,
   square corners (pills only for buttons/chips/badges), borders not shadows, mono meta labels. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--surface); color: var(--text);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:lang(th), .th { font-family: var(--font-thai); line-height: 1.75; }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-xs); }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--charcoal); color: var(--ivory); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 clamp(20px, 4vw, var(--space-7)); }
.meta { font: 400 12px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0; }
.muted { color: var(--text-muted); }
.ph { font-style: normal; color: var(--text-muted); }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark img { width: 34px; height: 34px; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1; }
.wm-name { font: 700 22px/1 var(--font-display); letter-spacing: -.04em; }
.wm-by { font: 400 10.5px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-top: 4px; }
.site-nav { display: flex; gap: clamp(14px, 2.4vw, 32px); }
.site-nav a { font: 500 14px/1 var(--font-ui); text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; transition: border-color .25s var(--ease); }
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--cobalt); }
@media (max-width: 560px) { .site-nav a:nth-child(n+2) { display: none; } }

/* Sections */
.section { padding: clamp(88px, 10vw, var(--space-9)) 0; }
.section.tight { padding: clamp(56px, 6vw, 96px) 0; }
.section-alt { background: var(--ivory-2); }
.section-dark { background: var(--charcoal); color: var(--ivory); }
.section-cobalt { background: var(--cobalt); color: #fff; }
.section-head {
  display: flex; align-items: center; gap: var(--space-4);
  border-top: 2px solid var(--line-strong); padding-top: var(--space-4); margin-bottom: clamp(48px, 6vw, var(--space-8));
  font: 400 12px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
}
.sh-num { color: var(--accent); font-weight: 500; }
.sh-rule { flex: 1; height: 1px; background: var(--line); }
.sh-meta { color: var(--text-muted); text-align: right; }

/* Type */
.display { font: 600 clamp(48px, 9.2vw, 132px)/.92 var(--font-display); letter-spacing: -.045em; margin: 0; }
.chapter-title { font: 600 clamp(38px, 5.4vw, 76px)/.95 var(--font-display); letter-spacing: -.045em; margin: 0; }
.headline { font: 600 clamp(26px, 2.6vw, 36px)/1.05 var(--font-display); letter-spacing: -.03em; margin: 0; }
.lead { font: 400 clamp(20px, 1.9vw, 27px)/1.38 var(--font-body); letter-spacing: -.012em; margin: 0 0 var(--space-5); }
.thai-line { font: 500 clamp(17px, 1.5vw, 21px)/1.7 var(--font-thai); color: var(--text-muted); margin: 0; }
.em-orange { color: var(--orange-ink); }
.hl { background: linear-gradient(transparent 62%, var(--lime) 62%, var(--lime) 92%, transparent 92%); }
.section-dark .hl, .section-cobalt .hl { background: none; color: var(--lime); }

/* Buttons, chips, badges */
.btn {
  display: inline-flex; align-items: center; gap: 10px; border-radius: var(--radius-pill);
  font: 500 15px/1 var(--font-ui); padding: 15px 24px; text-decoration: none; border: 1px solid transparent;
  transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: #1c3fb8; }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--charcoal); color: var(--ivory); }
.section-dark .btn-primary { background: var(--lime); color: var(--charcoal); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: var(--space-6) 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-6); }
.chip {
  font: 500 13.5px/1 var(--font-ui); border-radius: var(--radius-pill); border: 1px solid var(--line-strong);
  padding: 10px 16px; background: transparent; color: var(--text); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--charcoal); color: var(--ivory); }

.badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-badge);
  font: 500 10.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 6px 8px;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-live { background: var(--status-verified-bg); color: var(--status-verified-fg); }
.badge-preview { background: var(--status-owner-bg); color: var(--status-owner-fg); }
.badge-placeholder { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.badge-lock { background: rgba(32,36,44,.07); color: var(--text); }

/* Hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ""; position: absolute; inset: 0; background: url("brand/patterns/dot-lattice.svg") repeat;
  background-size: 560px 388px; opacity: .35; pointer-events: none;
}
.hero .wrap { position: relative; }
.hero-inner { padding-top: clamp(64px, 9vw, 140px); padding-bottom: clamp(56px, 7vw, 112px); }
.hero-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 28px; align-items: end; margin-top: clamp(40px, 5vw, 72px); }
.hero-grid .display { grid-column: 1 / span 8; }
.hero-grid .hero-intro { grid-column: 9 / span 4; }
.hero-tagline { margin-top: clamp(40px, 5vw, 72px); display: flex; flex-wrap: wrap; gap: 6px 18px; font: 600 clamp(15px, 1.4vw, 19px)/1 var(--font-display); letter-spacing: -.01em; }
.hero-tagline span { padding: 4px 0; }
.hero-tagline span.on { background: linear-gradient(transparent 55%, var(--lime) 55%); }
@media (max-width: 960px) {
  .hero-grid .display, .hero-grid .hero-intro { grid-column: 1 / -1; }
}

/* Directory */
.brand-group + .brand-group { margin-top: clamp(56px, 6vw, 88px); }
.brand-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.brand-group-head h3 { margin: 0; }
.brand-group-head a { font: 500 14px/1 var(--font-ui); text-decoration: none; color: var(--cobalt); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 28px; }
.card { border: 1px solid var(--line); background: var(--surface-raised); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.card-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.card-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); flex: 1; }
.card-path { color: var(--cobalt); }
.card-title { font: 600 24px/1.1 var(--font-display); letter-spacing: -.02em; margin: 0; }
.card-summary { margin: 0; color: var(--text-muted); font-size: 15.5px; line-height: 1.55; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: var(--space-4); border-top: 1px solid var(--line); }
.card-arrow { font: 500 22px/1 var(--font-display); color: var(--cobalt); transition: transform .3s var(--ease); }
.card:hover .card-arrow { transform: translateX(4px); }
.card[hidden] { display: none; }

.plate {
  aspect-ratio: 4 / 3; max-height: 220px; width: 100%;
  display: grid; place-items: center; background: var(--ivory-2) url("brand/patterns/hex-lattice.svg");
  background-size: 280px 194px; border-bottom: 1px solid var(--line);
}
.plate img { width: min(62%, 260px); height: auto; mix-blend-mode: multiply; }
.plate-text { font: 600 26px/1 var(--font-display); letter-spacing: -.03em; color: var(--text-muted); border: 1px dashed var(--line-strong); padding: 14px 18px; background: var(--ivory); }
.plate-lg { max-height: none; aspect-ratio: 16 / 10; }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.steps li { padding: var(--space-5) var(--space-5) var(--space-6) 0; border-right: 1px solid var(--line); }
.steps li + li { padding-left: var(--space-5); }
.steps li:last-child { border-right: 0; }
.step-num { font: 600 64px/.9 var(--font-display); letter-spacing: -.05em; display: block; margin-bottom: var(--space-5); }
.step-num .o { color: transparent; -webkit-text-stroke: 1.2px var(--text); }
.step-num .f { color: var(--cobalt); }
.steps h3 { font: 600 22px/1.1 var(--font-display); letter-spacing: -.02em; margin: 0 0 var(--space-3); }
.steps p { margin: 0; color: var(--text-muted); font-size: 15.5px; }
@media (max-width: 960px) { .steps { grid-template-columns: 1fr 1fr; } .steps li { border-bottom: 1px solid var(--line); } .steps li:nth-child(2n) { border-right: 0; } .steps li:nth-child(2n+1) { padding-left: 0; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } .steps li { border-right: 0; padding-left: 0 !important; } }

.method { margin-top: clamp(40px, 5vw, 64px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.method span:not(.meta) { font: 500 15px/1 var(--font-ui); }
.method .arrow { color: var(--cobalt); }

/* Access (dark) */
.section-dark .section-head { border-top-color: var(--ivory); }
.section-dark .sh-rule { background: rgba(244,241,233,.16); }
.section-dark .meta, .section-dark .sh-meta, .section-dark .muted { color: #A9ADB5; }
.split { display: grid; grid-template-columns: repeat(12, 1fr); gap: 28px; }
.split > :first-child { grid-column: 1 / span 7; }
.split > :last-child { grid-column: 9 / span 4; }
@media (max-width: 960px) { .split > :first-child, .split > :last-child { grid-column: 1 / -1; } }
.facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(244,241,233,.16); }
.facts li { padding: 16px 0; border-bottom: 1px solid rgba(244,241,233,.16); display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.facts li::before { content: "→"; color: var(--lime); font-family: var(--font-display); }

/* Breadcrumbs + entry page */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 var(--space-6); padding: 0; list-style: none; }
.crumbs li { font: 400 12px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); opacity: .4; }
.crumbs a { color: var(--cobalt); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.entry-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 28px; align-items: start; }
.entry-main { grid-column: 1 / span 7; }
.entry-side { grid-column: 9 / span 4; }
@media (max-width: 960px) { .entry-main, .entry-side { grid-column: 1 / -1; } }
.entry-question { font: 600 clamp(24px, 2.4vw, 32px)/1.2 var(--font-thai); letter-spacing: -.02em; color: var(--cobalt); margin: var(--space-5) 0; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 44px 1fr; gap: 8px; }
.list li .meta { padding-top: 4px; color: var(--cobalt); }
.panel { border: 1px solid var(--line-strong); background: var(--surface-raised); padding: var(--space-5); }
.panel h2 { font: 600 24px/1.1 var(--font-display); letter-spacing: -.02em; margin: 8px 0 var(--space-4); }
.panel p { margin: 0 0 var(--space-4); font-size: 15.5px; }
.panel .btn { width: 100%; justify-content: center; }
.kv { margin: var(--space-5) 0 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 15px; }
.kv dt { font: 400 12px/1.6 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.kv dd { margin: 0; }
.placeholder-note { border-left: 3px solid var(--orange); background: var(--status-pending-bg); padding: 14px 18px; margin: var(--space-5) 0 0; font-size: 15px; }

/* Notice */
.notice-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 48px; align-items: end; }
@media (max-width: 960px) { .notice-grid { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { background: var(--charcoal); color: var(--ivory); padding: clamp(64px, 8vw, 120px) 0 40px; }
.footer-close { font: 600 clamp(32px, 4.6vw, 64px)/1 var(--font-display); letter-spacing: -.045em; margin: 0 0 clamp(48px, 6vw, 88px); max-width: 16ch; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; border-top: 1px solid rgba(244,241,233,.16); padding-top: 20px; }
.site-footer .tagline { font: 600 15px/1 var(--font-display); color: var(--lime); margin: 0; letter-spacing: .01em; }
.site-footer .meta { color: #A9ADB5; }
.site-footer .meta a { color: var(--ivory); text-decoration: none; }
.site-footer .meta a:hover { text-decoration: underline; }
.footer-note { margin-top: 16px; }

/* Motion */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card, .btn, .card-arrow { transition: none; }
}

/* Spacing helpers (no inline styles: the site's CSP blocks them) */
.intro { max-width: 46ch; margin-top: 28px; }
.block-gap { margin-top: 56px; }
.title-gap { margin-bottom: 56px; }
.access-lead { margin-top: 32px; max-width: 34ch; }
.cards-gap { margin-top: 72px; }
.inside-title { margin: 56px 0 20px; }
.entry-badges { margin: 0 0 20px; }
.entry-main .intro { max-width: none; }
.side-back { margin-top: 20px; }
