/* STEP 19C — shared brand language. Loaded last on customer-facing pages. */

:root {
  --brand-primary: #0b1f3a;
  --brand-secondary: #153455;
  --brand-background: #07111f;
  --brand-surface: #ffffff;
  --brand-surface-soft: #f4f5f3;
  --brand-text: #142033;
  --brand-muted: #647083;
  --brand-border: #dce1e7;
  --brand-accent: #c79a3b;
  --brand-accent-hover: #ddb75f;
  --brand-success: #18734b;
  --brand-warning: #9a6612;
  --brand-danger: #a7332b;
  --brand-focus: rgba(221, 183, 95, 0.58);
  --brand-radius-sm: 0.5rem;
  --brand-radius-md: 0.9rem;
  --brand-shadow-soft: 0 0.7rem 2rem rgba(5, 17, 31, 0.08);

  /* Keep legacy components on one palette without rewriting them. */
  --color-navy: var(--brand-primary);
  --color-navy-deep: var(--brand-background);
  --color-navy-soft: var(--brand-secondary);
  --color-gold: var(--brand-accent);
  --color-gold-bright: var(--brand-accent-hover);
  --color-text: var(--brand-text);
  --color-muted: var(--brand-muted);
  --color-line: var(--brand-border);
  --surface: var(--brand-surface);
  --surface-soft: var(--brand-surface-soft);
  --text: var(--brand-text);
  --text-muted: var(--brand-muted);
  --border: var(--brand-border);
  --accent: var(--brand-accent);
  --accent-bright: var(--brand-accent-hover);
}

html {
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  overflow-x: clip;
  font-family: var(--font-body);
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a,
button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--brand-focus);
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid rgba(221, 183, 95, 0.18);
  background: rgba(5, 13, 24, 0.94);
  box-shadow: 0 0.35rem 1.5rem rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(100%, 92rem);
  max-width: 92rem;
  min-height: 4.5rem;
  padding-block: 0.55rem;
}

.brand {
  flex-shrink: 0;
}

.brand-logo-header {
  width: 2.9rem;
  height: 2.9rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.75),
    0 0 0 3px rgba(40, 94, 194, 0.58);
}

.brand-name {
  font-size: clamp(1.02rem, 2vw, 1.28rem);
  letter-spacing: 0.12em;
}

.brand-tagline {
  color: #aeb8c7;
  font-size: 0.7rem;
}

.site-nav {
  min-width: 0;
}

.nav-list a {
  min-height: 2.75rem;
  border-radius: var(--brand-radius-sm);
  color: #dce3ec;
  font-weight: 400;
}

.nav-list a:hover,
.nav-list a:focus-visible,
.nav-list a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
}

.nav-search-link::before {
  content: "⌕";
  margin-right: 0.35rem;
  color: var(--brand-accent-hover);
  font-size: 1.05em;
}

.cart-nav-link {
  border: 1px solid rgba(221, 183, 95, 0.38) !important;
  color: var(--brand-accent-hover) !important;
}

.header-mobile-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin-left: auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(221, 183, 95, 0.38);
  border-radius: var(--brand-radius-sm);
  color: var(--brand-accent-hover);
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
}

.nav-toggle {
  min-width: 3.25rem;
  min-height: 2.75rem;
  border-color: rgba(221, 183, 95, 0.42);
}

.nav-toggle::after {
  content: "เมนู";
  margin-left: 0.35rem;
  color: #fff;
  font-size: 0.68rem;
}

.nav-toggle[aria-expanded="true"]::after {
  content: "ปิด";
}

.btn,
.product-card-cta,
.product-card-cart-btn {
  min-height: 2.75rem;
  border-radius: var(--brand-radius-sm);
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.btn-primary {
  border-color: var(--brand-accent);
  background: var(--brand-accent);
  color: #0a1422 !important;
  box-shadow: none;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  border-color: var(--brand-accent-hover);
  background: var(--brand-accent-hover);
  transform: translateY(-1px);
}

.btn-navy {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: #fff !important;
}

body[data-page="product"] .detail-buy-btn {
  border-color: var(--brand-accent);
  background: var(--brand-accent);
  color: #0a1422 !important;
}

body[data-page="product"] .detail-buy-btn:hover,
body[data-page="product"] .detail-buy-btn:focus-visible {
  border-color: var(--brand-accent-hover);
  background: var(--brand-accent-hover);
  color: #0a1422 !important;
}

.btn:disabled,
button:disabled,
[aria-disabled="true"] {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none !important;
}

body[data-page="home"] .hero {
  min-height: min(72svh, 36rem);
}

body[data-page="home"] .hero-layout {
  gap: 1.25rem 2rem;
  width: min(100% - 2rem, 64rem);
  max-width: 64rem;
  margin-inline: auto;
  padding-block: clamp(1.75rem, 5vw, 3rem);
}

body[data-page="home"] .brand-logo-hero {
  width: min(42vw, 12.5rem);
  height: min(42vw, 12.5rem);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 0 5px rgba(25, 80, 200, 0.85),
    0 14px 32px rgba(0, 0, 0, 0.45);
}

body[data-page="home"] .hero-brand-lockup {
  gap: 0.45rem;
}

body[data-page="home"] .hero-brand-wordmark {
  font-size: clamp(1.85rem, 4.8vw, 3.25rem);
}

body[data-page="home"] .hero-subbrand {
  margin-top: 0.25rem;
  font-size: clamp(0.92rem, 1.8vw, 1.12rem);
}

body[data-page="home"] .hero-title {
  max-width: 20ch;
  margin-top: 0.7rem !important;
  font-size: clamp(1.35rem, 3.2vw, 2.35rem);
  line-height: 1.22;
}

body[data-page="home"] .hero-slogan {
  max-width: 42ch;
  color: #d3dae4;
  font-size: clamp(0.92rem, 1.5vw, 1.02rem);
}

body[data-page="home"] .hero-actions {
  margin-top: 1.25rem;
}

body[data-page="home"] .hero-actions .btn {
  min-width: min(100%, 10.5rem);
}

body[data-page="home"] .hero-visual {
  min-height: clamp(15rem, 38vw, 22rem);
}

body[data-page="home"] .hero-showcase {
  width: min(48vw, 22rem);
}

@media (min-width: 960px) {
  body[data-page="home"] .hero-layout {
    min-height: min(68svh, 32rem);
    padding-block: clamp(2rem, 5vh, 3.25rem);
  }

  body[data-page="home"] .hero-showcase {
    width: min(30vw, 22rem);
  }
}

body[data-page="home"] .hero-slide {
  color: inherit;
  cursor: pointer;
}

body[data-page="home"] .hero-slide[aria-hidden="true"] {
  pointer-events: none;
}

body[data-page="home"] .hero-dot {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-radius: 999px;
}

body[data-page="home"] .hero-visual--fallback .hero-showcase,
body[data-page="home"] .hero-visual--fallback .hero-brand-dots,
body[data-page="home"] .hero-visual--fallback .hero-brand-label,
body[data-page="home"] .hero-visual--fallback .hero-product-meta {
  display: none;
}

body[data-page="home"] .check-list {
  grid-template-columns: 1fr;
}

body[data-page="home"] .check-list li {
  border: 1px solid rgba(221, 225, 231, 0.14);
  background: rgba(255, 255, 255, 0.045);
}

body[data-page="home"] .check-mark {
  color: var(--brand-accent-hover);
}

body[data-page="home"] .section-head,
body[data-page="home"] .product-card,
body[data-page="home"] .how-step,
body[data-page="home"] .check-list li,
body[data-page="home"] .brand-chip {
  animation: none;
}

body[data-page="home"] .product-card-cta,
body[data-page="home"] .product-card-cart-btn,
body[data-page="products"] .product-card-cta,
body[data-page="products"] .product-card-cart-btn {
  min-height: 2.75rem;
}

.catalog-state,
.products-empty,
.product-not-found,
.checkout-blocked {
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-surface);
  color: var(--brand-text);
  box-shadow: var(--brand-shadow-soft);
}

.catalog-state,
.product-not-found {
  gap: 0.8rem;
}

.catalog-state h1,
.catalog-state h2,
.products-empty h3,
.product-not-found h1 {
  color: var(--brand-text) !important;
}

.catalog-state p,
.products-empty p,
.product-not-found p {
  color: var(--brand-muted) !important;
}

.cart-section {
  width: min(100% - 2rem, 78rem);
  max-width: 78rem;
  padding-block: clamp(2rem, 5vw, 4.5rem);
}

.cart-layout,
.checkout-layout {
  gap: clamp(1rem, 3vw, 2rem);
}

.cart-list-panel,
.cart-summary-panel,
.checkout-form-panel,
.checkout-summary-panel,
.checkout-blocked,
.premium-empty-state {
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-md);
  background: var(--brand-surface);
  box-shadow: var(--brand-shadow-soft);
}

.cart-list-panel h1,
.checkout-form-panel h1,
.premium-empty-state h1 {
  color: var(--brand-text) !important;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.15;
}

.cart-item {
  overflow: hidden;
}

.cart-media {
  aspect-ratio: 1 / 1;
  background: var(--brand-surface-soft);
}

.cart-media .product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart-image-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  color: var(--brand-muted);
  font-size: 0.74rem;
  text-align: center;
}

.cart-image-fallback[hidden] {
  display: none !important;
}

.cart-item-price,
.cart-total-row dd {
  color: var(--brand-text) !important;
  font-family: var(--font-display);
}

.cart-summary-panel .btn,
.checkout-form-panel .btn {
  width: 100%;
}

.cart-item-warn,
.cart-block-msg {
  color: var(--brand-danger) !important;
  font-weight: 600;
}

.premium-empty-state {
  display: grid;
  justify-items: start;
  gap: 0.8rem;
  max-width: 44rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  color: var(--brand-text);
}

.premium-empty-state p {
  color: var(--brand-muted);
}

.empty-state-eyebrow {
  color: var(--brand-accent) !important;
  font: 600 0.75rem/1 var(--font-display);
  letter-spacing: 0.14em;
}

#checkout-errors {
  margin-bottom: 1rem;
  border: 1px solid rgba(167, 51, 43, 0.25);
  border-radius: var(--brand-radius-sm);
  background: #fff4f2;
  color: var(--brand-danger);
}

#checkout-form [aria-invalid="true"] {
  border-color: var(--brand-danger);
  box-shadow: 0 0 0 3px rgba(167, 51, 43, 0.12);
}

.site-footer {
  border-top: 1px solid rgba(221, 183, 95, 0.2);
  background: #050b14;
}

.footer-inner {
  width: min(100%, 92rem);
  max-width: 92rem;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.footer-brand {
  align-content: start;
}

.brand-logo-footer {
  width: 4.5rem;
  height: 4.5rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.68),
    0 0 0 3px rgba(40, 94, 194, 0.52);
}

.footer-name {
  color: #fff;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
}

.footer-store,
.footer-slogan,
.footer-contact {
  color: #aeb8c7;
}

.footer-links {
  align-content: start;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: #d9e0e9;
}

.footer-links a:hover,
.footer-links a:focus-visible,
.footer-contact a {
  color: var(--brand-accent-hover);
}

@media (min-width: 700px) {
  body[data-page="home"] .check-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .header-mobile-cart {
    display: none;
  }

  .site-nav {
    flex: 1;
  }

  .nav-list {
    width: 100%;
  }

  .nav-list .nav-utility-start {
    margin-left: auto;
  }

  .nav-list a {
    padding-inline: 0.75rem;
  }
}

@media (max-width: 959px) {
  .brand-text {
    display: none;
  }

  .site-nav {
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
  }

  .nav-list a {
    min-height: 3rem;
  }

  .nav-toggle {
    width: auto;
    padding-inline: 0.65rem;
  }
}

@media (max-width: 374px) {
  .header-inner {
    gap: 0.45rem;
    padding-inline: 0.75rem;
  }

  .brand-logo-header {
    width: 2.55rem;
    height: 2.55rem;
  }

  .header-mobile-cart {
    padding-inline: 0.52rem;
    font-size: 0.68rem;
  }

  .nav-toggle {
    min-width: 2.8rem;
    padding-inline: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
