/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --bg: #f8fafc;
  --paper: rgba(255,255,255,.88);
  --paper-strong: rgba(255,255,255,.96);
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15,23,42,.09);
  --blue: #2563eb;
  --blue-deep: #1e3a8a;
  --cyan: #06b6d4;
  --green: #22c55e;
  --coral: #e8614a;
  --shadow: 0 24px 80px rgba(15,23,42,.10);
  --radius: 28px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── Base ───────────────────────────────────────────────────────── */
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 18%, rgba(37,99,235,.11), transparent 36rem),
    linear-gradient(150deg, #fdf9f7 0%, #f0f4ff 60%, #f5f8ff 100%);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────────────── */
.page {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

/* ── Navigation ─────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 40px;
  animation: rise 700ms ease both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -.04em;
}

.brand-name {
  display: inline-flex;
  gap: .08em;
  letter-spacing: -.045em;
  text-transform: lowercase;
  text-shadow: 0 2px 14px rgba(15,23,42,.16);
}

.brand-word { font-weight: 500; }
.brand-word strong { font-weight: 900; }
.brand-word.dark { color: var(--blue-deep); }
.brand-word.light { color: var(--blue); margin-left: -.08em; }
.brand-word.light strong { display: inline-block; transform: translateX(-.015em); }

.mark {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 14px;
  background: var(--paper-strong);
  box-shadow: 0 14px 42px rgba(15,23,42,.08);
  overflow: hidden;
}

.mark-letter {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.17em;
  transform: translateX(-1px);
}

.mark-letter.dark { color: var(--blue-deep); }
.mark-letter.light { color: var(--blue); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  backdrop-filter: blur(18px);
  box-shadow: 0 14px 50px rgba(15,23,42,.08);
}

.nav-links a {
  padding: 10px 14px;
  border-radius: 999px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-links a:hover {
  background: #fff;
  color: var(--ink);
  transform: translateY(-1px);
}

.nav-links a + a { position: relative; }

.nav-links a + a::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 1px;
  height: 18px;
  transform: translateY(-50%);
  background: rgba(15,23,42,.10);
  pointer-events: none;
  transition: opacity 180ms ease;
}

.nav-links a:hover::before { opacity: 0; }

/* ── Shared card styles ─────────────────────────────────────────── */
.hero-card,
.side-card,
.project-card,
.note-card {
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, .84fr);
  gap: 32px;
  align-items: stretch;
  margin-bottom: 100px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 580px;
  margin-top: 10px;
  padding: clamp(30px, 6vw, 64px);
  border-radius: calc(var(--radius) + 8px);
  animation: rise 800ms 80ms ease both;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 28px;
  border: 1px solid rgba(15,23,42,.08);
  pointer-events: none;
}

.eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 9px 14px;
  border: 1px solid rgba(37,99,235,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 0 0 6px rgba(232,97,74,.14);
  flex: 0 0 auto;
}

h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 780px;
  font-size: clamp(48px, 8vw, 88px);
  line-height: .92;
  letter-spacing: -.08em;
}

.gradient-text {
  display: inline-block;
  background: linear-gradient(120deg, #0f172a, #2563eb);
  background-size: 180% 180%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}

.intro {
  position: relative;
  z-index: 1;
  max-width: 650px;
  margin: 28px 0 0;
  color: #334155;
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.6;
  letter-spacing: -.02em;
}

.intro + .intro { margin-top: 14px; }

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 56px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button.primary {
  color: #fff;
  background: #0f172a;
  box-shadow: 0 18px 44px rgba(15,23,42,.22);
}

.button.secondary {
  color: #0f172a;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 52px rgba(15,23,42,.18);
}

/* ── Side stack ─────────────────────────────────────────────────── */
.side-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 850ms 160ms ease both;
}

.side-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: var(--radius);
  margin-top: 10px;
}

.side-card h2,
.section-title h2,
.project-card h3,
.note-card h3 {
  margin: 0;
  letter-spacing: -.045em;
}

.side-card h2 { font-size: 22px; }

.side-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 15px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.66);
}

.stat strong {
  display: block;
  font-size: 22px;
  letter-spacing: -.05em;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat .stat-sub {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: .01em;
  opacity: .75;
}

.signal-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.signal-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.signal-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(232,97,74,.10);
  flex: 0 0 auto;
}

/* ── Sections ───────────────────────────────────────────────────── */
section { margin-top: 56px; }

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
}

.section-title h2 { font-size: clamp(30px, 4vw, 46px); }

.section-title p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Projects ───────────────────────────────────────────────────── */
.projects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  isolation: isolate;
}

.project-card {
  position: relative;
  overflow: hidden;
  min-height: 230px;
  backdrop-filter: none;
  padding: 24px;
  border-radius: var(--radius);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  opacity: .18;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  transform: rotate(12deg);
  transition: transform 300ms ease, opacity 220ms ease;
}

.project-card:nth-child(2)::before { background: linear-gradient(135deg, var(--green), var(--cyan)); }
.project-card:nth-child(3)::before { background: linear-gradient(135deg, var(--green), var(--blue)); }

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(37,99,235,.24);
  box-shadow: 0 28px 88px rgba(15,23,42,.14);
  z-index: 1;
}

.project-card:hover::before {
  transform: rotate(22deg) scale(1.08);
  opacity: .28;
}

.project-card::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  width: 54px;
  height: 54px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 28px 28px;
  opacity: .2;
  pointer-events: none;
  filter: invert(1);
}

.project-card:nth-child(1)::after { background-image: url('/images/icon-ball.svg'); }
.project-card:nth-child(2)::after { background-size: 36px 36px; background-image: url('/images/icon-house.svg'); }
.project-card:nth-child(3)::after { background-image: url('/images/icon-terminal.svg'); }

.project-card h3 {
  max-width: 220px;
  font-size: 23px;
}

.project-card p {
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.62;
  font-size: 15px;
}

.project-card span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
}

.project-card span::after {
  content: "→";
  transition: transform 180ms ease;
}

.project-card:hover span::after { transform: translateX(3px); }

.project-card h3 span {
  display: inline;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  gap: 0;
}

.project-card h3 span::after { content: none; }

/* ── Photo card ─────────────────────────────────────────────────── */
.photo-card {
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 180px;
  max-height: 340px;
}

.photo-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.photo-card .photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 60px 0;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .01em;
  text-align: right;
  margin: 0;
}

/* ── Notes ──────────────────────────────────────────────────────── */
.notes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  isolation: isolate;
}

.note-card {
  padding: 28px;
  border-radius: var(--radius);
  backdrop-filter: none;
}

.note-card h3 { font-size: 25px; }

.note-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.note-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.note-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.note-read {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--coral);
  font-size: 14px;
  font-weight: 700;
  transition: gap 180ms ease;
}

a.note-card {
  display: block;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

a.note-card:hover {
  transform: translateY(-4px);
  border-color: rgba(232,97,74,.2);
  box-shadow: 0 28px 88px rgba(15,23,42,.12);
}

a.note-card:hover .note-read { gap: 10px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.tag {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.66);
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

a.tag:hover {
  transform: translateY(-2px);
  background: var(--paper-strong);
  border-color: rgba(15,23,42,.18);
  box-shadow: 0 8px 20px rgba(15,23,42,.08);
}

/* ── Contact ────────────────────────────────────────────────────── */
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15,23,42,.92);
  color: #fff;
  box-shadow: var(--shadow);
}

.contact strong {
  display: block;
  font-size: 18px;
  letter-spacing: -.035em;
}

.contact span {
  display: block;
  margin-top: 5px;
  color: rgba(255,255,255,.68);
  font-size: 14px;
}

.contact-email-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-email {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  border-bottom: 1px solid rgba(255,255,255,.28);
  transition: border-color 180ms ease, color 180ms ease;
}

.contact-email:hover {
  color: #fff;
  border-color: rgba(255,255,255,.7);
}

.copy-email {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.copy-email:hover {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.28);
  transform: translateY(-1px);
}

.copy-email svg { width: 17px; height: 17px; }

.copy-email.copied {
  background: rgba(232,97,74,.18);
  border-color: rgba(232,97,74,.35);
}

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: #64748b;
  font-size: 13px;
}

.footer-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle {
  background: none;
  border: none;
  padding: 2px;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  opacity: .7;
  transition: opacity 180ms ease;
}

.theme-toggle:hover { opacity: 1; }
.theme-toggle svg { display: block; }
.theme-toggle .icon-sun { display: none; }

/* ── Reveal animations ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.reveal.is-visible { animation: rise 800ms ease both; }

.reveal-item {
  opacity: 0;
  transform: translateY(24px) scale(.985);
  transition: opacity 720ms ease, transform 720ms cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible .reveal-item {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.delay-1 { animation-delay: 120ms; }
.delay-2 { animation-delay: 220ms; }
.delay-3 { animation-delay: 320ms; }

/* ── Keyframes ──────────────────────────────────────────────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
  .reveal, .reveal-item { opacity: 1; transform: none; }
}

/* ── Dark mode ──────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --paper: rgba(255,255,255,.07);
  --paper-strong: rgba(255,255,255,.12);
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: rgba(255,255,255,.10);
  --blue: #60a5fa;
  --blue-deep: #93c5fd;
  --shadow: 0 24px 80px rgba(0,0,0,.5);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% 18%, rgba(59,130,246,.14), transparent 36rem),
    linear-gradient(150deg, #0c0f1a 0%, #0f172a 60%, #0c1520 100%);
}

[data-theme="dark"] .gradient-text {
  background: linear-gradient(120deg, #e2e8f0, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="dark"] .hero-card::before     { border-color: rgba(255,255,255,.06); }
[data-theme="dark"] .nav-links             { background: rgba(15,23,42,.7); }
[data-theme="dark"] .nav-links a           { color: #94a3b8; }
[data-theme="dark"] .nav-links a:hover     { background: rgba(255,255,255,.08); color: #f1f5f9; }
[data-theme="dark"] .nav-links a + a::before { background: rgba(255,255,255,.10); }
[data-theme="dark"] .eyebrow               { background: rgba(255,255,255,.07); border-color: rgba(96,165,250,.2); color: #93c5fd; }
[data-theme="dark"] .button.primary        { background: var(--blue); box-shadow: 0 18px 44px rgba(96,165,250,.2); }
[data-theme="dark"] .button.secondary      { background: rgba(255,255,255,.09); color: #f1f5f9; border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .intro                 { color: #94a3b8; }
[data-theme="dark"] .stat                  { background: rgba(255,255,255,.05); }
[data-theme="dark"] .signal-list li        { color: #94a3b8; }
[data-theme="dark"] .tag                   { background: rgba(255,255,255,.06); color: #94a3b8; border-color: rgba(255,255,255,.10); }
[data-theme="dark"] .project-card span     { color: #93c5fd; }
[data-theme="dark"] .project-card::after  { filter: none; }
[data-theme="dark"] .contact               { background: rgba(30,41,59,.85); border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Responsive: medium ─────────────────────────────────────────── */
@media (max-width: 880px) {
  .nav            { margin-bottom: 32px; }
  .hero           { grid-template-columns: 1fr; }
  .hero-card      { min-height: 520px; }
  .projects       { grid-template-columns: 1fr; }
  .notes-list     { grid-template-columns: 1fr; }
  .section-title  { display: block; }
  .section-title p { margin-top: 10px; }
}

/* ── Responsive: small ──────────────────────────────────────────── */
@media (max-width: 620px) {
  .page                   { width: min(100% - 28px, 1120px); padding-top: 16px; }
  .nav                    { margin-bottom: 20px; }
  .nav-links              { display: none; }
  .hero-card,
  .side-card,
  .note-card,
  .project-card           { border-radius: 24px; }
  .hero-card              { min-height: 560px; padding: 30px 24px; }
  .hero-card::before      { inset: 12px; border-radius: 20px; }
  .eyebrow                { align-items: flex-start; border-radius: 22px; font-size: 11px; line-height: 1.45; white-space: normal; }
  .stats                  { grid-template-columns: 1fr; }
  .contact,
  .footer                 { display: block; }
  .contact-email-row      { margin-top: 16px; }
  .footer span:last-child { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
}
