/* Courier Prime — self-hosted */
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime/courierprime-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime/courierprime-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


:root {
  --accent: #40ffe3;
  --bg-light: #fdfaf6;
  --bg-dark: #121212;
  --bg-light-rgb: 253,250,246;
  --bg-dark-rgb: 18,18,18;
  --text-light: #222;
  --text-dark: #dcdcdc;
  --text-light-rgb: 34,34,34;
  --text-dark-rgb: 220,220,220;
  --font-heading: "Courier Prime", Courier, monospace;
  --body-width: 1200px;
  --content-width: 1136px;

  /* Neumorphic shadows for theme toggle */
  --shadow-light-1: rgba(255, 255, 255, 0.8);
  --shadow-light-2: rgba(0, 0, 0, 0.15);
  --glow-light: rgba(64, 255, 227, 0.15);
}

html[data-theme="dark"] {
  --shadow-light-1: rgba(40, 40, 40, 0.8);
  --shadow-light-2: rgba(0, 0, 0, 0.4);
  --glow-light: rgba(64, 255, 227, 0.1);
}

html[data-theme="light"] {
  --bg: var(--bg-light);
  --bg-rgb: var(--bg-light-rgb);
  --text: var(--text-light);
  --text-rgb: var(--text-light-rgb);
}

html[data-theme="dark"] {
  --bg: var(--bg-dark);
  --bg-rgb: var(--bg-dark-rgb);
  --text: var(--text-dark);
  --text-rgb: var(--text-dark-rgb);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: rgba(var(--text-rgb), 0.8);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: rgba(var(--text-rgb), 1);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-color: rgba(var(--bg-rgb), 0.8);
  border-bottom: 2px solid rgba(var(--text-rgb), 0.25);
}


h1 {
  font-size: 2.2rem;   /* biggest */
  font-weight: 500;    /* semi-bold, not 700 */
  letter-spacing: 0.02em;
  margin: 3rem 0 1.5rem;
}

h2 {
  font-size: 1.6rem;   /* section titles */
  font-weight: 400;    /* normal */
  letter-spacing: 0.03em;
  margin: 2.5rem 0 1rem;
}

h3 {
  font-size: 1.3rem;
  font-weight: 400;
  margin: 2rem 0 .75rem;
}


a {
  color: inherit;
  text-underline-offset: 2px;
  transition: color .15s ease;
  text-decoration-color: var(--accent);
  text-decoration-style: dotted;
}

a:hover,
a:focus {
  color: var(--accent);
}

nav {
  display: flex;
  gap: 1rem;
  padding: 1rem;
}

nav .spacer {
  flex: 1;
}

.page {
  max-width: var(--body-width);
  margin: 0 auto;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem;
}

footer {
  padding: 1rem;
  text-align: right;
  color: rgba(var(--text-rgb), 0.6);
  border-top: 2px solid rgba(var(--text-rgb), 0.25);
}

hr {
  border: none;
  border-top: 2px solid var(--text);
  opacity: .25;
  margin: 3rem 0 2rem;
}

/* Lists */
ul {
  list-style: square;
  padding-left: 1rem;
  margin: 0;
}

li {
  margin: .5rem 0;
}

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

li h3 {
  font-weight: normal;
  margin: 0;
}

li em {
  color: var(--text);
  opacity: .6;
}


.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(var(--text-rgb), 0.08);
  transition: transform .2s ease, border-color .2s ease;
  position: relative;
  padding: 1rem;
  border: 2px solid transparent;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 0;
  pointer-events: none;
}

.card:hover img {
  opacity: 0.15;
}

.card h3,
.card p {
  position: relative;
  z-index: 1;
}

.card p,
.card:hover p {
  color: rgba(var(--text-rgb), 0.8);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid rgba(var(--text-rgb), 0.25);
}

th,
td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(var(--text-rgb), 0.25);
}

th {
  color: rgba(var(--text-rgb), 1);
}

/* ============================================
   THEME TOGGLE - NEUMORPHIC BUTTON
   ============================================ */

.theme-toggle {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: box-shadow 0.2s ease-in-out;
  padding: 0;
  overflow: hidden;

  /* Default "Extruded" state - Light mode */
  box-shadow: 3px 3px 6px var(--shadow-light-2),
              -3px -3px 6px var(--shadow-light-1);
}

/* Dark mode: Default "Extruded" state with glow */
html[data-theme="dark"] .theme-toggle {
  box-shadow: 3px 3px 5px rgba(64, 255, 227, 0.3),
              -3px -3px 5px rgba(64, 255, 227, 0.05);
}

.theme-toggle:hover {
  /* Hover "On" state - flattens and glows */
  box-shadow: 1px 1px 3px var(--shadow-light-2),
              -1px -1px 3px var(--shadow-light-1),
              inset 0 0 3px var(--glow-light);
}

/* Dark mode: Hover state with less glow */
html[data-theme="dark"] .theme-toggle:hover {
  box-shadow: 1px 1px 2px rgba(64, 255, 227, 0.5),
              -1px -1px 2px rgba(64, 255, 227, 0.1),
              inset 0 0 3px rgba(64, 255, 227, 0.15);
}

.theme-toggle:active {
  /* Active "Push" state - insets into the page */
  box-shadow: inset 3px 3px 6px var(--shadow-light-2),
              inset -3px -3px 6px var(--shadow-light-1);
}

/* Dark mode: Active state with only internal glow */
html[data-theme="dark"] .theme-toggle:active {
  box-shadow: inset 3px 3px 5px rgba(64, 255, 227, 0.25),
              inset -3px -3px 5px rgba(64, 255, 227, 0.05);
}

/* Icon container & animations */
.icon-container {
  position: relative;
  width: 18px;
  height: 18px;
}

.icon-container svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  fill: var(--text);
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Light Mode: Sun is visible, Moon is hidden */
html[data-theme="light"] .sun {
  opacity: 1;
  transform: translateX(0) scale(1);
}

html[data-theme="light"] .moon {
  opacity: 0;
  transform: translateX(10px) scale(0);
}

/* Light Mode Hover: Both icons visible, side-by-side */
html[data-theme="light"] .theme-toggle:hover .sun {
  transform: translateX(-12px);
}

html[data-theme="light"] .theme-toggle:hover .moon {
  opacity: 1;
  transform: translateX(12px) scale(1);
}

/* Dark Mode: Moon is visible, Sun is hidden */
html[data-theme="dark"] .sun {
  opacity: 0;
  transform: translateX(-10px) scale(0);
}

html[data-theme="dark"] .moon {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* Dark Mode Hover: Both icons visible, side-by-side */
html[data-theme="dark"] .theme-toggle:hover .sun {
  opacity: 1;
  transform: translateX(-12px) scale(1);
}

html[data-theme="dark"] .theme-toggle:hover .moon {
  transform: translateX(12px);
}

.infobox {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(var(--text-rgb), 0.08);
  padding: 1.5rem;
  margin: 2rem 0;
  background-color: var(--bg);
}

.infobox h4 {
  font-family: var(--font-heading);
  color: rgba(var(--text-rgb), 1); /* Changed to match other titles */
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.infobox ul {
  padding-left: 1rem;
  margin-bottom: 0;
}

/* Responsive images in content */
main article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto; /* Add some vertical space and center the image */
  border-radius: 8px; /* Match the theme's border radius */
  box-shadow: 0 4px 12px rgba(var(--text-rgb), 0.1); /* Add a subtle shadow */
}
