/* =========================================================
   Variables
   ========================================================= */
:root {
  /* Color Palette - earthy, steel & stone inspired */
  --color-background: #0f1115; /* deep charcoal */
  --color-surface: #181b21; /* elevated panels */
  --color-surface-alt: #1f242b; /* alternate panels */
  --color-text: #f4f1e8; /* parchment-light text */
  --color-text-muted: #a6a398; /* desaturated parchment */
  --color-border-subtle: #2b3038;

  --color-primary: #c7923b; /* burnished gold / brass */
  --color-primary-soft: rgba(199, 146, 59, 0.12);
  --color-primary-strong: #e2a949;

  --color-success: #4c8a4b; /* muted green */
  --color-success-soft: rgba(76, 138, 75, 0.12);
  --color-warning: #c77e28; /* amber warning */
  --color-warning-soft: rgba(199, 126, 40, 0.16);
  --color-danger: #a33f32; /* dried blood red */
  --color-danger-soft: rgba(163, 63, 50, 0.16);

  /* Neutral grays (stone/steel) */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Cinzel", "Cormorant Garamond", "Times New Roman", serif;
  --font-mono: "Fira Mono", "SFMono-Regular", 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 */
  --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.2;
  --line-height-snug: 1.35;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;

  /* Spacing scale (px) mapped to rem assuming root 16px) */
  --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 */

  /* Radius (slightly chiseled, not too soft) */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows (subtle but solid, like weighty stone/steel) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.85);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 180ms ease-out;
  --transition-slow: 260ms ease-out;

  /* Layout */
  --container-max-width: 1120px;
  --container-padding-x: 1.25rem;
}

@media (min-width: 1280px) {
  :root {
    --container-max-width: 1200px;
  }
}

/* =========================================================
   Reset & Normalize
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Long URLs and text handling */
a,
p,
li,
td,
th,
div {
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

html,
body {
  padding: 0;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  max-width: 100%;
}

body {
  min-height: 100vh;
  max-width: 100%;
  position: relative;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
  height: auto;
}

img,
video {
  height: auto;
  width: auto;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

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

textarea {
  resize: vertical;
}

:focus {
  outline: none;
}

/* Respect users that prefer 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;
  }
}

/* =========================================================
   Base Styles
   ========================================================= */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

main {
  min-height: 60vh;
}

/* Headings – medieval flavor using serif while staying readable */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-4xl);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--font-size-3xl);
  letter-spacing: 0.015em;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

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

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

h5 {
  font-size: var(--font-size-lg);
  margin-top: var(--space-4);
  margin-bottom: var(--space-1);
}

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

p {
  margin-top: 0;
  margin-bottom: var(--space-3);
}

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

strong,
b {
  font-weight: 600;
}

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

a {
  color: var(--color-primary-strong);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.1em;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0), var(--color-primary), rgba(0, 0, 0, 0));
  opacity: 0.6;
  transform-origin: center;
  transform: scaleX(0);
  transition: transform var(--transition-normal), opacity var(--transition-fast);
}

a:hover::after {
  transform: scaleX(1);
  opacity: 0.9;
}

code,
pre {
  font-family: var(--font-mono);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

pre {
  overflow-x: auto;
  max-width: 100%;
  white-space: pre-wrap;
}

@media (max-width: 768px) {
  code,
  pre {
    font-size: var(--font-size-xs);
  }
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

/* Lists */
ul,
ol {
  padding-left: 1.35rem;
  margin-bottom: var(--space-3);
}

li + li {
  margin-top: 0.25em;
}

/* =========================================================
   Accessibility & Focus Styles
   ========================================================= */
:focus-visible {
  outline: 2px solid var(--color-primary-strong);
  outline-offset: 2px;
}

/* 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;
}

/* =========================================================
   Layout Utilities
   ========================================================= */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

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

.section--dense {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

/* 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-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

/* Grid helpers */
.grid {
  display: grid;
}

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

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

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

/* Prevent any grid from overflowing */
.grid,
.grid-2,
.grid-3 {
  max-width: 100%;
  overflow: hidden;
}

/* Width helpers for knowledge base / content */
.content-narrow {
  max-width: 760px;
}

.align-center {
  margin-left: auto;
  margin-right: auto;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

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

/* =========================================================
   Components
   ========================================================= */

/* Buttons – sturdy, slightly chiseled look */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.85);
  background: radial-gradient(circle at top, #373024 0, #261f17 38%, #17120f 100%);
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--font-size-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .btn {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
    white-space: normal;
  }
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: radial-gradient(circle at top, #443323 0, #2d2217 40%, #1a1310 100%);
}

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

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

.btn--primary {
  background: linear-gradient(135deg, #c7923b, #9c6e22);
  border-color: #f0d094;
  color: #20160b!important;
}

.btn--primary:hover {
  background: linear-gradient(135deg, #e2a949, #b77f24);
  color: #20160b!important;
}

.btn--ghost {
  background: transparent;
  border-color: var(--color-border-subtle);
  color: var(--color-text);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.03);
}

.btn--danger {
  background: linear-gradient(135deg, #a33f32, #6b261d);
  border-color: rgba(255, 193, 181, 0.4);
}

.btn--danger:hover {
  background: linear-gradient(135deg, #bf4d3e, #7b2b21);
}

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

/* Inputs – consistent fields for guides & knowledge base */
.input,
.select,
.textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background-color: #11131a;
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-snug);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-muted);
}

.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  border-color: var(--color-primary-strong);
  box-shadow: 0 0 0 1px rgba(199, 146, 59, 0.5);
}

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

.textarea {
  min-height: 120px;
}

/* Card – used for infographics, guides, knowledge base entries */
.card {
  background: radial-gradient(circle at top left, #26221a 0, #17191f 42%, #101218 100%);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

@media (max-width: 480px) {
  .card {
    padding: var(--space-4);
  }
}

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

.card--outlined {
  background: transparent;
  border-color: var(--color-border-subtle);
  box-shadow: none;
}

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

.card__title {
  font-size: var(--font-size-xl);
  font-family: var(--font-serif);
  margin-bottom: var(--space-1);
}

.card__meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.card__body {
  font-size: var(--font-size-sm);
}

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

/* Tag / pill for categories like "Strategia", "Poradnik", etc. */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(15, 17, 21, 0.9);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.tag--primary {
  border-color: rgba(199, 146, 59, 0.6);
  color: var(--color-primary-strong);
}

/* Search bar wrapper for knowledge base */
.search-bar {
  display: flex;
  align-items: stretch;
  background-color: #10131a;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.search-bar__input {
  flex: 1 1 auto;
  border: none;
  padding: 0.6rem 0.75rem;
  background: transparent;
  min-width: 0;
  max-width: 100%;
}

.search-bar__button {
  border-radius: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .search-bar {
    flex-direction: column;
  }
  
  .search-bar__button {
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.8);
  }
}

/* =========================================================
   Image & Media Helpers
   ========================================================= */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: 100%;
}

.img-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: 100%;
}

.media-frame {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.8);
  box-shadow: var(--shadow-md);
  max-width: 100%;
  box-sizing: border-box;
}

.media-frame img,
.media-frame video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* =========================================================
   Helper Classes for State & Feedback
   ========================================================= */
.text-success {
  color: var(--color-success);
}

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

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

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

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge--success {
  background-color: var(--color-success-soft);
  color: var(--color-success);
}

.badge--warning {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
}

.badge--danger {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
}

/* =========================================================
   Tables (for stats, army composition, etc.)
   ========================================================= */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

.table thead {
  background-color: #14161d;
}

.table th,
.table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #242832;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.table th {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.01);
}

.table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Table wrapper for mobile scroll */
@media (max-width: 768px) {
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table th,
  .table td {
    padding: 0.4rem 0.5rem;
    font-size: var(--font-size-xs);
  }
}

/* =========================================================
   End base.css
   ========================================================= */
