/* ========================================================================== 
   Nnexyra Base Styles (base.css)
   Modern immersive fantasy portal – global foundation styles
   ========================================================================== */

/* ========================================================================== 
   1. CSS Variables (Design Tokens)
   ========================================================================== */

:root {
  /* Color Palette - Fantasy Night / Arcane Glow */
  --color-background: #050714; /* deep night */
  --color-surface: #0b1022;    /* elevated surface */
  --color-surface-soft: #11172b;

  --color-text: #f5f6ff;
  --color-text-muted: #a4aecf;
  --color-border-subtle: #262c42;

  --color-primary: #7f5cff;  /* arcane violet */
  --color-primary-soft: rgba(127, 92, 255, 0.12);
  --color-primary-strong: #a992ff;

  --color-success: #32d7a1;
  --color-success-soft: rgba(50, 215, 161, 0.12);

  --color-warning: #ffbf47;
  --color-warning-soft: rgba(255, 191, 71, 0.12);

  --color-danger: #ff4b6e;
  --color-danger-soft: rgba(255, 75, 110, 0.12);

  --color-gray-50: #f9fafc;
  --color-gray-100: #eef0f7;
  --color-gray-200: #d6d9ea;
  --color-gray-300: #b6bdd6;
  --color-gray-400: #9199b8;
  --color-gray-500: #6f7694;
  --color-gray-600: #515771;
  --color-gray-700: #393d53;
  --color-gray-800: #252837;
  --color-gray-900: #151725;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-md: 1.0625rem; /* 17px – slightly larger for readability */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */

  --line-height-tight: 1.15;
  --line-height-snug: 1.3;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* Spacing Scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-7: 1.75rem;  /* 28px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radii */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* Shadows (ethereal/fantasy) */
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --shadow-subtle: 0 10px 30px rgba(7, 11, 32, 0.75);
  --shadow-glow-primary: 0 0 25px rgba(127, 92, 255, 0.55);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease;
  --transition-slow: 320ms ease;

  /* Layout */
  --layout-max-width: 1140px;
  --layout-gutter: var(--space-4);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0.01ms;
    --transition-normal: 0.01ms;
    --transition-slow: 0.01ms;
  }
}

/* ========================================================================== 
   2. Reset / Normalize
   ========================================================================== */

/* Box sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Remove default margins */
body,
main,
section,
article,
aside,
header,
footer,
nav,
figure,
blockquote,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
p,
hr,
pre {
  margin: 0;
  padding: 0;
}

/* Body base */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Lists */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Images and media */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* Form elements */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
}

/* Anchor defaults */
a {
  color: inherit;
  text-decoration: none;
}

a:focus {
  outline: none;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ========================================================================== 
   3. Base Typography & Layout
   ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  background: radial-gradient(circle at 20% 0%, #171b35 0, transparent 50%),
    radial-gradient(circle at 80% 100%, #251b48 0, transparent 55%),
    var(--color-background);
  color: var(--color-text);
}

/* Headings – cinematic & narrative-friendly */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--line-height-snug);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: 0.03em;
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-2);
}

h4 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-2);
}

h5 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-1);
}

h6 {
  font-size: var(--font-size-lg);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
}

p {
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
}

p + p {
  margin-top: var(--space-1);
}

strong,
b {
  font-weight: 600;
}

em {
  font-style: italic;
}

small {
  font-size: var(--font-size-sm);
}

/* Links – subtle arcane glow */
a {
  color: var(--color-primary-strong);
  text-decoration: none;
  transition: color var(--transition-normal),
    text-shadow var(--transition-normal),
    opacity var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(127, 92, 255, 0.7);
}

a:active {
  opacity: 0.8;
}

/* Horizontal rule for section separation */
hr {
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

/* ========================================================================== 
   4. Accessibility & Focus Styles
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 3px;
}

/* Reduce motion – remove non-essential animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Screen reader only 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: 0;
}

/* ========================================================================== 
   5. Utility Classes
   ========================================================================== */

/* Layout container for content width on all pages */
.container {
  width: 100%;
  max-width: var(--layout-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--layout-gutter);
  padding-right: var(--layout-gutter);
}

/* Responsive page sections */
.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section--tight {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

.section__title {
  margin-bottom: var(--space-4);
}

.section__subtitle {
  max-width: 40rem;
  color: var(--color-text-muted);
}

/* Flex helpers */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-xs { gap: var(--space-2); }
.gap-sm { gap: var(--space-3); }
.gap-md { gap: var(--space-4); }
.gap-lg { gap: var(--space-6); }
.gap-xl { gap: var(--space-8); }

/* Grid helpers */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 960px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Width helpers */
.w-full { width: 100%; }

/* Spacing utilities (commonly used) */
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--space-2); }
.mt-sm { margin-top: var(--space-3); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }
.mt-xl { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-2); }
.mb-sm { margin-bottom: var(--space-3); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }
.mb-xl { margin-bottom: var(--space-8); }

.py-section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

/* Badge / label helper for categories (e.g., Görev, Rehber, Haber) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent);
  color: var(--color-text-muted);
}

.badge--primary {
  color: var(--color-primary-strong);
  border-color: rgba(127, 92, 255, 0.5);
  background: radial-gradient(circle at 0 0, rgba(127, 92, 255, 0.26), transparent 60%);
}

.badge--success {
  color: var(--color-success);
  border-color: rgba(50, 215, 161, 0.5);
}

.badge--warning {
  color: var(--color-warning);
  border-color: rgba(255, 191, 71, 0.5);
}

/* ========================================================================== 
   6. Form Elements & Inputs
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(10, 13, 28, 0.95);
  color: var(--color-text);
  line-height: 1.4;
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-gray-500);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--color-primary-strong);
  box-shadow: 0 0 0 1px rgba(127, 92, 255, 0.6);
}

input[disabled],
textarea[disabled],
select[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========================================================================== 
   7. Buttons (Primary CTA, Ghost, etc.)
   ========================================================================== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
}

.btn--primary {
  background: radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.2) 0, transparent 55%),
    linear-gradient(120deg, #7f5cff, #b86bff);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-primary);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-subtle);
}

.btn--ghost {
  background: transparent;
  color: var(--color-primary-strong);
  border-color: rgba(127, 92, 255, 0.6);
}

.btn--ghost:hover {
  background: rgba(127, 92, 255, 0.1);
}

.btn--secondary {
  background: linear-gradient(120deg, #222844, #182038);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn--secondary:hover {
  background: linear-gradient(120deg, #282f4f, #1c2640);
}

.btn--sm {
  padding: 0.45rem 0.9rem;
  font-size: var(--font-size-xs);
}

.btn--lg {
  padding: 0.8rem 1.6rem;
  font-size: var(--font-size-base);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 3px;
}

/* ========================================================================== 
   8. Card Component (Lore blocks, class previews, quest highlights)
   ========================================================================== */

.card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  background:
    radial-gradient(circle at 0 0, rgba(127, 92, 255, 0.18), transparent 58%),
    radial-gradient(circle at 100% 0, rgba(50, 215, 161, 0.1), transparent 50%),
    linear-gradient(145deg, rgba(10, 13, 28, 0.98), rgba(7, 9, 18, 0.98));
  box-shadow: var(--shadow-subtle);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.02)
  );
  mix-blend-mode: soft-light;
  opacity: 0.16;
}

.card__header {
  position: relative;
  margin-bottom: var(--space-3);
}

.card__title {
  margin-bottom: var(--space-1);
}

.card__meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.card__body {
  position: relative;
  color: var(--color-text-muted);
}

.card__footer {
  position: relative;
  margin-top: var(--space-4);
}

/* Hover lift for interactive cards (e.g., blog posts, rehberler) */
.card--interactive {
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
  cursor: pointer;
}

.card--interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-primary);
  border-color: rgba(127, 92, 255, 0.6);
}

/* ========================================================================== 
   9. Hero / Visual Placeholder Helpers
   ========================================================================== */

/* Used for large scene placeholders on Hikaye & Dünya, Karakterler, etc. */
.scene-placeholder {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(127, 92, 255, 0.35), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(50, 215, 161, 0.3), transparent 60%),
    linear-gradient(145deg, #070915, #101528);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.scene-placeholder__label {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-gray-300);
}

/* ========================================================================== 
   10. Helper Classes for Nnexyra Theming
   ========================================================================== */

.text-muted {
  color: var(--color-text-muted);
}

.text-primary {
  color: var(--color-primary-strong);
}

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

.bg-surface-soft {
  background-color: var(--color-surface-soft);
}

.border-subtle {
  border: 1px solid var(--color-border-subtle);
}

/* For subtle panel sections (e.g., SSS, İpuçları) */
.panel {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(16, 20, 46, 0.96), rgba(6, 8, 22, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ========================================================================== 
   11. Responsive Typography Tweaks
   ========================================================================== */

@media (max-width: 960px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.5rem; }
}

@media (max-width: 640px) {
  .section,
  .py-section {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.625rem; }
}
