/* ============================================================
   Muhammad Masood — portfolio
   Multi-page layout: left sticky sidebar + main column.
   Markdown-driven content; per-page sections rendered by script.js.
   ============================================================ */

:root {
  /* light theme — warm cream */
  --bg: #f4f1e8;
  --bg-soft: #ebe6d6;
  --panel: #fbf8ef;
  --ink: #1a1714;
  --ink-soft: #2c2823;
  --muted: #7a6f63;
  --line: #d8cfbb;
  --line-soft: #e6dfcc;
  --accent: #c1452f;
  --accent-soft: #e08768;
  --gold: #b58a3a;
  --green: #355a48;
  --blue: #2d4a6e;

  --font-sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Instrument Serif", "Georgia", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --shadow-sm: 0 1px 2px rgba(28, 24, 18, 0.06);
  --shadow: 0 6px 18px rgba(28, 24, 18, 0.08);
  --shadow-lg: 0 28px 60px rgba(28, 24, 18, 0.14);
  --shadow-xl: 0 40px 100px rgba(28, 24, 18, 0.28);

  --sidebar-w: 248px;
  --content-pad: clamp(28px, 6vw, 88px);
  --rail-max: 880px;

  --radius: 14px;
  --radius-sm: 8px;

  --t-fast: 120ms ease;
  --t: 220ms ease;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --bg-soft: #14171d;
  --panel: #1a1e25;
  --ink: #ece6d7;
  --ink-soft: #d8d1bf;
  --muted: #8a8478;
  --line: #2a2f38;
  --line-soft: #1f242b;
  --accent: #ea8a5b;
  --accent-soft: #f0a481;
  --gold: #d6b25a;
  --green: #6dab8a;
  --blue: #6c97c8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 40px 110px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: #fff8ed;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a { color: inherit; }
p, h1, h2, h3, h4, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }

code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); }

/* =====================================================
   SIDEBAR
   ===================================================== */

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  z-index: 30;
  transition: transform var(--t);
}

.sidebar-inner {
  display: flex; flex-direction: column;
  height: 100%;
  padding: 26px 22px 22px;
  overflow-y: auto;
}

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.01em;
}

.theme-toggle {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; line-height: 0; }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-label {
  margin: 22px 0 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.nav-label:first-child { margin-top: 0; }
.elsewhere-label {
  width: 100%;
  text-align: center;
}

.side-nav ul { display: flex; flex-direction: column; }

.side-nav a {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 7px 10px; margin-left: -10px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.86rem; font-weight: 500;
  text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.side-nav a:hover { color: var(--accent); background: var(--bg); }
.side-nav a.is-active { color: var(--accent); background: var(--bg); }

.side-icons {
  display: grid !important;
  grid-template-columns: repeat(4, 34px);
  justify-content: center;
  justify-items: center;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  width: 100%;
}
.side-icons li { display: inline-flex; flex: 0 0 auto; }
.side-icons a {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  align-items: center;
  justify-content: center;
  transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.side-icons a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.side-icons svg { display: block; }

/* =====================================================
   CONTENT WRAPPER
   ===================================================== */

.content {
  margin-left: var(--sidebar-w);
  padding: 0 var(--content-pad);
  min-height: 100vh;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 170ms ease, transform 170ms ease;
}

body:not(.is-ready) .content {
  opacity: 0;
  transform: translateY(5px);
}

body.is-navigating .content {
  opacity: 0;
  transform: translateY(8px);
}

.page-section {
  max-width: var(--rail-max);
  padding: clamp(72px, 11vh, 130px) 0;
}

.page-section + .page-section {
  border-top: 1px dashed var(--line);
}

/* =====================================================
   SECTION HEADERS
   ===================================================== */

.section-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 22px;
  padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0.04em;
}
.section-eyebrow .hash { color: var(--accent); font-weight: 700; }

.section-title {
  max-width: 760px;
  margin-bottom: 22px;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5.4vw, 3.8rem);
  font-weight: 400; line-height: 1.05; letter-spacing: -0.01em;
  color: var(--ink);
}

.page-lead {
  max-width: 620px;
  margin-bottom: 34px;
  font-size: 1rem;
}

/* =====================================================
   HERO
   ===================================================== */

.hero {
  min-height: calc(100vh - 80px);
  padding: clamp(54px, 10vh, 124px) 0 clamp(60px, 10vh, 120px);
  display: flex; flex-direction: column; justify-content: center;
  max-width: var(--rail-max);
}

.hero-stage {
  position: relative; display: flex; justify-content: center;
  min-height: clamp(300px, 44vw, 460px);
  margin-bottom: 24px;
  align-items: center;
  isolation: isolate;
}

.hero-name {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  margin: clamp(86px, 13vw, 150px) 0 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(5rem, 18vw, 13rem);
  line-height: 0.92; letter-spacing: -0.02em;
  text-align: center;
  color: var(--ink);
  z-index: 2;
}
.hero-name span { display: block; }
.hero-name em { font-style: italic; color: var(--accent); }

.sparkles {
  position: absolute; inset: -18% -8% -18% -8%;
  pointer-events: none; z-index: 1;
}

.orbit {
  position: absolute; inset: 14% 2%;
  border: 1.4px solid var(--line); border-radius: 50%;
  transform: rotate(-12deg); opacity: 0.65;
}

.hero-photo {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 3;
  display: grid;
  width: clamp(104px, 18vw, 166px);
  aspect-ratio: 4 / 5;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 999px 999px 12px 12px;
  background:
    linear-gradient(135deg, rgba(193, 69, 47, 0.16), rgba(181, 138, 58, 0.16)),
    var(--panel);
  color: var(--ink);
  text-decoration: none;
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: var(--shadow-lg);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}

.hero-photo:hover,
.hero-photo:focus-visible {
  border-color: var(--accent);
  transform: translateX(-50%) rotate(0deg) translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--t);
}

.hero-photo.is-loaded img { opacity: 1; }
.hero-photo.is-loaded .photo-fallback { display: none; }

.photo-fallback {
  position: absolute;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: var(--font-serif);
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  font-style: italic;
  color: var(--accent);
}

.photo-hover {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 4;
  width: max-content;
  max-width: calc(100% - 18px);
  padding: 6px 10px;
  border: 1px solid rgba(255, 248, 237, 0.7);
  border-radius: 999px;
  background: rgba(20, 18, 14, 0.72);
  color: #fff8ed;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity var(--t), transform var(--t);
}

.hero-photo:hover .photo-hover,
.hero-photo:focus-visible .photo-hover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hero-stickers {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.hero-stickers span {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.hero-stickers span:nth-child(1) { transform: rotate(-2deg); }
.hero-stickers span:nth-child(2) { transform: translateY(8px) rotate(1.4deg); }
.hero-stickers span:nth-child(3) { transform: rotate(2deg); }

.star {
  position: absolute;
  color: var(--accent-soft);
  font-size: 1.4rem;
  animation: twinkle 3.4s ease-in-out infinite;
}
.star.s1 { top: 6%;  left: 10%; font-size: 1.2rem; color: var(--gold);   animation-delay: 0s; }
.star.s2 { top: 14%; right: 8%; font-size: 1.6rem; color: var(--accent); animation-delay: 0.4s; }
.star.s3 { bottom: 10%; left: 18%; font-size: 1rem;   color: var(--blue);  animation-delay: 0.8s; }
.star.s4 { bottom: 22%; right: 14%; font-size: 1.3rem; color: var(--green); animation-delay: 1.1s; }
.star.s5 { top: 48%; left: 2%;  font-size: 0.9rem; color: var(--gold);   animation-delay: 1.6s; }
.star.s6 { top: 30%; right: 2%; font-size: 1.5rem; color: var(--accent); animation-delay: 2s; }
.star.s7 { bottom: 4%; left: 48%; font-size: 1.2rem; color: var(--accent-soft); animation-delay: 0.6s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85) rotate(0deg); }
  50%      { opacity: 1;    transform: scale(1.15) rotate(8deg); }
}

.hero-tagline {
  display: inline-flex; align-self: center; align-items: center;
  gap: 10px;
  padding: 7px 16px;
  margin-bottom: 56px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 0.78rem; color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #1da565;
  box-shadow: 0 0 0 4px rgba(29, 165, 101, 0.18);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(29, 165, 101, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(29, 165, 101, 0.06); }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

.hero-card {
  position: relative;
  padding: clamp(18px, 2.4vh, 22px) 24px clamp(16px, 2.2vh, 20px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.hero-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--ink-soft); }

.now-card { border-top: 2px solid color-mix(in srgb, var(--accent) 55%, var(--line)); }
.wins-card { border-top: 2px solid color-mix(in srgb, var(--gold) 60%, var(--line)); }

.hero-card header {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; color: var(--muted);
  text-transform: uppercase;
}

.now-pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(193, 69, 47, 0.18);
  animation: pulse-dot 2s ease-in-out infinite;
}

.now-line, .now-line p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.48;
  color: var(--ink);
}

.now-meta {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem; color: var(--muted);
}

.wins-card ul { display: flex; flex-direction: column; gap: 10px; }
.wins-card li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 0.98rem;
  line-height: 1.48;
  color: var(--ink-soft);
}
.wins-card .bullet {
  display: inline-block;
  padding-top: 0.08em;
  line-height: 1.48;
  color: var(--accent);
  font-family: var(--font-mono); font-weight: 700;
}

.hero-quicklinks {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.84rem; font-weight: 600;
}
.hero-quicklinks a {
  display: inline-flex; align-items: center;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.hero-quicklinks a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  background: var(--bg);
}

/* Homepage split intro */
body[data-page="home"] .hero {
  position: relative;
  min-height: 100vh;
  height: 100vh;
  padding: clamp(34px, 6.5vh, 64px) 0 clamp(20px, 4vh, 38px);
  justify-content: center;
  max-width: min(1120px, 100%);
  overflow: hidden;
}

/* soft warm glow behind the hero */
body[data-page="home"] .hero::before {
  content: "";
  position: absolute;
  top: -12%;
  right: -8%;
  z-index: 0;
  width: clamp(320px, 46vw, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--accent) 10%, transparent) 0%,
    color-mix(in srgb, var(--gold) 7%, transparent) 45%,
    transparent 70%);
  pointer-events: none;
}

/* tinted sticker-backdrop behind the cutout photo */
body[data-page="home"] .hero-photo::before {
  content: "";
  position: absolute;
  inset: 16% 4% 0;
  z-index: 0;
  border-radius: 26px;
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--accent) 14%, transparent),
    color-mix(in srgb, var(--gold) 16%, transparent));
  transform: rotate(-2deg);
  transition: transform var(--t), background var(--t);
}

body[data-page="home"] .hero-photo:hover::before {
  transform: rotate(0deg) scale(1.02);
}

body[data-page="home"] .hero-photo img {
  position: relative;
  z-index: 1;
}

body[data-page="home"] {
  overflow: hidden;
}

.hero-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.62fr);
  align-items: start;
  gap: 0 clamp(34px, 5vw, 60px);
  margin-top: clamp(12px, 2.5vh, 28px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

body[data-page="home"] .hero-name {
  display: block;
  margin: 0;
  font-size: clamp(5rem, 11vw, 9.6rem);
  line-height: 0.88;
  text-align: left;
}

body[data-page="home"] .hero-name span {
  display: block;
}

.hero-interest-note {
  max-width: 720px;
  margin: clamp(10px, 1.7vh, 16px) 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.94rem, 1.3vw, 1.05rem);
  font-weight: 600;
  line-height: 1.48;
}

body[data-page="home"] .hero-quicklinks {
  grid-column: 1 / -1;
  margin-top: clamp(14px, 2.2vh, 22px);
  margin-bottom: 0;
}

body[data-page="home"] .hero-grid {
  grid-column: 1 / -1;
  width: 100%;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(18px, 2.5vw, 24px);
  margin: clamp(18px, 3vh, 28px) 0 0;
}

.hero-media {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

body[data-page="home"] .hero-photo {
  position: relative;
  top: auto;
  left: auto;
  width: min(310px, 100%);
  min-height: min(390px, 48vh);
  justify-self: end;
  border: 0;
  border-radius: 22px;
  background: transparent;
  box-shadow: none;
  transform: translateY(2px) rotate(1.5deg);
}

body[data-page="home"] .hero-photo:hover,
body[data-page="home"] .hero-photo:focus-visible {
  border-color: transparent;
  transform: translateY(-4px) rotate(0deg);
  box-shadow: none;
}

.wins-card header {
  justify-content: space-between;
  width: 100%;
}

.wins-sound {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff8ed;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast);
  animation: wins-pulse 2.4s ease-in-out infinite;
}

.wins-sound:hover {
  transform: translateY(-1px);
  background: var(--ink);
}

@keyframes wins-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 42%, transparent); }
  70%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* hand-drawn "click me!" annotation pointing at the W's button */
.wins-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  margin-right: 8px;
  pointer-events: none;
  color: var(--accent);
}

.wins-hint .hint-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  white-space: nowrap;
  transform: rotate(-2deg);
}

.wins-hint .hint-arrow {
  width: 26px;
  height: 15px;
  margin-top: 3px;
  animation: hint-nudge 1.5s ease-in-out infinite;
}

@keyframes hint-nudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(4px); }
}

body[data-page="home"] .sparkles {
  inset: 3% 0 0;
}

/* =====================================================
   PROSE (about, reader, etc.)
   ===================================================== */

.prose p, .prose ul, .prose ol, .prose blockquote {
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.prose strong { color: var(--ink); font-weight: 600; }
.prose a {
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  color: var(--accent);
}

/* =====================================================
   TIMELINE
   ===================================================== */

.timeline {
  position: relative;
  margin-top: 8px;
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 14px; bottom: 14px; left: 7px;
  width: 1.5px;
  background: linear-gradient(var(--accent), var(--line) 30%, var(--line));
  opacity: 0.6;
}

.t-entry {
  position: relative;
  display: grid; grid-template-columns: 1fr;
  margin-bottom: 28px;
}

.t-marker {
  position: absolute;
  left: -26px; top: 8px;
  width: 16px; height: 16px;
  display: grid; place-items: center;
}
.t-marker span {
  width: 10px; height: 10px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.t-card {
  padding: 18px 22px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), transform var(--t);
}
.t-card:hover { border-color: var(--ink-soft); transform: translateY(-1px); }

.t-date {
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.1em;
  color: var(--accent); text-transform: uppercase;
}
.t-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 6px;
}
.t-title strong { font-weight: 800; font-style: normal; }
.t-body p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }

/* =====================================================
   PROJECTS
   ===================================================== */

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

body[data-page="projects"] .page-section {
  max-width: min(1160px, 100%);
}

body[data-page="projects"] .page-lead {
  max-width: 760px;
}

.filter {
  padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.filter:hover { color: var(--ink); border-color: var(--ink-soft); }
.filter.is-on { color: var(--panel); background: var(--ink); border-color: var(--ink); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--ink-soft); }
.project-card.is-hidden { display: none; }

.winner-ribbon {
  position: absolute;
  top: 18px;
  left: -42px;
  z-index: 4;
  width: 156px;
  padding: 5px 0;
  background: linear-gradient(90deg, #a97412, #f1c85b, #b58a3a);
  color: #1a1714;
  box-shadow: 0 8px 18px rgba(28, 24, 18, 0.2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-45deg);
}

.card-cover { display: block; border-bottom: 1px solid var(--line); }

.cover {
  position: relative;
  display: flex; align-items: flex-end;
  height: 200px;
  padding: 14px;
  overflow: hidden;
  color: #fff8ed;
  font-family: var(--font-mono); font-size: 0.7rem;
}

.cover-image {
  background-size: cover; background-position: center;
}

.cover-fallback {
  background: linear-gradient(135deg, var(--blue) 0%, var(--green) 70%, var(--accent) 100%);
}

.cover-label {
  position: relative; z-index: 2;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  letter-spacing: 0.04em;
}

.cover-partner {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 248, 237, 0.72);
  border-radius: 7px;
  background: rgba(10, 12, 14, 0.46);
  color: #fff8ed;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

/* BelCiti */
.cover-belciti {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 50%),
    linear-gradient(135deg, #2d4a6e 0%, #355a48 70%, #1a2a3c 100%);
}
.cover-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
}
.cover-pin {
  position: absolute; width: 10px; height: 10px;
  border-radius: 50%;
  background: #ea8a5b;
  box-shadow: 0 0 0 4px rgba(234, 138, 91, 0.25), 0 0 0 8px rgba(234, 138, 91, 0.1);
}
.pin-1 { top: 38%; left: 28%; }
.pin-2 { top: 56%; left: 60%; background: #d6b25a;
  box-shadow: 0 0 0 4px rgba(214, 178, 90, 0.25), 0 0 0 8px rgba(214, 178, 90, 0.1); }
.pin-3 { top: 24%; left: 70%; background: #6dab8a;
  box-shadow: 0 0 0 4px rgba(109, 171, 138, 0.25), 0 0 0 8px rgba(109, 171, 138, 0.1); }
.cover-route {
  position: absolute; top: 40%; left: 28%;
  width: 42%; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.7) 0 6px, transparent 6px 12px);
  transform: rotate(20deg);
}

/* Lattice */
.cover-lattice {
  background:
    radial-gradient(circle at 80% 20%, rgba(193, 69, 47, 0.4), transparent 60%),
    linear-gradient(135deg, #1a1714 0%, #2c2823 100%);
}
.lattice-net {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(60deg, rgba(193, 69, 47, 0.3) 1px, transparent 1px),
    linear-gradient(120deg, rgba(193, 69, 47, 0.3) 1px, transparent 1px),
    linear-gradient(rgba(193, 69, 47, 0.18) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px, 32px 32px;
}
.lattice-node {
  position: absolute; width: 8px; height: 8px;
  border-radius: 50%; background: #ea8a5b;
  box-shadow: 0 0 14px rgba(234, 138, 91, 0.7);
  animation: lattice-pulse 2.4s ease-in-out infinite;
}
.lattice-node.n1 { top: 22%; left: 18%; }
.lattice-node.n2 { top: 42%; left: 64%; animation-delay: 0.6s; }
.lattice-node.n3 { top: 64%; left: 30%; animation-delay: 1.2s; }
.lattice-node.n4 { top: 30%; left: 82%; animation-delay: 1.8s; }
@keyframes lattice-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.4); }
}

/* TheftSense */
.cover-theft {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 4px),
    linear-gradient(135deg, #1a1714 0%, #2d2218 100%);
}
.cover-frame { position: absolute; inset: 24px; border: 1px dashed rgba(255, 255, 255, 0.18); }
.cover-bracket { position: absolute; width: 18px; height: 18px; border: 2px solid #ea8a5b; }
.b-tl { top: 22px; left: 22px; border-right: none; border-bottom: none; }
.b-tr { top: 22px; right: 22px; border-left: none; border-bottom: none; }
.b-bl { bottom: 22px; left: 22px; border-right: none; border-top: none; }
.b-br { bottom: 22px; right: 22px; border-left: none; border-top: none; }
.cover-rec {
  position: absolute; top: 14px; right: 14px;
  color: #ea5e3e;
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.12em;
  animation: rec-blink 1.6s steps(2, end) infinite;
}
@keyframes rec-blink { 50% { opacity: 0.3; } }

/* Paper */
.cover-paper { background: linear-gradient(180deg, #1a3a2c 0%, #0f261c 100%); }
.chart {
  position: absolute; bottom: 36px; left: 14px; right: 14px;
  display: flex; align-items: flex-end; gap: 8px;
  height: 110px;
}
.chart .bar {
  flex: 1;
  background: linear-gradient(180deg, #6dab8a 0%, #355a48 100%);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
}
.bar.b1 { height: 28%; }
.bar.b2 { height: 50%; }
.bar.b3 { height: 38%; background: linear-gradient(180deg, #ea8a5b 0%, #c1452f 100%); }
.bar.b4 { height: 62%; }
.bar.b5 { height: 78%; background: linear-gradient(180deg, #ea8a5b 0%, #c1452f 100%); }
.bar.b6 { height: 56%; }
.bar.b7 { height: 86%; }
.bar.b8 { height: 92%; background: linear-gradient(180deg, #ea8a5b 0%, #c1452f 100%); }

/* RITC */
.cover-ritc {
  background:
    radial-gradient(circle at 80% 80%, rgba(108, 151, 200, 0.3), transparent 60%),
    linear-gradient(135deg, #14171d 0%, #1f2632 100%);
}
.line-chart { position: absolute; inset: 18px 18px 36px; color: #6dab8a; }
.line-chart svg { width: 100%; height: 100%; }

/* CompSoc */
.cover-compsoc {
  background:
    radial-gradient(circle at center, rgba(193, 69, 47, 0.3), transparent 50%),
    linear-gradient(135deg, #2c2823 0%, #1a1714 100%);
}
.rings { position: absolute; inset: 0; display: grid; place-items: center; }
.rings span {
  position: absolute;
  border: 1.5px solid rgba(234, 138, 91, 0.6);
  border-radius: 50%;
  animation: ring-grow 4s ease-out infinite;
}
.rings span:nth-child(1) { width: 60px;  height: 60px; }
.rings span:nth-child(2) { width: 120px; height: 120px; animation-delay: 1.3s; }
.rings span:nth-child(3) { width: 200px; height: 200px; animation-delay: 2.6s; }
@keyframes ring-grow {
  0%   { opacity: 0.9; transform: scale(0.6); }
  100% { opacity: 0;   transform: scale(1.3); }
}

/* card body */
.card-body {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px 20px;
}
.card-body header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
}
.card-body h3 {
  font-family: var(--font-serif);
  font-size: 1.55rem; font-weight: 400; line-height: 1.05;
  color: var(--ink);
}
.card-body .card-year {
  font-family: var(--font-mono);
  font-size: 0.72rem; color: var(--muted);
}
.card-body p {
  font-size: 0.93rem; color: var(--ink-soft); line-height: 1.55;
}

.project-award {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--gold) 12%, var(--panel));
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}

.award-logo {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--panel);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.award-logo.patch {
  background: #000000;
  color: #f3e45f;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chips li {
  padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 500;
}

.proj-links {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-soft);
}
.proj-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg);
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 500;
  transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.proj-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.proj-link svg { display: block; }

/* =====================================================
   WRITING LIST
   ===================================================== */

.writing-list { border-top: 1px solid var(--line); }

.writing-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
}
.writing-row .year {
  padding-top: 20px;
  font-family: var(--font-mono);
  font-size: 0.84rem; color: var(--muted);
}
.writing-row .entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 18px; align-items: center;
  padding: 18px 0;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.94rem;
  cursor: pointer;
  transition: color var(--t-fast);
}
.writing-row .entry:hover { color: var(--accent); }
.writing-row .title {
  position: relative;
  padding-left: 0;
  transition: padding-left var(--t-fast);
}
.writing-row .entry:hover .title { padding-left: 12px; }
.writing-row .title::before {
  content: "→";
  position: absolute; left: -4px;
  opacity: 0;
  color: var(--accent);
  transition: opacity var(--t-fast), left var(--t-fast);
}
.writing-row .entry:hover .title::before { opacity: 1; left: -2px; }
.writing-row .date {
  font-family: var(--font-mono);
  font-size: 0.78rem; color: var(--muted);
  text-align: right;
}

.empty-note { padding: 24px 0; }

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }

.post-date {
  margin-bottom: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.post-page {
  max-width: 760px;
}

.post-body {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.reader-body {
  font-size: 1.04rem; line-height: 1.7;
  color: var(--ink-soft);
}
.reader-body h1 {
  margin-top: 36px; margin-bottom: 14px;
  font-family: var(--font-serif); font-weight: 400;
  font-size: 2rem; color: var(--ink);
}
.reader-body h2 {
  margin-top: 32px; margin-bottom: 12px;
  font-family: var(--font-serif); font-weight: 400;
  font-size: 1.55rem; color: var(--ink);
}
.reader-body h3 { margin-top: 24px; margin-bottom: 10px; font-size: 1.15rem; color: var(--ink); }
.reader-body p { margin-bottom: 18px; }
.reader-body strong { color: var(--ink); font-weight: 600; }
.reader-body a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
.reader-body ul, .reader-body ol {
  margin-bottom: 18px;
  padding-left: 22px;
  list-style: disc;
}
.reader-body ol { list-style: decimal; }
.reader-body li { margin-bottom: 8px; }
.reader-body code {
  background: var(--bg-soft);
  font-size: 0.92em;
}
.reader-body pre {
  margin-bottom: 18px; padding: 16px 18px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  overflow-x: auto;
}
.reader-body pre code { background: transparent; padding: 0; font-size: 0.86em; }
.reader-body blockquote {
  margin: 0 0 18px;
  padding: 6px 16px;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.18rem; font-style: italic;
}

/* =====================================================
   PHOTOGRAPHY GRID + LIGHTBOX
   ===================================================== */

.photo-grid {
  display: block;
  columns: 2 280px;
  column-gap: 18px;
}
.photo {
  display: flex; flex-direction: column;
  margin: 0 0 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  break-inside: avoid;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.photo:hover { transform: translateY(-2px); border-color: var(--ink-soft); box-shadow: var(--shadow); }

.photo-btn {
  display: block;
  padding: 0; margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.photo-btn img {
  display: block; width: 100%;
  height: auto;
  object-fit: contain;
}
.lightbox {
  position: fixed; inset: 0;
  z-index: 60;
  display: grid; place-items: center;
  padding: 40px;
  background: rgba(8, 8, 8, 0.86);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }

.lightbox-figure {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  margin: 0;
}
.lightbox-figure img {
  max-width: 100%; max-height: 78vh;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lightbox-figure figcaption {
  color: rgba(236, 230, 215, 0.85);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 24px; left: 24px;
  z-index: 61;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1px solid rgba(236, 230, 215, 0.4); border-radius: 50%;
  background: rgba(20, 20, 20, 0.6);
  color: #ece6d7;
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.lightbox-close:hover { border-color: var(--accent); transform: rotate(90deg); color: var(--accent); }

/* =====================================================
   CONTACT PAGE
   ===================================================== */

.contact-page .page-lead { margin-bottom: 40px; max-width: 580px; }

.contact-icons {
  display: flex; flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.contact-icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-width: 132px;
  padding: 14px 22px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.9rem; font-weight: 500;
  text-align: center;
  transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.contact-icon svg { display: block; }
.contact-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  background: var(--bg);
}
.ci-glyph {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  color: currentColor;
  flex: 0 0 22px;
}
.ci-label { line-height: 1; }

/* =====================================================
   MOBILE TRIGGER
   ===================================================== */

.sidebar-trigger {
  display: none;
  position: fixed; top: 16px; right: 16px;
  z-index: 40;
  width: 42px; height: 42px;
  padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.sidebar-trigger .bar {
  display: block; width: 16px; height: 1.6px;
  margin: 3px auto;
  background: currentColor;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
body.menu-open .sidebar-trigger .bar:nth-child(2) { transform: translateY(4.6px) rotate(45deg); }
body.menu-open .sidebar-trigger .bar:nth-child(3) { opacity: 0; }
body.menu-open .sidebar-trigger .bar:nth-child(4) { transform: translateY(-4.6px) rotate(-45deg); }

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-layout { grid-template-columns: 1fr; }
  body[data-page="home"] {
    overflow: auto;
  }
  body[data-page="home"] .hero {
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  body[data-page="home"] .hero-media {
    max-width: 430px;
  }
  body[data-page="home"] .hero-photo {
    min-height: 390px;
  }
  body[data-page="home"] .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  :root { --content-pad: 22px; }

  .sidebar-trigger { display: inline-grid; place-items: center; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: translateX(0); }
  .content { margin-left: 0; padding-top: 0; }
  .page-section { padding-top: 72px; }
  .hero {
    min-height: auto;
    padding: 44px 0 58px;
  }

  .project-grid { grid-template-columns: 1fr; }

  .hero-stage { min-height: 340px; }
  .hero-name { font-size: clamp(4.2rem, 23vw, 7.4rem); }
  .hero-photo { width: clamp(96px, 29vw, 136px); }
  body[data-page="home"] .hero-name {
    margin-top: 0;
    font-size: clamp(4.2rem, 18vw, 7rem);
  }
  body[data-page="home"] .hero-grid {
    grid-template-columns: 1fr;
  }
  body[data-page="home"] .hero-photo {
    width: min(100%, 360px);
  }

  .writing-row { grid-template-columns: 56px 1fr; gap: 14px; }
  .writing-row .entry { grid-template-columns: minmax(0, 1fr) 70px; }

}

@media (max-width: 540px) {
  .hero { padding-top: 28px; }
  .hero-stage { min-height: 300px; }
  .hero-layout { gap: 26px; }
  .hero-tagline { font-size: 0.7rem; padding: 6px 12px; }
  .hero-interest-note { font-size: 0.9rem; }
  body[data-page="home"] .hero-photo { min-height: 340px; }
  .cover { height: 170px; }
  .card-body header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .wins-card header { flex-direction: row; align-items: center; }
  .writing-row .entry { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
  .writing-row .date { text-align: left; }
  .contact-icon { padding: 12px 16px; font-size: 0.84rem; }
}

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