/* Courier Prime — self-hosted */
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime/courierprime-regular.woff2") format("woff2"),
       url("/fonts/courier-prime/CourierPrime-Regular.ttf") format("truetype");
  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"),
       url("/fonts/courier-prime/CourierPrime-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


:root {
  --accent: #C8763C;
  --bg-light: #fdfaf6;
  --bg-dark: #1a1410;
  --bg-light-rgb: 253, 250, 246;
  --bg-dark-rgb: 26, 20, 16;
  --text-light: #2e1c0e;
  --text-dark: #e8ddd0;
  --text-light-rgb: 46, 28, 14;
  --text-dark-rgb: 232, 221, 208;
  --font-heading: "Courier Prime", Courier, monospace;
  --body-width: 1200px;
  --content-width: 1136px;
}

html[data-theme="light"] {
  --bg: var(--bg-light);
  --bg-rgb: var(--bg-light-rgb);
  --text: var(--text-light);
  --text-rgb: var(--text-light-rgb);
  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] {
  --bg: var(--bg-dark);
  --bg-rgb: var(--bg-dark-rgb);
  --text: var(--text-dark);
  --text-rgb: var(--text-dark-rgb);
  --glass-bg: rgba(30, 30, 30, 0.5);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.2);
}

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(16px);
  -webkit-backdrop-filter: blur(16px);
  background-color: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 12px var(--glass-shadow);
}


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 {
  /* Three zones: name (left) · menu (centered) · toggle (right).
     1fr auto 1fr keeps the menu centred regardless of the side widths. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

/* Name / logotype — left zone, links home */
.site-name {
  justify-self: start;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}

.site-name:hover,
.site-name:focus {
  color: var(--accent);
}

/* Center menu — keeps the existing link styling */
.nav-menu {
  justify-self: center;
  display: flex;
  gap: 1rem;
}

/* Toggle — right zone */
nav .theme-toggle {
  justify-self: end;
}

.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 - GLASSMORPHISM
   ============================================ */

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  padding: 0;
  box-shadow: 0 4px 12px var(--glass-shadow);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              background 0.3s ease, 
              border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: rgba(var(--text-rgb), 0.08);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* 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);
  /* Smooth iOS-style curve for rotation and scale */
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              fill 0.4s ease;
}

/* Light Mode State */
html[data-theme="light"] .sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

html[data-theme="light"] .moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* Dark Mode State */
html[data-theme="dark"] .sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

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

/* Subtle accent color on hover for the active icon */
.theme-toggle:hover .sun,
.theme-toggle:hover .moon {
  fill: var(--accent);
}

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

/* Working On Section */
.working-on {
  margin: 3rem 0;
  padding: 1.5rem;
  background-color: rgba(var(--text-rgb), 0.03);
  border-radius: 8px;
  /* Removed font-family: 'Courier Prime' so it inherits body font (sans-serif) by default */
  color: var(--text);
  border: 1px solid rgba(var(--text-rgb), 0.1);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Remove direct hardcoded overrides as we now use variables */
/* If specific tweaks are needed, we can add them, but variables should handle it */

.status-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(var(--text-rgb), 0.7);
}

.status-indicator {
  position: relative;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blink {
  display: block;
  width: 10px;
  height: 10px;
  background-color: var(--accent);
  /* Use accent color */
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: blink-animation 3s infinite ease-in-out;
}

@keyframes blink-animation {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent);
  }

  100% {
    opacity: 0.3;
    transform: scale(0.9);
  }
}

/* Project Table Styles */
.project-list-container {
  margin-top: 1rem;
}

.project-table {
  width: 100%;
  border: none;
  /* Override default table border */
  border-top: none;
}

.project-table td {
  border-bottom: none;
  /* Remove separation lines if desired, or keep them */
  padding: 0.75rem 0.5rem;
  vertical-align: top;
}

/* 1st Column: Title & Date */
.project-info-cell {
  width: 35%;
  /* Narrower, as titles are usually short */
  padding-right: 1.5rem;
  /* Spacing between columns */
  text-align: left;
}

/* 2nd Column: Description */
.project-desc-cell {
  width: 65%;
  color: rgba(var(--text-rgb), 0.9);
}

/* Typography matching Job Experience (li h3 and li em) */
.project-info-cell h3 {
  /* Inherit global h3 font (Courier) and size (1.3rem) */
  font-family: var(--font-heading);
  font-weight: normal;
  /* Match li h3 */
  margin: 0 0 0.2rem 0;
  /* Reset margin like li h3, add small bottom spacing */
  color: rgba(var(--text-rgb), 1);
  line-height: 1.3;
  font-size: 1.3rem;
  /* Explicitly matching global h3 size */
}

.project-info-cell em {
  display: block;
  font-style: italic;
  color: var(--text);
  opacity: 0.6;
  /* Font family will now inherit from proper body (sans-serif) since we removed it from .working-on */
  font-size: 1rem;
  /* Standard text size */
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  /* Header: drop to two rows so three zones never crowd on narrow screens.
     Row 1: name (left) + toggle (right). Row 2: menu, centred. */
  nav {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name   toggle"
      "menu   menu";
    row-gap: 0.5rem;
  }

  .site-name {
    grid-area: name;
  }

  nav .theme-toggle {
    grid-area: toggle;
  }

  .nav-menu {
    grid-area: menu;
  }

  .project-desc-cell {
    width: 50%;
    padding-right: 0.5rem;
  }

  .project-info-cell {
    width: 50%;
  }
}

/* Snowfall Canvas */
#snow-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  pointer-events: none;
  /* Allow clicks to pass through */
}