/* Sky Network — True Online document portal
   Visual system per DESIGN.md. Self-hosted Noto Sans Thai, red/white Thai
   telecom look, mobile-first with a spacious desktop layout. */

@font-face {
  font-family: 'Noto Sans Thai';
  src: url('/assets/NotoSansThai.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --red: #E60023;
  --red-deep: #BC0924;
  --blue: #009DCE;
  --blue-dark: #007CA8;
  --pale-blue: #EDF9FD;
  --ink: #23252B;
  --secondary: #646974;
  --surface: #F6F7F9;
  --pale-red: #FFF1F3;
  --white: #FFFFFF;
  --line: #E4E6EB;
  --ok: #1B9C5B;

  --radius-control: 12px;
  --radius-frame: 24px;
  --maxw: 1120px;
  --gutter: 24px;

  --shadow-sm: 0 1px 2px rgba(35, 37, 43, 0.06), 0 2px 8px rgba(35, 37, 43, 0.05);
  --shadow-md: 0 6px 24px rgba(35, 37, 43, 0.10);
}

* { box-sizing: border-box; }

/* Finding #6: the native `hidden` attribute must always win, even over the
   dialog overlay's display rule. Without this, a `hidden` overlay (e.g. the
   success dialog) shows on initial page load. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

.nowrap { white-space: nowrap; }

body {
  margin: 0;
  font-family: 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  font-size: 16px;
}

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

a { color: var(--red-deep); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

@media (min-width: 768px) {
  :root { --gutter: 48px; }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 0 0 var(--radius-control) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(0, 157, 206, 0.45); outline-offset: 2px; }
.btn svg { flex: none; }

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); }
.btn-primary[disabled] { background: #F1A9B4; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--red-deep); border-color: transparent; }
.btn-ghost:hover { background: var(--pale-red); }

/* Secondary verification action (distinct blue from the red primary) */
#heroVerify { color: var(--blue-dark); }
#heroVerify:hover { background: var(--pale-blue); }

.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--red); color: var(--red-deep); }

.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.05rem; }

.btn-text {
  background: none; border: none; color: var(--red-deep);
  font-family: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  padding: 8px; min-height: 40px;
}
.btn-text:hover { text-decoration: underline; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(150%) blur(6px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 12px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--pale-red); color: var(--red);
  display: grid; place-items: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; white-space: nowrap; }
.brand-sub { font-size: .78rem; color: var(--secondary); }

.verify-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue-dark); font-weight: 600; font-size: .9rem;
  text-decoration: none; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line);
}
.verify-link:hover { background: var(--pale-blue); border-color: var(--blue); }

/* Notice bar */
.notice-bar { background: #FFF7E6; border-bottom: 1px solid #F3D98B; color: #7a5a00; }
.notice-bar .container { padding-block: 10px; font-size: .92rem; }

/* Hero */
/* Blush → white → subtle cyan; the cyan glow sits behind the hero art so its
   white bitmap rectangle blends away under mix-blend-mode: multiply. */
.hero {
  background:
    radial-gradient(120% 90% at 88% 18%, var(--pale-blue), transparent 60%),
    linear-gradient(180deg, var(--pale-red), #fff 88%);
}
.hero-inner {
  display: grid; grid-template-columns: 1fr; gap: 24px;
  padding-block: 40px 32px; align-items: center;
}
.hero-title {
  font-size: 32px; line-height: 1.2; margin: 0 0 12px; font-weight: 700; letter-spacing: -0.3px;
}
/* True Online in its brand red/blue pairing */
.hero-title .brand-true { color: var(--red); }
.hero-title .brand-online { color: var(--blue); }
.hero-desc { font-size: 1.05rem; color: #3a3d45; margin: 0 0 24px; max-width: 34ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-disclaimer { margin-top: 14px; font-size: .82rem; color: var(--secondary); }
.hero-art { justify-self: center; mix-blend-mode: multiply; }
.hero-art img { width: min(100%, 420px); height: auto; }

@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 1.05fr 0.95fr; gap: 40px; padding-block: 72px 56px; }
  .hero-title { font-size: 48px; }
}

/* Steps */
.steps { background: var(--white); }
.steps-inner { padding-block: 8px 8px; }
.step-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr; gap: 16px;
  transform: translateY(-24px);
}
.step {
  display: flex; gap: 14px; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-frame);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.step h3 { margin: 0 0 4px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--secondary); font-size: .95rem; }
.step-num {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--red); color: #fff; font-weight: 700;
  display: grid; place-items: center;
}
/* Second step in blue to echo the True Online red/blue pairing */
.step:nth-child(2) { background: var(--pale-blue); }
.step:nth-child(2) .step-num { background: var(--blue); }
@media (min-width: 820px) {
  .step-list { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

/* Upload section */
.upload-section { background: var(--surface); padding-block: 24px 56px; }
.upload-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 960px) {
  .upload-grid { grid-template-columns: 2fr 1fr; align-items: start; }
}

.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-frame); padding: 24px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .card { padding: 32px; } }

.card-title { margin: 0 0 20px; font-size: 1.4rem; }

.field-group { border: none; margin: 0 0 24px; padding: 0; }
.field-group legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 8px; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: .92rem; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--red); }

input[type=text], input[type=tel] {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-control);
  font-family: inherit; font-size: 1rem; color: var(--ink); background: #fff;
}
input[type=text]:focus, input[type=tel]:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 157, 206, 0.18);
}

.field-hint { font-size: .9rem; color: var(--secondary); margin: 0 0 12px; }
.field-hint.subtle { color: #8a5a00; background: #FFF7E6; padding: 8px 12px; border-radius: 10px; }

.id-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.id-actions .btn { flex: 1 1 180px; }

/* ID preview */
.id-preview {
  border: 1px solid var(--line); border-radius: var(--radius-frame);
  overflow: hidden; background: #fff;
}
.id-preview img { width: 100%; height: auto; max-height: 420px; object-fit: contain; background: #111; }
.id-preview-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.badge-ok {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ok); font-weight: 700; font-size: .92rem;
}

/* Thumbnails */
.thumb-grid {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px;
}
.thumb {
  position: relative; border-radius: var(--radius-control); overflow: hidden;
  border: 1px solid var(--line); aspect-ratio: 1; background: var(--surface);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-remove {
  position: absolute; top: 4px; right: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(35,37,43,0.72); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center;
}
.thumb-remove:hover { background: var(--red-deep); }

/* Consent */
.consent .checkbox {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 14px;
  font-size: .95rem; cursor: pointer;
}
.checkbox input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--red); flex: none; }

.form-status {
  border-radius: var(--radius-control); padding: 12px 14px; margin: 8px 0 16px;
  font-size: .95rem; font-weight: 600;
}
.form-status.error { background: var(--pale-red); color: var(--red-deep); border: 1px solid #F3B7C0; }
.form-status.info { background: #EAF3FF; color: #1b4f8a; border: 1px solid #BBD8F7; }

.form-foot-note { font-size: .82rem; color: var(--secondary); text-align: center; margin: 12px 0 0; }

/* Sidebar */
.side-card { position: sticky; top: 84px; }
.side-title { margin: 0 0 10px; font-size: 1.15rem; }
.side-text { color: var(--secondary); font-size: .95rem; margin: 0 0 16px; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.side-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.side-list svg { flex: none; color: var(--blue); margin-top: 2px; }
.side-divider { height: 1px; background: var(--line); margin: 18px 0; }
.side-note { font-size: .86rem; color: var(--secondary); margin: 0; }

/* FAQ */
.faq { background: #fff; padding-block: 48px 56px; }
.faq-title { text-align: center; margin: 0 0 24px; font-size: 1.6rem; }
.faq-item {
  border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 4px 18px; margin-bottom: 12px; background: #fff;
}
.faq-item summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; float: right; color: var(--red); font-weight: 700; }
.faq-item[open] summary::after { content: '–'; }
.faq-item p { margin: 0 0 14px; color: var(--secondary); }

/* Footer */
.site-footer { background: var(--ink); color: #E7E8EC; }
.footer-inner {
  display: flex; flex-direction: column; gap: 14px;
  padding-block: 28px; align-items: flex-start;
}
.footer-entity { margin: 0 0 4px; font-weight: 600; }
.footer-small { margin: 0; font-size: .84rem; color: #A9ADB8; }
.site-footer .verify-link { color: #fff; border-color: rgba(255,255,255,0.25); }
.site-footer .verify-link:hover { background: rgba(255,255,255,0.08); }
@media (min-width: 720px) {
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Dialogs */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 21, 25, 0.55);
  display: grid; place-items: center; padding: 16px;
}
.dialog {
  background: #fff; border-radius: var(--radius-frame);
  width: min(680px, 100%); max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.dialog-head h2 { margin: 0; font-size: 1.25rem; }
.dialog-close {
  background: none; border: none; cursor: pointer; color: var(--secondary);
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
}
.dialog-close:hover { background: var(--surface); color: var(--ink); }
.dialog-body { padding: 20px 24px; overflow-y: auto; }
.dialog-body:focus { outline: none; }
.dialog-body h3 { font-size: 1.02rem; margin: 20px 0 6px; }
.dialog-body h3:first-child { margin-top: 0; }
.dialog-body p, .dialog-body li { color: #3a3d45; font-size: .95rem; }
.dialog-body ul { padding-left: 20px; }
.dialog-body .policy-preview-flag {
  background: #FFF7E6; border: 1px solid #F3D98B; color: #7a5a00;
  padding: 12px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 16px;
}
.dialog-foot {
  display: flex; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.dialog-foot .btn { flex: 1 1 auto; }

/* Success dialog */
.dialog-success { text-align: center; padding: 32px 28px; align-items: center; }
.dialog-success h2 { margin: 12px 0 8px; }
.success-icon { color: var(--ok); }
.success-text { color: var(--secondary); margin: 0 0 12px; }
.success-ref { font-size: .95rem; margin: 0 0 20px; }
.dialog-success .btn { width: 100%; }

/* Spinner */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.5); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-busy .btn-label { opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
