/* ============================================================================
   koray-help global stylesheet
   Dark, gold-on-near-black language. Single source of truth for design tokens,
   base element styling, header/footer chrome, and the global .unfold fallback
   (so a raw .unfold block works even outside the Astro component).
   ========================================================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --bg: #0a0b0d;
  --bg-2: #101116;
  --surface: #16181d;        /* panels, cards */
  --surface-2: #1e2128;      /* table header, elevated rows */
  --surface-hover: #24272f;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(235, 199, 110, 0.28);

  --gold: #EBC76E;
  --gold-bright: #FFD97A;
  --gold-deep: #85713E;
  --gold-grad: linear-gradient(180deg, #F3D488 0%, #C79B45 100%);

  --text: #E7E3D9;
  --text-dim: #A9A599;
  --text-strong: #FFFFFF;
  --link: #F0D8A2;
  --link-hover: #FFE9B8;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --maxw: 1160px;

  --gap-section: 1.5rem;
  --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --panel-px: 2rem;
}

@media (max-width: 768px) {
  :root { --panel-px: 1.25rem; }
}
@media (max-width: 480px) {
  :root { --panel-px: 1.1rem; }
}

/* ---- Base ---------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  /* Guard against stray horizontal overflow (e.g. absolutely-positioned tooltips
     or glows). `clip` prevents sideways scroll WITHOUT breaking the sticky header
     the way `overflow-x: hidden` would (hidden turns the root into a scroll box). */
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(235, 199, 110, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { color: var(--link-hover); }

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

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

/* Visually hidden but accessible */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Site header --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 11, 13, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  font-size: 1.05rem;
}
.brand .mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--gold-grad);
  color: #1a1710;
  font-weight: 800;
  font-size: 0.95rem;
}
.brand .mark-accent { color: var(--gold); }
.brand .wordmark {
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 1.15rem;
}
/* Real UFABET logo (200x88 transparent). Sized by height per context. */
.brand-logo { height: 34px; width: auto; display: block; }
.foot-brand .brand-logo { height: 42px; }
.modal-brand .brand-logo { height: 30px; }
.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}
.site-header nav a { color: var(--text-dim); }
.site-header nav a:hover { color: var(--gold); }
.header-cta { display: flex; align-items: center; gap: 0.6rem; }
@media (max-width: 720px) {
  .site-header nav { display: none; }
}
@media (max-width: 420px) {
  .header-cta .btn-login { display: none; }
}

/* ---- Site footer --------------------------------------------------------- */
.site-footer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-top: 1px solid var(--border-gold);
  margin-top: 3.5rem;
  padding: 3rem 0 1.75rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  background:
    radial-gradient(760px 340px at 12% -8%, rgba(235, 199, 110, 0.16), transparent 62%),
    radial-gradient(720px 360px at 88% 6%, rgba(255, 217, 122, 0.12), transparent 60%),
    radial-gradient(1200px 560px at 50% 128%, rgba(235, 199, 110, 0.14), transparent 62%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
/* Thin gold rule glowing along the top edge. */
.site-footer::after {
  content: '';
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 122, 0.75), transparent);
  box-shadow: 0 0 18px 1px rgba(235, 199, 110, 0.45);
  z-index: 1;
}
/* Large glowing gold aura that gently breathes behind the footer content. */
.site-footer::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -55%;
  width: min(1100px, 96%);
  aspect-ratio: 2 / 1;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side, rgba(255, 217, 122, 0.26), rgba(235, 199, 110, 0.12) 45%, transparent 72%);
  filter: blur(34px);
  pointer-events: none;
  z-index: -1;
  animation: footer-aura 7s ease-in-out infinite;
}
@keyframes footer-aura {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.07); }
}
@media (prefers-reduced-motion: reduce) {
  .site-footer::before { animation: none; }
}
.site-footer > .container { position: relative; z-index: 1; }
.foot-top {
  display: grid;
  grid-template-columns: 1.3fr 2fr;
  gap: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.foot-brand .brand { margin-bottom: 0.9rem; }
.foot-brand p { max-width: 42ch; line-height: 1.65; margin-bottom: 1rem; }
.foot-pay { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.foot-pay span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(235, 199, 110, 0.08);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.7rem;
}
.foot-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.foot-col h3 {
  color: var(--text-strong);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.85rem;
}
.foot-col a,
.foot-col .foot-link-btn {
  display: block;
  color: var(--text-dim);
  padding: 0.28rem 0;
  font-size: 0.86rem;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  transition: color 0.15s ease;
}
.foot-col a:hover,
.foot-col .foot-link-btn:hover { color: var(--gold); }

.foot-legal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 0 1.25rem;
}
.foot-legal .disclaimer { max-width: 80ch; line-height: 1.6; }
.age-badge {
  display: inline-grid;
  place-items: center;
  min-width: 44px; height: 44px;
  padding: 0 0.5rem;
  border: 2px solid var(--gold-deep);
  color: var(--gold);
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.8rem;
  flex: none;
}
.foot-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  .foot-top { grid-template-columns: 1fr; gap: 1.75rem; }
  .foot-cols { gap: 1.25rem; }
  .foot-legal { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 460px) {
  .foot-cols { grid-template-columns: 1fr 1fr; }
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gold-grad);
  color: #191510;              /* dark text on gold, AA contrast */
}
.btn-primary:hover { color: #191510; filter: brightness(1.04); }
.btn-ghost {
  background: transparent;
  color: var(--gold);
  border-color: var(--border-gold);
}
.btn-ghost:hover { color: var(--gold-bright); border-color: var(--gold); }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.82rem; }
.btn-block { width: 100%; padding-block: 0.85rem; font-size: 0.95rem; }

/* ============================================================================
   Login modal (CSS-only, checkbox-toggled). The #login-toggle checkbox and the
   overlay live once in the layout; any <label for="login-toggle"> opens it.
   ========================================================================== */
.modal-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal-toggle:checked ~ .modal-overlay { display: flex; }
/* Lock background scroll while the modal is open. */
body:has(.modal-toggle:checked) { overflow: hidden; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.72);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  padding: 1.75rem;
  animation: modal-in 0.25s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-card { animation: none; }
}
.modal-close {
  position: absolute;
  top: 0.65rem; right: 0.85rem;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.modal-close:hover { background: var(--surface-2); color: var(--gold); }
.modal-brand { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.modal-card h2 { color: var(--text-strong); font-size: 1.3rem; font-weight: 700; margin-bottom: 0.35rem; }
.modal-sub { color: var(--text-dim); font-size: 0.88rem; line-height: 1.55; margin-bottom: 1.25rem; }

.login-form { display: grid; gap: 0.9rem; }
.field { display: grid; gap: 0.35rem; }
.field > span { color: var(--text); font-size: 0.82rem; font-weight: 600; }
.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-strong);
  font-size: 0.92rem;
}
.field input::placeholder { color: var(--text-dim); }
.field input:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(235, 199, 110, 0.18);
}
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
}
.remember { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-dim); cursor: pointer; }
.muted-link { color: var(--link); }
.modal-foot { margin-top: 1.1rem; font-size: 0.86rem; color: var(--text-dim); text-align: center; }
.modal-foot a { color: var(--link); font-weight: 600; }
.modal-fine { margin-top: 0.6rem; font-size: 0.74rem; color: var(--text-dim); text-align: center; }

/* ============================================================================
   Global .unfold fallback (CSS-only collapsible)
   The Astro <Unfold> component ships its own scoped copy; this block keeps raw
   .unfold markup working anywhere and defines shared behaviour.
   ========================================================================== */
.unfold {
  position: relative;
  text-align: center;
}
.unfold > input[type='checkbox'],
.unfold .unfold-check { display: none; }

.unfold-text {
  position: relative;
  max-height: 240px;
  overflow: hidden;
  transition: max-height 0.45s ease;
  text-align: left;
}
.unfold input[type='checkbox']:checked ~ .unfold-text,
.unfold .unfold-check:checked ~ .unfold-text,
.unfold.no-fold .unfold-text {
  max-height: 6000px;
}
.unfold-text::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 84px;
  background: linear-gradient(transparent, var(--fade-to, var(--surface, #16181d)));
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.unfold input[type='checkbox']:checked ~ .unfold-text::after,
.unfold .unfold-check:checked ~ .unfold-text::after,
.unfold.no-fold .unfold-text::after {
  opacity: 0;
}

.unfold-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(235, 199, 110, 0.10);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-pill);
  cursor: pointer;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
  transition: background 0.2s ease;
}
.unfold-arrow:hover { background: rgba(235, 199, 110, 0.20); }
.unfold-arrow .chev {
  transition: transform 0.3s ease;
  font-size: 0.7rem;
}
.unfold input[type='checkbox']:checked ~ .unfold-arrow .chev,
.unfold .unfold-check:checked ~ .unfold-arrow .chev {
  transform: rotate(180deg);
}
.unfold-arrow .label-more { display: inline; }
.unfold-arrow .label-less { display: none; }
.unfold input[type='checkbox']:checked ~ .unfold-arrow .label-more,
.unfold .unfold-check:checked ~ .unfold-arrow .label-more { display: none; }
.unfold input[type='checkbox']:checked ~ .unfold-arrow .label-less,
.unfold .unfold-check:checked ~ .unfold-arrow .label-less { display: inline; }

.unfold.no-fold .unfold-arrow { display: none; }

/* Fully collapsed toggles (row-3 "more details") have no clipped text to fade,
   and start fully closed. The height lives in CSS (not inline) so the :checked
   expand rule can outrank it. */
.unfold.no-fade .unfold-text { max-height: 0; }
.unfold.no-fade .unfold-text::after { content: none; }
/* Keep the toggle left-aligned inside cards rather than centered. */
.unfold.no-fade { text-align: left; }

@media (prefers-reduced-motion: reduce) {
  .unfold-text,
  .unfold-text::after,
  .unfold-arrow .chev { transition: none; }
}
