/* ==========================================================================
   0xd.ir — Base Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

/* ==========================================================================
   Design Tokens
   ========================================================================== */

:root {
  /* Palette */
  --bg:               #111111;
  --surface:          #171717;
  --surface-elevated: #1d1d1d;
  --border:           #2e2e2e;
  --border-strong:    #444444;
  --text:             #d6d6d6;
  --text-muted:       #8c8c8c;
  --text-faint:       #666666;
  --heading:          #f1f1f1;
  --link:             #9ec3ff;
  --link-hover:       #c2daff;
  --link-visited:     #b8b6ff;
  --selection-bg:     #26456e;
  --code-bg:          #1a1a1a;
  --code-text:        #e4c58a;
  --terminal-prompt:  #ff6b6b;
  --terminal-success: #51cf66;

  /* Typography */
  --font-ui:   "IBM Plex Mono", monospace;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-size: 17px;
  --line-height: 1.75;

  /* Layout */
  --content-width: 68ch;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Shape */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* Motion */
  --transition-fast: 140ms ease;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

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

body {
  padding: clamp(var(--space-4), 8vh, var(--space-8)) 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--font-size);
  line-height: var(--line-height);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection-bg); }

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

/* ==========================================================================
   Links
   ========================================================================== */

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}
a:hover   { color: var(--link-hover); }
a:visited { color: var(--link-visited); }
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  color: var(--heading);
  font-weight: 600;
  line-height: 1.25;
}
h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.25rem; }

p + p { margin-top: 1rem; }

/* ==========================================================================
   Code
   ========================================================================== */

code, pre, kbd, samp { font-family: var(--font-ui); }
code { font-size: 0.9em; }

:not(pre) > code {
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-text);
}

/* ==========================================================================
   Lists & Tables
   ========================================================================== */

ul, ol { padding-left: 1.4rem; }
table  { border-collapse: collapse; }

/* ==========================================================================
   Accessibility
   ========================================================================== */

.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;
}

/* ==========================================================================
   Responsive & Print
   ========================================================================== */

@media (max-width: 768px) { 
  :root { --font-size: 16px; } 
  body { padding: 0; }
}

@media (max-width: 480px) { :root { --font-size: 15px; } }

@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;
  }
}

@media print {
  html, body { background: white !important; color: black !important; }
  a { color: black !important; }
}
