/* ----------------------------- */
/* 0) Modern CSS Reset           */
/* ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
ul[role='list'], ol[role='list'] { list-style: none; }
:target { scroll-margin-top: 6rem; }

/* Focus visibility */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 3px solid hsl(152 61% 45% / .9);
  outline-offset: 2px;
}

/* Smooth scroll for keyboard users too */
html:focus-within { scroll-behavior: smooth; }

/* ----------------------------- */
/* 1) Design Tokens (Dark)       */
/* ----------------------------- */
:root {
  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";

  /* Radii, elevation, spacing */
  --radius-xs: .5rem;
  --radius: 1.25rem;
  --gap-1: .5rem;
  --gap-2: 1rem;
  --gap-3: 1.25rem;
  --gap-4: 2rem;

  /* Color (dark theme) */
  --bg: #0b1220;
  --bg-soft: #0f172a;
  --surface: #111827;
  --surface-border: #1f2937;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --link: #93c5fd;

  /* Misc */
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* Light theme overrides (only colors/shadow) */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-border: #e5e7eb;
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --link: #1d4ed8;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.10);
}

/* ----------------------------- */
/* 2) Base                       */
/* ----------------------------- */
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 80% -10%, color-mix(in oklab, var(--surface), black 20%) 0%, transparent 60%),
    var(--bg);
}

/* Headings & text rhythm */
h1, h2, h3 { line-height: 1.15; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem); }
h2 { font-size: clamp(1.35rem, 1rem + 1.4vw, 2rem); margin-bottom: .6rem; }
h3 { font-size: clamp(1.05rem, .9rem + .6vw, 1.25rem); }
p + p { margin-top: .8rem; }

/* Utility text */
.lead { font-size: 1.05rem; }
.small { font-size: .9rem; }
.muted { color: var(--text-muted); }
.accent { color: var(--accent); }
.visually-hidden {
  position: absolute !important; height: 1px; width: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Containers & sections */
.container { width: min(1100px, 92%); margin-inline: auto; }
.section { padding: 4rem 0; }
.section--soft { background: var(--bg-soft); }

/* Make consecutive soft sections feel like one combined band */
.section--soft + .section--soft {
  padding-top: 1.5rem;
  margin-top: -1rem;
  border-top: 1px solid var(--surface-border);
}

/* Grid helpers */
.grid-2 {
  display: grid; gap: 2rem;
  grid-template-columns: 1.1fr 0.9fr;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Links */
a { text-decoration: none; }
a.underlined { text-decoration: underline; text-underline-offset: 3px; }

/* Animation helper */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .4s ease both; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----------------------------- */
/* 3) Header & Navigation        */
/* ----------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg), transparent 20%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--surface-border);
}
.header__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 0;
}
.brand {
  font-weight: 800; letter-spacing: .3px;
  color: var(--text);
  font-size: 1.15rem;
}
.brand span { color: var(--accent); }

/* Nav list */
.nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  font-size: 0.78rem;
  transition:
    color 0.18s ease,
    transform 0.14s ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
  transition: width 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent);
  transform: translateY(-1px);
}

.nav a:hover::after,
.nav a:focus-visible::after {
  width: 100%;
}

/* Existing title/subtitle block under nav */
.site-header__inner {
  max-width: var(--container-width);
  margin: 0 auto;
}

.site-title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  letter-spacing: 0.04em;
}

.site-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Responsive tweaks */
@media (max-width: 780px) {
  .header__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .nav {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }
}

/* ----------------------------- */
/* 4)   About Section            */
/* ----------------------------- */
/* Spotify in About (vertical)   */
/* ----------------------------- */
:root {
  --spotify: #1db954; /* official spotify green */
}

.about__spotify {
  align-self: flex-start;
}

.spotify {
  padding: 0;
}

/* Badge at top of card */
.spotify__badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 1rem 1.2rem 0;
  color: var(--spotify);
  font-weight: 700;
}

.spotify__badge svg { display: inline-block; }

.spotify__live {
  position: relative;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--spotify);
  margin-left: .15rem;
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--spotify), transparent 0%);
  animation: spotifyPulse 1.8s ease-out infinite;
}

@keyframes spotifyPulse {
  0%   { box-shadow: 0 0 0 0 rgba(29,185,84,.6); }
  70%  { box-shadow: 0 0 0 10px rgba(29,185,84,0); }
  100% { box-shadow: 0 0 0 0 rgba(29,185,84,0); }
}

/* Always vertical: cover on top, text below */
.spotify__content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.2rem;
  padding-top: .6rem;
}

/* Album art box */
.spotify__media {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 0.5rem;
  aspect-ratio: 1/1;
  border-radius: .9rem;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: var(--bg);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.spotify__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition:
    filter 0.2s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* Meta & text */
.spotify__meta h3 {
  margin: .25rem 0 .2rem;
  font-size: clamp(1.05rem, .95rem + .3vw, 1.2rem);
}
.spotify__meta p { margin: 0; }

.spotify__progress {
  margin-top: .9rem;
}
.spotify__bar {
  --track: color-mix(in oklab, var(--surface-border), white 10%);
  --fill: var(--spotify);
  position: relative; height: 8px; border-radius: 999px;
  background: var(--track);
  overflow: hidden; border: 1px solid var(--surface-border);
}
.spotify__bar > span {
  display: block; height: 100%; background: var(--fill);
  border-right: 1px solid color-mix(in oklab, var(--spotify), black 15%);
}
.spotify__times {
  display: flex; justify-content: space-between;
  margin-top: .35rem;
}

.spotify__actions {
  margin-top: 1rem;
  display: flex; gap: .5rem; flex-wrap: wrap;
}

/* Skeleton / loading state */
.spotify.is-loading .spotify__media img {
  opacity: 0;
}
.spotify.is-loading .spotify__media {
  background: linear-gradient(90deg, #0b1220 0%, #0f172a 40%, #0b1220 80%);
  background-size: 300% 100%;
  animation: shimmer 1.6s infinite linear;
}
.spotify.is-loading #spotify-track,
.spotify.is-loading #spotify-artist,
.spotify.is-loading #spotify-album {
  color: transparent;
  background: linear-gradient(90deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,.12) 40%, rgba(255,255,255,.06) 80%);
  background-size: 300% 100%;
  border-radius: .4rem;
  animation: shimmer 1.6s infinite linear;
}
@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

/* -------------------------------------- */
/* Not-playing / idle state (isPlaying=0) */
/* -------------------------------------- */
/* JS adds `spotify-card--idle` to #spotify-card when isPlaying = false */

.spotify.spotify-card--idle {
  border-style: dashed;
  border-color: color-mix(in oklab, var(--surface-border), white 10%);
  background: color-mix(in oklab, var(--bg), black 10%);
  opacity: 0.95;
}

/* Badge + live dot look "idle" instead of live */
.spotify.spotify-card--idle .spotify__badge {
  color: rgba(148, 163, 184, 0.9); /* slate-300/400 */
}

.spotify.spotify-card--idle .spotify__live {
  background: rgba(148, 163, 184, 0.8);
  box-shadow: none;
  animation: none;
}

/* Album box in idle: subtle gradient + dimmed art */
.spotify.spotify-card--idle .spotify__media {
  border-style: dashed;
  background:
    radial-gradient(circle at top, rgba(148,163,184,.25), transparent 55%),
    var(--bg);
}

.spotify.spotify-card--idle .spotify__media img {
  filter: grayscale(1);
  opacity: 0.35;
  transform: scale(1.02);
}

/* Optional: status text styling pairs with "Not currently listening to anything" */
#spotify-status {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.95;
}

.spotify.spotify-card--idle #spotify-status {
  color: rgba(148, 163, 184, 0.9);
}


/* ----------------------------- */
/* Quote + Book combined section */
/* ----------------------------- */
.quote-book {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: stretch;
}

/* Left: quote column */
.quote-book__quote {
  flex: 2 1 280px;
}

/* Center: Book title + link card */
.quote-book__book {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
}

.quote-book__quote h2,
.quote-book__book h2 {
  margin-bottom: 0.75rem;
}

/* Right: cover image column */
.quote-book__cover {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Compact "Book of the Month" card */
.book-min {
  height: 100%;
}

.book-min__content {
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.book-min__title {
  margin: 0;
  font-size: 1rem;
}

/* Fixed-size thumbnail for the cover */
.book-min__cover {
  margin: 0;
}

.book-min__cover img {
  width: 110px;
  height: 160px;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid var(--surface-border);
}

/* Stack nicely on small screens */
@media (max-width: 800px) {
  .quote-book {
    flex-direction: column;
  }

  .quote-book__cover {
    justify-content: flex-start;
  }
}

/* ───────────────────────────────────────────── */
/* PARTICLE BACKDROP FOR SKILLS / LINKS / PROJECTS */
/* ───────────────────────────────────────────── */

/* Wrapper that hosts content + particles */
.section--with-particles {
  position: relative;
  overflow: hidden;
}

/* Foreground content stays clickable and above particles */
.section--with-particles .stacked-section__content {
  position: relative;
  z-index: 2;
}

/* Shared particle layer */
.cf-particles-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Individual particle dot */
.cf-particle {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  z-index: 1;
}

/* Smooth drifting + fade */
@keyframes cf-float {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--cf-move-x), var(--cf-move-y), 0);
    opacity: 0;
  }
}

/* Light theme: turn particles into colorful confetti */
html[data-theme="light"] .cf-particle {
  position: absolute;
  z-index: 1;

  /* Size from custom properties, with sane defaults */
  width: var(--cf-size, 7px);
  height: var(--cf-length, 18px);

  border-radius: 999px;
  opacity: 0.95;
  filter: none;

  /* Kill any inline gradients from JS and force solid colors */
  background-image: none !important;
  background-color: #0ea5e9 !important;  /* default cyan/blue */

  box-shadow:
    0 0 3px rgba(15, 23, 42, 0.28),
    0 0 10px rgba(15, 23, 42, 0.16);
}

/* Multicolor stripes */
html[data-theme="light"] .cf-particle:nth-child(5n + 1) {
  background-color: #0ea5e9 !important;  /* cyan/blue */
}
html[data-theme="light"] .cf-particle:nth-child(5n + 2) {
  background-color: #22c55e !important;  /* green */
}
html[data-theme="light"] .cf-particle:nth-child(5n + 3) {
  background-color: #f97316 !important;  /* orange */
}
html[data-theme="light"] .cf-particle:nth-child(5n + 4) {
  background-color: #a855f7 !important;  /* purple */
}
html[data-theme="light"] .cf-particle:nth-child(5n + 5) {
  background-color: #e11d48 !important;  /* pink/red */
}

/* Some shorter dots mixed in for variety */
html[data-theme="light"] .cf-particle:nth-child(7n) {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}


/* ----------------------------- */
/* 8) Link Cards (Socials)       */
/* ----------------------------- */
.link-cards {
  display: grid; gap: var(--gap-3);
  grid-template-columns: repeat(2, minmax(0,1fr));
  margin-top: 1rem; padding: 0; list-style: none;
}
@media (max-width: 700px) { .link-cards { grid-template-columns: 1fr; } }

.link-cards .card a {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem;
  align-items: start; color: var(--text);
}

/* Base emoji icon styling */
.link-cards .emoji,
.link-cards .emoji-w {
  font-size: 1.6rem;
  display: grid;
  place-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-soft);
  border-radius: .8rem;
  border: 1px solid var(--surface-border);
  position: relative;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    background-color 0.12s ease;
}

/* Hover / focus = subtle lift + accent border + slight glow */
.link-cards .card a:hover .emoji,
.link-cards .card a:focus-visible .emoji,
.link-cards .card a:hover .emoji-w,
.link-cards .card a:focus-visible .emoji-w {
  transform: translateY(-2px);
  border-color: var(--accent-strong);
  background: color-mix(in oklab, var(--surface) 90%, var(--accent) 10%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

/* ----------------------------- */
/* 9) Skills Section             */
/* ----------------------------- */
.skills-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.skills-list li {
  flex: 1 1 calc(33.333% - 1rem);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xs);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  position: relative;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    background-color 0.12s ease;
}

/* Hover / focus = subtle lift + accent border + slight glow */
.skills-list li:hover,
.skills-list li:focus-within {
  transform: translateY(-2px);
  border-color: var(--accent-strong);
  background: color-mix(in oklab, var(--surface) 90%, var(--accent) 10%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

/* 2 per row on medium screens */
@media (max-width: 900px) {
  .skills-list li {
    flex: 1 1 calc(50% - 1rem);
  }
}

/* 1 per row on small screens */
@media (max-width: 600px) {
  .skills-list li {
    flex: 1 1 100%;
  }
}

/* ----------------------------- */
/* 10) Projects Grid & Cards     */
/* ----------------------------- */

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

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

@media (max-width: 700px) {
  .projects {
    grid-template-columns: 1fr;
  }
}

/* Fixed-ratio media box, uniform across cards */
.project__media {
  position: relative;
  width: 100%;
  padding-top: 62.5%;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  overflow: hidden;
}

/* Image is centered and fully contained in the box (no crop) */
.project__media img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain !important;
  display: block;
}

.project__body {
  padding-top: 1rem !important;
}

.project__links {
  display: flex;
  gap: .6rem;
  margin-top: .8rem;
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent); color: color-mix(in oklab, var(--bg), black 10%);
  border: 1px solid var(--accent-strong);
  font-weight: 700; text-decoration: none;
  padding: .55rem .9rem; border-radius: .7rem;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--surface-border);
}

/* ----------------------------- */
/* 12) Footer                    */
/* ----------------------------- */
.site-footer {
  padding: 2.2rem 0;
  border-top: 1px solid var(--surface-border);
  background: var(--bg);
}
.footer__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.back-to-top {
  color: var(--text-muted);
  text-decoration: none;
  border: 1px dashed var(--surface-border);
  padding: .35rem .6rem; border-radius: .6rem;
}
.back-to-top:hover { color: var(--text); border-style: solid; }

/* Theme toggle button in footer */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

.theme-toggle__icon {
  font-size: 1rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: color-mix(in oklab, var(--surface) 85%, var(--accent) 15%);
  border-color: var(--accent-strong);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.35);
  transform: translateY(-1px);
}

/* ----------------------------- */
/* 13) Utilities                 */
/* ----------------------------- */
.stack > * + * { margin-top: var(--gap-2); }
.cluster { display: flex; gap: var(--gap-2); align-items: center; flex-wrap: wrap; }
.title { margin: 0 0 1rem; }
hr { border: 0; border-top: 1px solid var(--surface-border); margin: 1.5rem 0; }

/* Link styles for content areas */
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { opacity: .9; }

/* Accent underline (use on headings/links) */
.underline-accent {
  position: relative;
}
.underline-accent::after {
  content: "";
  position: absolute; left: 0; bottom: -.25rem;
  width: 3rem; height: 3px; background: var(--accent);
  border-radius: 999px;
}

/* ----------------------------- */
/* 14) Print Styles              */
/* ----------------------------- */
@media print {
  :root {
    --bg: #ffffff;
    --bg-soft: #ffffff;
    --surface: #ffffff;
    --text: #000;
    --text-muted: #444;
    --surface-border: #ddd;
    --shadow: none;
  }
  body { background: #fff; }
  .site-header, .back-to-top { display: none !important; }
  .card { box-shadow: none; border: 1px solid var(--surface-border); }
  a { text-decoration: underline; color: #000; }
}
