/*
======================================================================
  Machinarium Themed Base CSS
  - Hand-drawn, steampunk, atmospheric, textured, moody, cinematic
======================================================================
*/

/*======================================================================
  1. CSS VARIABLES (THEME TOKENS)
======================================================================*/
:root {
  /* Color Palette - Atmospheric Steampunk */
  --color-background: #111216; /* deep matte charcoal */
  --color-surface: #181b1f;    /* slightly lifted panel */
  --color-surface-elevated: #22252b; /* card / elevated sections */
  --color-surface-soft: #141619;     /* subtle contrast for strips */

  --color-text: #e3ddcf;       /* parchment-like off‑white */
  --color-text-muted: #9a9184; /* aged metal label text */
  --color-text-soft: #bfb6a8;  /* softer secondary text */

  --color-primary: #c38a39;    /* warm amber highlight */
  --color-primary-soft: rgba(195, 138, 57, 0.14);
  --color-primary-strong: #e6a749; /* brighter accent for CTAs */

  --color-success: #739b4a;    /* oxidized brass green */
  --color-warning: #e1a94b;    /* warm warning amber */
  --color-danger: #c04b3b;     /* burnt red */

  --color-rust: #6e4a32;       /* rusted metal brown */
  --color-rust-deep: #3c2516;
  --color-steel: #3b4b52;      /* muted teal steel */
  --color-steel-soft: #2b383e;

  --gray-50:  #f7f3ea;
  --gray-100: #e3ddcf;
  --gray-200: #c0b6a8;
  --gray-300: #9a9184;
  --gray-400: #7a7267;
  --gray-500: #5c554d;
  --gray-600: #47413b;
  --gray-700: #34302b;
  --gray-800: #221f1b;
  --gray-900: #12100e;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Cormorant Garamond", "Palatino", "Times New Roman", serif;
  --font-mono: "Fira Code", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-size-xxs: 0.7rem;  /* micro labels */
  --font-size-xs:  0.75rem;
  --font-size-sm:  0.875rem;
  --font-size-md:  1rem;
  --font-size-lg:  1.125rem;
  --font-size-xl:  1.375rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2.25rem;
  --font-size-4xl: 3rem;

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

  /* Spacing scale (px) */
  --space-0: 0;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-8: 16px;
  --space-10: 20px;
  --space-12: 24px;
  --space-16: 32px;
  --space-20: 40px;
  --space-24: 48px;
  --space-28: 56px;
  --space-32: 64px;
  --space-40: 80px;
  --space-48: 96px;

  /* Radius (slightly imperfect, tactile) */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Shadows (cinematic, layered) */
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-medium: 0 18px 45px rgba(0, 0, 0, 0.55);
  --shadow-strong: 0 28px 80px rgba(0, 0, 0, 0.75);

  /* Borders & texture hints */
  --border-subtle: 1px solid rgba(240, 224, 200, 0.04);
  --border-strong: 1px solid rgba(240, 224, 200, 0.18);

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

  /* Layout */
  --layout-max-width: 1120px;
  --layout-gutter: var(--space-16);

  /* Focus ring */
  --focus-color: rgba(230, 167, 73, 0.9);
  --focus-ring: 0 0 0 2px var(--color-background), 0 0 0 4px var(--focus-color);
}

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

/*======================================================================
  2. RESET / NORMALIZE
======================================================================*/
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
}

h1, h2, h3, h4, h5, h6,
p, figure, blockquote,
dl, dd,
ul, ol,
pre {
  margin: 0;
}

ul, ol {
  padding-left: 1.25rem;
}

button,
input,
select,
textarea {
  margin: 0;
  font: inherit;
  color: inherit;
  background: transparent;
  border-radius: 0;
}

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

img,
video {
  height: auto;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

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

button:disabled,
[disabled] {
  cursor: not-allowed;
}

/* Remove default link styling while preserving semantics */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

/*======================================================================
  3. BASE TYPOGRAPHY & LAYOUT
======================================================================*/
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  background-color: var(--color-background);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Subtle vignette & texture hint using gradients */
  background-image:
    radial-gradient(circle at top left, rgba(195, 138, 57, 0.22), transparent 55%),
    radial-gradient(circle at bottom right, rgba(110, 74, 50, 0.35), transparent 55%),
    radial-gradient(circle at center, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.9));
  background-attachment: fixed;
}

main {
  display: block;
}

/* Headings - cinematic and slightly ornamental */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--gray-50);
  letter-spacing: 0.04em;
}

h1 {
  font-size: clamp(2.4rem, 4vw, var(--font-size-4xl));
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-16);
}

h2 {
  font-size: clamp(1.8rem, 3vw, var(--font-size-3xl));
  line-height: var(--line-height-snug);
  margin-top: var(--space-24);
  margin-bottom: var(--space-12);
}

h3 {
  font-size: clamp(1.4rem, 2.3vw, var(--font-size-2xl));
  line-height: var(--line-height-snug);
  margin-top: var(--space-20);
  margin-bottom: var(--space-10);
}

h4 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-snug);
  margin-top: var(--space-16);
  margin-bottom: var(--space-8);
}

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

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

p {
  margin-bottom: var(--space-10);
}

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

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

strong {
  font-weight: 600;
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
}

pre {
  padding: var(--space-10);
  background-color: rgba(12, 12, 12, 0.9);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

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

a:hover {
  color: var(--color-primary-strong);
  text-shadow: 0 0 10px rgba(195, 138, 57, 0.45);
}

a:active {
  opacity: 0.78;
}

/*======================================================================
  4. ACCESSIBILITY & FOCUS
======================================================================*/
:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Do not show custom focus ring on mouse click containers */
[tabindex="-1"]:focus {
  box-shadow: none;
}

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

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/*======================================================================
  5. UTILITIES
======================================================================*/
/* Container with cinematic max-width */
.container {
  width: 100%;
  max-width: var(--layout-max-width);
  margin-inline: auto;
  padding-inline: var(--layout-gutter);
}

/* Section padding helpers */
.section {
  padding-block: clamp(var(--space-24), 8vh, var(--space-40));
}

.section--tight {
  padding-block: var(--space-20);
}

.section--wide {
  padding-block: var(--space-40);
}

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

.flex-row {
  display: flex;
  flex-direction: row;
}

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

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

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

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

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
.gap-20 { gap: var(--space-20); }

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

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

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

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

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


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

/* Spacing utilities (margin / padding) */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }
.mt-24 { margin-top: var(--space-24); }
.mt-32 { margin-top: var(--space-32); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }
.mb-24 { margin-bottom: var(--space-24); }
.mb-32 { margin-bottom: var(--space-32); }

.py-8 { padding-block: var(--space-8); }
.py-12 { padding-block: var(--space-12); }
.py-16 { padding-block: var(--space-16); }
.py-24 { padding-block: var(--space-24); }
.py-32 { padding-block: var(--space-32); }

.px-8 { padding-inline: var(--space-8); }
.px-12 { padding-inline: var(--space-12); }
.px-16 { padding-inline: var(--space-16); }
.px-24 { padding-inline: var(--space-24); }

/* Text tone utilities */
.text-muted { color: var(--color-text-muted); }
.text-soft { color: var(--color-text-soft); }
.text-accent { color: var(--color-primary-strong); }

/*======================================================================
  6. BASIC COMPONENTS
======================================================================*/
/* Buttons - industrial plates with glow */
.button,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.9);
  background: radial-gradient(circle at 10% 0%, rgba(230, 167, 73, 0.28), transparent 55%),
              linear-gradient(145deg, #2b2215, #5a3e22);
  color: var(--gray-50);
  font-size: var(--font-size-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.75);
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-normal),
              color var(--transition-normal),
              opacity var(--transition-fast);
}



.button--ghost {
  background: rgba(16, 16, 16, 0.7);
  border-color: rgba(227, 221, 207, 0.15);
  color: var(--color-text);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
}

.button--outline {
  background: transparent;
  border-color: rgba(230, 167, 73, 0.6);
  color: var(--color-primary-strong);
  box-shadow: none;
}

.button:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.85);
}

.button:active,
button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.85);
}

.button:disabled,
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.button--secondary {
  background: linear-gradient(145deg, #28343a, #42535a);
  border-color: rgba(40, 58, 62, 0.9);
}

.button--danger {
  background: linear-gradient(145deg, #3c1a16, #6c3027);
  border-color: rgba(192, 75, 59, 0.9);
}

/* Inputs & textareas - brass frames on matte panels */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(238, 220, 195, 0.16);
  background-color: rgba(12, 12, 12, 0.9);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.9);
  transition: border-color var(--transition-normal),
              box-shadow var(--transition-normal),
              background-color var(--transition-normal);
}

input::placeholder,
textarea::placeholder {
  color: rgba(180, 168, 150, 0.7);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: rgba(230, 167, 73, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 1), 0 0 0 3px rgba(230, 167, 73, 0.5);
}

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

label {
  display: inline-block;
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Cards - textured, elevated panels reminiscent of rusty plates */
.card {
  position: relative;
  padding: var(--space-16);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, rgba(195, 138, 57, 0.12), transparent 52%),
    radial-gradient(circle at bottom right, rgba(59, 75, 82, 0.18), transparent 52%),
    linear-gradient(145deg, #15161a, #1c1f23);
  border: 1px solid rgba(0, 0, 0, 0.9);
  box-shadow: var(--shadow-soft);
  color: var(--color-text);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06) 0,
      transparent 32%,
      transparent 68%,
      rgba(0, 0, 0, 0.55) 100%
    );
  mix-blend-mode: soft-light;
  opacity: 0.45;
}

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

.card__title {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

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

/* Alternate card variants */
.card--rust {
  background:
    radial-gradient(circle at top left, rgba(195, 138, 57, 0.24), transparent 55%),
    linear-gradient(145deg, #1f1510, #3c2516);
}

.card--steel {
  background:
    radial-gradient(circle at top left, rgba(59, 75, 82, 0.45), transparent 55%),
    linear-gradient(145deg, #15191c, #273036);
}

/* Simple tag / pill for status or labels */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xxs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid rgba(240, 224, 200, 0.18);
  background-color: rgba(7, 7, 7, 0.9);
  color: var(--color-text-muted);
}

.tag--primary {
  border-color: rgba(230, 167, 73, 0.7);
  color: var(--color-primary-strong);
}

.tag--success {
  border-color: rgba(115, 155, 74, 0.7);
  color: var(--color-success);
}

.tag--danger {
  border-color: rgba(192, 75, 59, 0.7);
  color: var(--color-danger);
}

/*======================================================================
  7. MEDIA & IMAGE TREATMENT
======================================================================*/
/* Frame game screenshots / artwork */
.media-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 1);
  box-shadow: var(--shadow-medium);
  background-color: #050506;
}

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

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.25), transparent 55%);
  mix-blend-mode: soft-light;
}

/*======================================================================
  8. MISC LAYOUT DETAILS
======================================================================*/
/* Horizontal rule styled as a worn divider */
hr {
  border: 0;
  height: 1px;
  margin-block: var(--space-20);
  background: linear-gradient(90deg,
    transparent,
    rgba(195, 138, 57, 0.4),
    rgba(110, 74, 50, 0.55),
    transparent
  );
  opacity: 0.7;
}

/* Lists inside content blocks */
.content ul,
.content ol {
  margin-bottom: var(--space-10);
}

.content li + li {
  margin-top: var(--space-4);
}

.content ul {
  list-style: square;
}

.content ol {
  list-style: decimal;
}

/* Subtle cinematic overlay for hero sections (opt-in class) */
.hero-cinematic {
  position: relative;
  overflow: hidden;
}

.hero-cinematic::before {
  content: "";
  position: absolute;
  inset: -10%;
  pointer-events: none;
  background:
    radial-gradient(circle at top, rgba(230, 167, 73, 0.36), transparent 60%),
    radial-gradient(circle at bottom, rgba(0, 0, 0, 0.9), transparent 55%);
  mix-blend-mode: soft-light;
}

.hero-cinematic > * {
  position: relative;
}

/* End of base.css */
