/* ============================================================
   QUIZZING SOCIETY — BASE STYLES
   Reset, typography, global rules, premium utilities
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--navbar-height);
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
}

/* ── Skip Navigation ── */
.skip-nav {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: var(--primary);
  color: var(--text-on-primary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  z-index: var(--z-toast);
  transition: top var(--duration-normal) var(--ease-out);
}
.skip-nav:focus {
  top: 0;
}

/* ── Selection ── */
::selection {
  background: var(--primary);
  color: var(--text-on-primary);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-alt);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-lighter);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text);
}

h1 { font-size: var(--fs-6xl); }
h2 { font-size: var(--fs-4xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl);  }

@media (max-width: 768px) {
  h1 { font-size: var(--fs-4xl); }
  h2 { font-size: var(--fs-3xl); }
  h3 { font-size: var(--fs-xl);  }
  h4 { font-size: var(--fs-lg);  }
}

p {
  max-width: 65ch;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover {
  color: var(--primary-hover);
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
button:active {
  transform: scale(0.95);
}
button:hover {
  filter: brightness(1.05);
}

ul, ol {
  list-style: none;
}

/* ── Focus Styles ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Container ── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }
}

/* ── Section Base ── */
.section {
  position: relative;
  padding: var(--space-24) 0;
  overflow: hidden;
}

.section-alt {
  background-color: var(--bg-alt);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: var(--ls-widest);
  margin-bottom: var(--space-4);
}

.section-label svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.section-title {
  margin-bottom: var(--space-4);
  font-size: clamp(2.5rem, 8vw, 5rem) !important;
  font-weight: 800 !important;
  font-family: 'Google Sans', 'Product Sans', sans-serif !important;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: var(--fs-lg);
  max-width: 50ch;
  margin: 0 auto;
}

/* ── Scroll Animation Placeholders ── */
[data-scroll] {
  opacity: 0;
  transition: opacity var(--duration-slower) var(--ease-out),
              transform var(--duration-slower) var(--ease-out);
}

[data-scroll="fade-up"] {
  transform: translateY(40px);
}

[data-scroll="fade-down"] {
  transform: translateY(-40px);
}

[data-scroll="fade-left"] {
  transform: translateX(40px);
}

[data-scroll="fade-right"] {
  transform: translateX(-40px);
}

[data-scroll="scale-up"] {
  transform: scale(0.92);
}

[data-scroll="zoom-in"] {
  transform: scale(0.8);
}

[data-scroll].is-visible {
  opacity: 1;
  transform: translate(0) scale(1);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-scroll] {
    opacity: 1;
    transform: none;
  }
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mono {
  font-family: var(--font-mono);
}

/* ── Glass Card ── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ── Gradient Text ── */
.gradient-text {
  background: var(--gradient-primary);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* ── Glow Border Hover ── */
.glow-border {
  position: relative;
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.glow-border:hover {
  box-shadow: var(--shadow-neon);
}

/* ── Premium Form Inputs ── */
.form-field {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg-alt);
  border: none;
  border-radius: var(--radius-pill);
  transition: box-shadow var(--duration-fast) var(--ease-out);
  outline: none;
}

textarea.form-field {
  border-radius: var(--radius-lg);
}

.form-field:focus {
  box-shadow: 0 0 0 4px rgba(14, 143, 224, 0.12);
}

.form-field::placeholder {
  color: var(--text-tertiary);
}

.form-field.error {
  box-shadow: 0 0 0 4px var(--error-bg);
}

.form-label {
  display: block;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-2);
  color: var(--text);
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--error);
  margin-top: var(--space-1);
  display: none;
}

.form-error.visible {
  display: block;
}

/* ── Page Hero Banner (for subpages) ── */
.page-hero-banner {
  position: relative;
  padding: var(--space-20) 0 var(--space-12);
  text-align: center;
  overflow: hidden;
}

.page-hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-mesh);
  opacity: 0.5;
  z-index: 0;
}

.page-hero-banner .container {
  position: relative;
  z-index: 1;
}

/* ── Decoration Elements ── */
.section-decoration {
  position: absolute;
  font-size: 8rem;
  font-weight: 900;
  color: var(--primary);
  opacity: 0.04;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

/* ── Global Premium Background ── */
#global-premium-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  animation: float-orb 20s infinite ease-in-out alternate;
}

[data-theme="dark"] .bg-orb {
  opacity: 0.08;
}

.bg-orb-1 {
  width: 50vw;
  height: 50vw;
  background: var(--brand-sky);
  top: -10%;
  left: -10%;
}

.bg-orb-2 {
  width: 40vw;
  height: 40vw;
  background: var(--brand-cyan);
  bottom: -10%;
  right: -10%;
  animation-delay: -10s;
  animation-duration: 25s;
}

.bg-grid-overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--text-tertiary) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.03;
}

[data-theme="dark"] .bg-grid-overlay {
  background-image: radial-gradient(#ffffff 1px, transparent 1px);
  opacity: 0.02;
}

.bg-watermark-track {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%) rotate(-15deg);
  width: 200%;
  opacity: 0.02;
  white-space: nowrap;
}

[data-theme="dark"] .bg-watermark-track {
  opacity: 0.015;
}

.bg-watermark-text {
  font-family: var(--font-heading);
  font-size: 15vw;
  font-weight: 900;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  display: inline-block;
  animation: scroll-watermark 120s linear infinite;
}

@keyframes float-orb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10vw, 10vh) scale(1.2); }
}

@keyframes scroll-watermark {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Light Theme Card Adjustments ── */
[data-theme="light"] .glass-card,
[data-theme="light"] .pillar-card,
[data-theme="light"] .hall-of-fame-wrapper,
[data-theme="light"] .resource-card,
[data-theme="light"] .testimonial-card,
[data-theme="light"] .hiw-step,
[data-theme="light"] .fun-fact-card,
[data-theme="light"] .bento-card,
[data-theme="light"] .stat-card {
  border: none !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important;
}
