/* ================================================================
   LAYOUT — hero, sections, features, footer,
            responsive breakpoints
   Colours consume Tier 2 semantic tokens from css/tokens.css.
   Exception: the footer is a permanently dark surface — it uses
   fixed primitives on purpose so it never inverts with the theme.
   ================================================================ */

/* ── Hero ── */
.hero {
  position: relative; min-height: auto; display: flex; align-items: center;
  justify-content: center;
  padding: 40px 24px 70px; overflow: hidden;
  background: var(--surface-body);
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,94,145,0.1) 1px, transparent 1px);
  background-size: 28px 28px;
}
.hero-sub { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 36px; line-height: 1.8; font-weight: 400; }
.hero h1 { font-size: 3.2rem; font-weight: 800; line-height: 1.2; margin-bottom: 20px; color: var(--text-ink); }
.hero h1 .highlight { background: linear-gradient(135deg, var(--pink), var(--magenta)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat       { display: flex; flex-direction: column; flex: 1; padding: 20px 16px; border-right: 1px solid rgba(255,100,200,0.1); }
.stat:last-child { border-right: none; }
.stat-num   { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--pink), var(--purple-400)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-label { font-size: 0.85rem; color: var(--text-tertiary); font-weight: 500; margin-top: 2px; }

/* ── Sections ── */
.section     { padding: 100px 0; position: relative; }
.section-header      { text-align: center; margin-bottom: 60px; }
.section-header h2   { font-size: 2.5rem; font-weight: 800; margin: 16px 0; color: var(--text-ink); }
.section-header p    { color: var(--text-secondary); font-size: 1.1rem; max-width: 700px; margin: 0 auto; font-weight: 500; }

/* ── Upload area ── */
.upload-area {
  border: 3px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 80px 40px; text-align: center;
  transition: var(--transition); cursor: pointer;
  background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(248,249,250,0.5));
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-card) 80%, transparent), light-dark(rgba(248,249,250,0.5), rgba(36,31,54,0.5)));
}
.upload-area:hover, .upload-area.dragover { border-color: var(--brand); background: linear-gradient(135deg, rgba(255,94,145,0.05), rgba(168,85,247,0.05)); box-shadow: 0 8px 32px rgba(255,94,145,0.15); transform: translateY(-2px); }
.upload-icon { margin-bottom: 20px; }
.upload-icon .material-icons-round { font-size: 80px; background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.upload-area h3  { font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; color: var(--text-ink); }
.upload-area p   { color: var(--text-secondary); font-weight: 500; }
.upload-hint     { font-size: 0.9rem !important; margin: 12px 0 28px !important; color: var(--text-tertiary); font-weight: 500; }
.file-preview { max-width: 550px; margin: 32px auto 0; background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,249,250,0.8)); background: linear-gradient(135deg, color-mix(in srgb, var(--surface-card) 95%, transparent), light-dark(rgba(248,249,250,0.8), rgba(36,31,54,0.8))); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255,94,145,0.1); }
.file-info    { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.file-icon    { font-size: 48px; color: var(--brand); }
.file-name    { font-weight: 700; color: var(--text-ink); }
.file-size    { font-size: 0.9rem; color: var(--text-tertiary); }

/* ── Exam notices ── */
.exam-no-match   { background: linear-gradient(135deg, rgba(255,193,7,0.1), rgba(255,152,0,0.1)); background: linear-gradient(135deg, light-dark(rgba(255,193,7,0.1), rgba(51,41,15,0.1)), light-dark(rgba(255,152,0,0.1), rgba(46,32,18,0.1))); border: 1px solid rgba(255,152,0,0.3); border-radius: var(--radius-sm); padding: 20px; margin-bottom: 24px; }
.no-match-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--warning-fg); font-size: 1rem; font-weight: 700; }
.no-match-header .material-icons-round { color: var(--amber); font-size: 22px; }
.no-match-list   { list-style: disc; padding-left: 32px; color: var(--warning-fg); font-size: 0.95rem; }
.no-match-list li { margin-bottom: 6px; }
.exam-empty  { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.exam-empty .material-icons-round { font-size: 80px; background: linear-gradient(135deg, rgba(255,94,145,0.2), rgba(168,85,247,0.2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 16px; }

/* ── Features ── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.feature-card  { background: var(--surface-card); border-radius: 20px; padding: 36px; box-shadow: 0 2px 16px rgba(0,0,0,0.06); border: 1.5px solid rgba(0,0,0,0.06); transition: var(--transition); position: relative; overflow: hidden; }
.feature-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--pink), var(--purple-400)); opacity: 0; transition: opacity 0.3s; }
.feature-card:hover::before { opacity: 1; }
.feature-card:hover { transform: translateY(-6px); box-shadow: 0 12px 40px rgba(255,94,145,0.12); border-color: rgba(255,94,145,0.15); }
.feature-icon { width: 60px; height: 60px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.feature-icon .material-icons-round { font-size: 28px; }
/* Feature tiles are a deliberately multi-hue decorative set — primitives, one per hue family. */
.feature-card:nth-child(1) .feature-icon { background: linear-gradient(135deg, var(--pink-light), var(--pink-200)) !important; }
.feature-card:nth-child(1) .feature-icon .material-icons-round { color: var(--brand); }
.feature-card:nth-child(2) .feature-icon { background: linear-gradient(135deg, var(--blue-light), var(--blue-300)) !important; }
.feature-card:nth-child(2) .feature-icon .material-icons-round { color: var(--blue-600); }
.feature-card:nth-child(3) .feature-icon { background: linear-gradient(135deg, var(--yellow-100), var(--amber-200)) !important; }
.feature-card:nth-child(3) .feature-icon .material-icons-round { color: var(--amber-strong); }
.feature-card:nth-child(4) .feature-icon { background: linear-gradient(135deg, var(--purple-light), var(--purple-300)) !important; }
.feature-card:nth-child(4) .feature-icon .material-icons-round { color: var(--accent-strong); }
.feature-card h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--text-ink); font-weight: 700; }
.feature-card p  { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; font-weight: 400; }

/* ── KaTeX math rendering ── */
.katex { font-size: 1em; }
.katex-display { overflow-x: auto; overflow-y: hidden; }

/* ── Footer ──
   Permanently dark surface: uses fixed primitives (not --text-inverse /
   --text-tertiary) so a dark theme cannot invert it into unreadable. */
footer { background: linear-gradient(135deg, var(--dark), var(--dark-deeper)); color: var(--white); padding: 60px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
.footer-brand h3 { font-size: 1.5rem; margin-bottom: 12px; font-weight: 800; background: var(--gradient-brand); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.footer-brand p  { color: var(--gray-cool); font-size: 0.95rem; line-height: 1.7; }
.footer-bottom   { border-top: 1px solid rgba(255,255,255,0.05); /* on-accent */ padding-top: 28px; text-align: center; color: var(--gray); font-size: 0.9rem; }

/* ── Access expired overlay ── */
#access-expired-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: var(--scrim-strong); backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
}
#access-expired-overlay.active { display: flex; }

/* ── Responsive breakpoints ── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1     { font-size: 2.8rem; }
}

@media (max-width: 768px) {
  .section    { padding: 60px 0; }
  .hero       { padding: 40px 24px 60px; }
  .hero h1    { font-size: 2.2rem; }
  .hero-sub   { font-size: 1rem; }
  .stat-num   { font-size: 1.6rem; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-grid   { grid-template-columns: 1fr; gap: 24px; }
  .footer-brand  { display: none; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.9rem; }
  .stat { border-right: none; border-bottom: 1px solid rgba(255,100,200,0.1); }
  .stat:last-child { border-bottom: none; }
  .container { padding: 0 16px; }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 1.7rem; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .hero { padding: 30px 24px 40px; }
  .hero h1 { font-size: 1.8rem; }
}

/* ================================================================
   POST-LOGIN SHELL (.ec-post-login)
   เฟรมเดียว — พื้นหลังอ่อน + แยกจาก landing (#page-home ไม่ใช้คลาสนี้)
   ================================================================ */
#page-gym.ec-post-login.page {
  min-height: 100dvh;
  background: var(--gm-surface-workspace, var(--surface-page));
}
