/* ═══════════════════════════════════════════════════════════
   BASE.CSS — Reset, Variáveis, Tipografia
   Livro Secreto de Operações — Davi Azevedo
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700;900&family=Inter:wght@300;400;500;600;700&family=Sawarabi+Mincho&display=swap');

/* ─── CSS Custom Properties ─── */
:root {
  /* Palette */
  --parchment:        #f0e6c8;
  --parchment-dark:   #ddd0a8;
  --parchment-light:  #faf4e4;
  --ink:              #1a1209;
  --ink-mid:          #2e2016;
  --ink-faded:        #5a4a32;
  --ink-red:          #7a1818;
  --ink-red-bright:   #a82020;
  --ink-gold:         #b8841e;
  --ink-gold-bright:  #d4a830;
  --ink-blue:         #1a3a5c;

  /* Status */
  --green-victory:    #1e4d18;
  --green-glow:       #2d6b22;
  --red-defeat:       #6b1818;
  --red-glow:         #8b2020;
  --neutral-gray:     #6b6055;

  /* Surfaces */
  --paper-bg:         #ede2c4;
  --paper-shadow:     rgba(0, 0, 0, 0.4);
  --page-shadow:      0 8px 40px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  --spine-color:      #2a1a08;

  /* Fonts */
  --font-title:       'Noto Serif JP', 'Sawarabi Mincho', serif;
  --font-body:        'Inter', sans-serif;
  --font-mono:        'Courier New', monospace;

  /* Spacing */
  --spacing-xs:       4px;
  --spacing-sm:       8px;
  --spacing-md:       16px;
  --spacing-lg:       24px;
  --spacing-xl:       40px;
  --spacing-xxl:      64px;

  /* Borders */
  --border-ink:       2px solid var(--ink);
  --border-gold:      2px solid var(--ink-gold);
  --border-red:       2px solid var(--ink-red);
  --radius-sm:        4px;
  --radius-md:        8px;

  /* Transitions */
  --transition-fast:  0.2s ease;
  --transition-med:   0.4s ease;
  --transition-slow:  0.7s cubic-bezier(0.4, 0, 0.2, 1);
  --flip-duration:    0.6s;

  /* Effects */
  --hatching-color:   rgba(26, 18, 9, 0.08);
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
  --parchment:        #1f2023;
  --parchment-dark:   #141517;
  --parchment-light:  #2a2c30;
  --ink:              #e0e0e0;
  --ink-mid:          #b0b0b0;
  --ink-faded:        #808080;
  --ink-red:          #e03030;
  --ink-red-bright:   #ff5050;
  --ink-gold:         #d4a830;
  --ink-gold-bright:  #f0c850;
  --ink-blue:         #4a90e2;

  /* Redefinição de cores de status com alto contraste para o modo noturno */
  --green-victory:    #4caf50; /* Verde vibrante/claro */
  --green-glow:       #81c784;
  --red-defeat:       #f44336; /* Vermelho vibrante/claro */
  --red-glow:         #e57373;

  --paper-bg:         #18191c;
  --paper-shadow:     rgba(0, 0, 0, 0.8);
  --spine-color:      #0b0c0d;
  --hatching-color:   rgba(224, 224, 224, 0.06);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--spine-color);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(42, 26, 8, 0.8) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(42, 26, 8, 0.8) 0%, transparent 60%),
    linear-gradient(180deg, #1a0f04 0%, #2a1a08 40%, #1a0f04 100%);
  background-attachment: fixed;
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-title);
  line-height: 1.2;
  color: var(--ink);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 900; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem);   font-weight: 700; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); font-weight: 700; }
h4 { font-size: 1.1rem; font-weight: 600; }

p, li, td, th {
  font-family: var(--font-body);
  line-height: 1.7;
  font-size: 0.95rem;
}

.data-text {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.manga-title {
  font-family: var(--font-title);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.12);
}

.manga-title span, .manga-title small, .manga-title a, .manga-title div {
  text-shadow: none !important;
}

.kanji-accent {
  font-family: var(--font-title);
  font-size: 0.75em;
  color: var(--ink-red);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--parchment-dark); }
::-webkit-scrollbar-thumb { background: var(--ink-faded); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink); }

/* ─── Selection ─── */
::selection {
  background: var(--ink-gold);
  color: var(--parchment-light);
}

/* ─── Links ─── */
a {
  color: var(--ink-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--ink-red-bright); }

/* ─── Touch & Mobile Ergonomics ─── */
button, a, input, select, textarea, .nav-item__link, .nav-subitem__link {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active, .btn:active {
  transform: scale(0.97);
}

/* ─── Utility Classes ─── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm      { gap: var(--spacing-sm); }
.gap-md      { gap: var(--spacing-md); }
.gap-lg      { gap: var(--spacing-lg); }
.grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-lg); }
.grid-3      { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--spacing-lg); }
.grid-auto   { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--spacing-lg); }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
}
