/* ========================================
   Pablo's Personal Website
   Ultra-minimal retro developer aesthetic
   ======================================== */

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

/* --- Custom Properties --- */
:root {
  color-scheme: light dark;
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-accent: #b88900;
  --color-muted: #888888;
  --color-border: #d8d8d8;
  --color-header-bg: rgba(255, 255, 255, 0.92);
  --color-grid: rgba(26, 26, 26, 0.035);
  --color-shadow: rgba(184, 137, 0, 0.25);
  --font-heading: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;
  --max-width: 680px;
  --spacing: 2rem;
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #100f0c;
  --color-text: #f8f2dc;
  --color-accent: #e0b53a;
  --color-muted: #b5aa84;
  --color-border: #5d5230;
  --color-header-bg: rgba(16, 15, 12, 0.92);
  --color-grid: rgba(244, 236, 209, 0.06);
  --color-shadow: rgba(224, 181, 58, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-bg: #100f0c;
    --color-text: #f8f2dc;
    --color-accent: #e0b53a;
    --color-muted: #b5aa84;
    --color-border: #5d5230;
    --color-header-bg: rgba(16, 15, 12, 0.92);
    --color-grid: rgba(244, 236, 209, 0.06);
    --color-shadow: rgba(224, 181, 58, 0.25);
  }
}

/* --- Base --- */
html {
  font-size: 20px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    linear-gradient(var(--color-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: top left;
  line-height: 1.6;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

/* --- Header / Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: var(--color-header-bg);
  border-bottom: 2px solid var(--color-border);
}

.site-header__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.site-header__inner::-webkit-scrollbar {
  display: none;
}

.site-brand {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--color-text);
  border-bottom: none;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.site-header__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

.site-nav__link {
  font-family: var(--font-heading);
  font-size: 0.6rem;
  line-height: 1.4;
  padding: 0.45rem 0.7rem;
  border: 2px solid transparent;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  border-bottom-color: transparent;
  border-color: var(--color-accent);
  outline: none;
}

.site-nav__link.is-active {
  color: var(--color-text);
  border-color: var(--color-accent);
  box-shadow: 4px 4px 0 var(--color-shadow);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  color: var(--color-text);
  background: transparent;
  border: none;
  cursor: pointer;
}

.theme-toggle__sun,
.theme-toggle__moon {
  display: block;
}

.theme-toggle[data-theme='light'] .theme-toggle__sun,
.theme-toggle[data-theme='dark'] .theme-toggle__moon {
  display: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--color-accent);
  outline: none;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing) 1.5rem 3rem;
}

/* --- Typography --- */
h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

h1::after {
  content: '_';
  animation: blink 1s step-end infinite;
  color: var(--color-accent);
}

h2 {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

h3 {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

a:hover {
  border-bottom-color: var(--color-accent);
}

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

em,
i {
  color: var(--color-muted);
}

/* --- Lists --- */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.2rem;
}

li {
  margin-bottom: 0.3rem;
}

li::marker {
  color: var(--color-accent);
}

/* --- Separators --- */
hr {
  border: none;
  border-top: 2px dashed var(--color-muted);
  margin: var(--spacing) 0;
  opacity: 0.4;
}

/* --- Article content --- */
.content > *:first-child {
  margin-top: 1rem;
}

/* --- Blinking cursor animation --- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes blink {
    50% { opacity: 0; }
  }
}

/* --- Images (future) --- */
img {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  html {
    font-size: 18px;
  }

  .site-header__inner {
    padding: 0.9rem 1rem;
    gap: 0.75rem;
  }

  .site-brand {
    font-size: 0.7rem;
  }

  .site-nav__link {
    font-size: 0.52rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  h2 {
    font-size: 0.75rem;
  }

  h3 {
    font-size: 0.65rem;
  }

  main {
    padding: 1.5rem 1rem;
  }
}
