/* =========================================================
   TSignature — Dark Premium + Editorial Minimal
   Phase 1 stylesheet
   ========================================================= */

:root {
  /* No pure black anywhere per design spec */
  --bg:        #15161a;
  --bg-alt:    #1a1c21;
  --card:      #202228;
  --card-hover:#262931;
  --line:      rgba(201, 169, 97, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);

  --gold:      #c9a961;
  --gold-soft: #e4cd97;
  --text:      #f5f3ee;   /* off-white */
  --muted:     #a9abb3;   /* silver / gray */

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.30);
  --radius: 14px;
  --max: 1120px;

  --font: 'Manrope', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Keep anchored sections clear of the fixed header (72px + breathing room) */
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container {
  width: min(100% - 40px, var(--max));
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: rgba(21, 22, 26, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: border-color .3s ease, background .3s ease;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  letter-spacing: .01em;
  font-size: 1.08rem;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-size: 1.05rem;
}
.brand-name { color: var(--text); }

.site-nav { display: flex; align-items: center; gap: 30px; }
.site-nav a {
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  transition: color .25s ease;
}
.site-nav a:hover { color: var(--gold); }

.lang-toggle {
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  transition: background .25s ease, color .25s ease;
}
.lang-toggle:hover { background: var(--gold); color: var(--bg); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  width: 40px; height: 40px;
  padding: 9px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
  border: 1px solid transparent;
  transition: transform .2s ease, background .25s ease, color .25s ease, border-color .25s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--gold { background: var(--gold); color: #17171a; }
.btn--gold:hover { background: var(--gold-soft); }
.btn--ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn--sm { padding: 9px 20px; font-size: .85rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 120px 0 80px;
}
.hero-glow {
  position: absolute;
  right: -140px; top: 6%;
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(201,169,97,.12), transparent 68%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.eyebrow, .section-label {
  color: var(--gold);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin: 0 0 18px;
}
.hero-title {
  margin: 0;
  font-size: clamp(3.2rem, 11vw, 8.5rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.04em;
}
.accent { color: var(--gold); }
.hero-tagline {
  margin: 22px 0 10px;
  font-size: clamp(1.15rem, 3vw, 1.8rem);
  font-weight: 600;
}
.hero-desc {
  margin: 0;
  max-width: 540px;
  color: var(--muted);
  font-size: 1rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section--alt { background: var(--bg-alt); }
.section-head { max-width: 660px; margin-bottom: 44px; }
.section-title {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.section-desc { margin: 0; color: var(--muted); }

/* ---------- Grid & Cards ---------- */
.grid { display: grid; gap: 22px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--line);
  background: var(--card-hover);
}
.card-tag {
  align-self: flex-start;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 20px;
}
.card-icon {
  color: var(--gold);
  font-size: 1.6rem;
  margin-bottom: 14px;
}
.card-title { margin: 0 0 10px; font-size: 1.18rem; font-weight: 700; }
.card-desc { margin: 0 0 20px; color: var(--muted); font-size: .92rem; }
.card .btn { margin-top: auto; align-self: flex-start; }
.card--empty { border-style: dashed; }
.empty-state {
  margin-top: auto;
  display: inline-block;
  color: var(--gold-soft);
  background: rgba(201,169,97,.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: .82rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 34px 0;
  background: var(--bg-alt);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: .85rem;
}
.footer-meta { margin: 0; }

/* ---------- Modals / Popups ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 11, 13, .78);
  backdrop-filter: blur(6px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative;
  width: min(100%, 680px);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 42px;
  animation: popIn .25s ease both;
}
.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  transition: color .2s ease, border-color .2s ease;
}
.modal-close:hover { color: var(--gold); border-color: var(--gold); }
.modal-title { margin: 0 0 18px; font-size: 1.8rem; font-weight: 800; }
.modal-body p { margin: 0 0 14px; color: var(--muted); }
.modal-body p:last-child { margin-bottom: 0; }

@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Reveal on scroll (subtle) ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Tool cards ---------- */
.tool-card { cursor: pointer; }
.card-action {
  margin-top: auto;
  color: var(--gold);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.tool-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- PDF Presentation (Empty State) ---------- */
.presentation-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(201, 169, 97, 0.04);
  padding: 72px 28px;
  text-align: center;
}
.presentation-icon {
  display: block;
  color: var(--gold);
  font-size: 2.6rem;
  margin-bottom: 16px;
}
.presentation-empty h3 { margin: 0 0 10px; font-size: 1.3rem; font-weight: 700; }
.presentation-empty p { margin: 0 auto; max-width: 520px; color: var(--muted); font-size: .92rem; }

/* ---------- Tool modals (large, embedded original tools) ---------- */
.modal--tool {
  width: min(100%, 1120px);
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tool-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.tool-modal-bar .section-label { margin: 0 0 2px; font-size: .62rem; }
.tool-modal-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.tool-modal-bar .modal-close { position: static; flex: 0 0 auto; }
.tool-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: min(78vh, 820px);
  background: #ffffff;
}
.tool-frame { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 14px 20px 20px;
    background: rgba(21,22,26,.97);
    border-bottom: 1px solid var(--line-soft);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 10px 4px; }
  .lang-toggle { align-self: flex-start; margin-top: 8px; }

  .nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .section { padding: 70px 0; }

  /* Full-screen modal on mobile so embedded tools (Phase 2) aren't squeezed */
  .modal-overlay { padding: 0; }
  .modal {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: 64px 24px 28px;
  }
  .modal--tool { padding: 0; }
  .tool-frame-wrap { height: auto; }
  .presentation-empty { padding: 48px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
