/* ==========================================================================
   yusufaliee.com — a warm-editorial + technical-mono personal site
   ========================================================================== */

/* -------- Tokens (palette drawn from the circuit-board logo) -------- */
:root {
  --bg: #f4f8f7;
  --bg-soft: #e9f0ee;
  --surface: #ffffff;
  --ink: #0a1929;
  --ink-soft: #2c4356;
  --ink-mute: #6b8290;
  --rule: #d5e0dd;
  --rule-soft: #e2eae8;
  --accent: #0d9488;          /* teal-600 — deeper mint for legibility on light */
  --accent-2: #0891b2;         /* cyan */
  --accent-soft: #ccfbf1;
  --accent-ink: #115e59;
  --pcb: rgba(13, 148, 136, 0.22);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --shell: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 14px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

[data-theme="dark"] {
  --bg: #0a1929;               /* deep navy from logo bg */
  --bg-soft: #0f2438;
  --surface: #142b42;
  --ink: #e8f4f1;              /* mint-tinged off-white */
  --ink-soft: #a4b8c4;
  --ink-mute: #5f7788;
  --rule: #1d3a55;
  --rule-soft: #16304a;
  --accent: #6ee7c7;           /* mint from the logo lettering */
  --accent-2: #22d3ee;         /* cyan glow */
  --accent-soft: rgba(110, 231, 199, 0.14);
  --accent-ink: #a7f3d0;
  --pcb: rgba(110, 231, 199, 0.16);
}

/* -------- Reset & base -------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

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

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

/* -------- Grain overlay -------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.06 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.35; }

/* -------- Progress bar -------- */
.progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0;
  background: var(--accent);
  z-index: 100;
  transition: width 0.05s linear;
}

/* -------- Custom cursor -------- */
.cursor { position: fixed; top: 0; left: 0; z-index: 101; pointer-events: none; mix-blend-mode: difference; }
.cursor-dot, .cursor-ring {
  position: absolute; top: 0; left: 0;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
  width: 32px; height: 32px;
  border: 1px solid #fff;
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), border-color 0.2s ease, background 0.2s ease;
}
.cursor.is-hover .cursor-ring { width: 56px; height: 56px; border-color: #fff; background: rgba(255,255,255,0.08); }
.cursor.is-hidden { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } * { cursor: auto !important; } }

/* -------- Topbar -------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--rule); }

.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #0a1929;         /* logo has dark bg baked in but this guards edges */
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 40%, transparent),
              0 0 20px color-mix(in oklab, var(--accent) 30%, transparent);
  transition: box-shadow 0.4s var(--ease-out), transform 0.6s var(--ease-out);
}
.brand:hover .brand-logo {
  box-shadow: 0 0 0 1px var(--accent),
              0 0 28px color-mix(in oklab, var(--accent) 55%, transparent);
  transform: rotate(6deg);
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.85); opacity: 0.7; } }

.nav { display: flex; gap: 28px; }
.nav a {
  font-size: 14px;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}
.nav a::after {
  content: ""; position: absolute; bottom: 0; left: 0;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.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: block; }

@media (max-width: 720px) {
  .nav { display: none; }
}

/* -------- Layout helpers -------- */
main { position: relative; z-index: 2; }
.section {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 120px var(--gutter);
  scroll-margin-top: 80px;
}
.section-head {
  display: flex; align-items: baseline; gap: 20px;
  margin-bottom: 56px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.section-num { font-size: 13px; color: var(--ink-mute); letter-spacing: 0.05em; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 3.5vw, 38px); letter-spacing: -0.02em; }

.mono { font-family: var(--font-mono); font-feature-settings: "ss01" on; }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  padding: 140px var(--gutter) 80px;
  max-width: var(--shell);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.pcb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--pcb);
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 70% 60% at 60% 40%, transparent 0%, #000 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 60% 40%, transparent 0%, #000 80%);
}
.pcb .trace {
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: drawTrace 3.2s var(--ease-out) forwards;
}
.pcb .trace:nth-child(1) { animation-delay: 0.2s; }
.pcb .trace:nth-child(2) { animation-delay: 0.4s; }
.pcb .trace:nth-child(3) { animation-delay: 0.6s; }
.pcb .trace:nth-child(4) { animation-delay: 0.8s; }
.pcb .trace:nth-child(5) { animation-delay: 1.0s; }
.pcb .trace:nth-child(6) { animation-delay: 1.2s; }
.pcb .trace:nth-child(7) { animation-delay: 1.4s; }
.pcb .trace:nth-child(8) { animation-delay: 1.6s; }
.pcb .trace:nth-child(9) { animation-delay: 1.8s; }
.pcb .pads circle {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  animation-delay: 2.4s;
}
@keyframes drawTrace {
  to { stroke-dashoffset: 0; }
}
@keyframes fadeIn { to { opacity: 1; } }

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in oklab, var(--surface) 60%, transparent);
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 40px;
  backdrop-filter: blur(8px);
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-2) 30%, transparent);
  animation: pulse 2s ease-in-out infinite;
}
.eyebrow .mono-sep { color: var(--ink-mute); }
.eyebrow .mono { font-size: 12px; color: var(--ink-mute); }

.display {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(44px, 8vw, 96px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 40px;
  font-variation-settings: "opsz" 144;
}
.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

/* Split-word reveal for hero display */
.display .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: baseline;
  padding-bottom: 0.05em;
  margin-bottom: -0.05em;
}
.display .word-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1s var(--ease-out);
}
.display .word-inner.reveal-in { transform: translateY(0); }

.lede {
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--ink-soft);
  max-width: 620px;
  margin-bottom: 44px;
  line-height: 1.55;
}
.link-underline {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  transition: color 0.2s ease, background 0.2s ease;
  padding-bottom: 1px;
}
.link-underline:hover { color: var(--accent); }

/* CTAs */
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: transform 0.5s var(--ease-out), background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  will-change: transform;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost {
  border: 1px solid var(--rule);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn svg { transition: transform 0.4s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }

/* Hero meta strip */
.hero-meta {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.meta-item {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 14px;
}
.meta-item .mono {
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: 0.05em;
}
@media (max-width: 640px) {
  .hero-meta { grid-template-columns: repeat(2, 1fr); }
  .hero { padding-top: 120px; }
}

/* ==========================================================================
   STATS
   ========================================================================== */
.stats {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 40px var(--gutter) 80px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  border-bottom: 1px solid var(--rule);
}
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat-num {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variation-settings: "opsz" 144;
}
.stat-label { font-size: 13px; color: var(--ink-mute); letter-spacing: 0.02em; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 40px; }
}

/* ==========================================================================
   ABOUT
   ========================================================================== */
.prose { max-width: 720px; font-size: 18px; color: var(--ink-soft); }
.prose p + p { margin-top: 20px; }
.prose .hl { color: var(--ink); font-weight: 500; }

/* ==========================================================================
   SERVICES
   ========================================================================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.service-card {
  position: relative;
  padding: 32px 28px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--surface) 40%, transparent);
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.5s var(--ease-out), background 0.3s ease;
}
.service-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}
.service-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.service-card:hover::before { opacity: 1; }
.service-num {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}
.service-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  line-height: 1.15;
}
.service-card p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}
@media (max-width: 820px) {
  .services-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   WORK
   ========================================================================== */
.work-list { list-style: none; }
.work-item {
  padding: 32px 0;
  border-top: 1px solid var(--rule);
  transition: padding 0.3s var(--ease-out);
}
.work-item:last-child { border-bottom: 1px solid var(--rule); }
.work-item:hover { padding-left: 12px; }
.work-head {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 12px;
}
.work-year {
  font-size: 13px;
  color: var(--ink-mute);
  flex-shrink: 0;
  min-width: 70px;
}
.work-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.work-desc {
  color: var(--ink-soft);
  max-width: 720px;
  margin-left: 94px;
  font-size: 16px;
}
.tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
  margin-left: 94px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  letter-spacing: 0.02em;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.work-item:hover .tag { color: var(--ink-soft); border-color: var(--ink-mute); }

@media (max-width: 640px) {
  .work-head { flex-direction: column; gap: 4px; }
  .work-desc, .tags { margin-left: 0; }
}

/* ==========================================================================
   MARQUEE
   ========================================================================== */
.marquee-wrap {
  overflow: hidden;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--bg-soft);
}
.marquee { overflow: hidden; }
.marquee-track {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  width: max-content;
  animation: scroll 40s linear infinite;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variation-settings: "opsz" 144;
}
.marquee-track span:nth-child(even) { color: var(--accent); font-style: italic; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ==========================================================================
   EXPERIENCE (timeline)
   ========================================================================== */
.timeline { list-style: none; }
.timeline-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}
.timeline-item:last-child { border-bottom: 1px solid var(--rule); }

.timeline-when {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-mute);
}
.timeline-when .dash { color: var(--rule); }

.timeline-body h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(20px, 2vw, 24px);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.timeline-body .where {
  color: var(--ink-mute);
  font-size: 14px;
  margin-bottom: 14px;
}
.timeline-body ul { list-style: none; }
.timeline-body ul li {
  color: var(--ink-soft);
  font-size: 15px;
  padding: 4px 0 4px 20px;
  position: relative;
}
.timeline-body ul li::before {
  content: "";
  position: absolute;
  left: 0; top: 14px;
  width: 8px; height: 1px;
  background: var(--ink-mute);
}

@media (max-width: 720px) {
  .timeline-item { grid-template-columns: 1fr; gap: 12px; }
  .timeline-when { flex-direction: row; gap: 8px; }
}

/* ==========================================================================
   CONTACT
   ========================================================================== */
.contact-inner { display: flex; flex-direction: column; gap: 48px; }
.contact-lede {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
}
.contact-lede em { color: var(--accent); font-style: italic; font-weight: 400; }
.contact-lede .word { display: inline-block; overflow: hidden; padding-bottom: 0.05em; margin-bottom: -0.05em; vertical-align: baseline; }
.contact-lede .word-inner { display: inline-block; transform: translateY(110%); transition: transform 1s var(--ease-out); }
.contact-lede .word-inner.reveal-in { transform: translateY(0); }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.contact-card {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.5s var(--ease-out);
  background: color-mix(in oklab, var(--surface) 40%, transparent);
  will-change: transform;
}
.contact-card:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent-soft) 30%, transparent); }
.contact-label { font-size: 12px; color: var(--ink-mute); letter-spacing: 0.05em; text-transform: uppercase; }
.contact-value { font-size: 17px; font-weight: 500; }
.contact-card svg { color: var(--ink-mute); transition: color 0.2s ease, transform 0.4s var(--ease-out); }
.contact-card:hover svg { color: var(--accent); transform: translate(3px, -3px); }

@media (max-width: 640px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-card { grid-template-columns: 80px 1fr auto; padding: 20px; }
  .contact-value { font-size: 15px; }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  border-top: 1px solid var(--rule);
  padding: 32px var(--gutter);
  max-width: var(--shell);
  margin: 0 auto;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--ink-mute);
  font-size: 12px;
}
.footer-tag { display: inline-flex; align-items: center; gap: 10px; }
.footer-tag em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  color: var(--accent);
  font-variation-settings: "opsz" 144;
}

/* ==========================================================================
   Reveal-on-scroll
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .display .word-inner, .contact-lede .word-inner { transform: none; }
  .pcb .trace { stroke-dashoffset: 0; }
  .pcb .pads circle { opacity: 1; }
  .marquee-track { animation: none; }
}
