/* ================= Design tokens ================= */
:root {
  --bg: #000;
  --surface: #0a0a0a;
  --card: #0f0f0f;
  --text: #fff;
  --muted: #a3a3a3;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --glow: rgba(255, 255, 255, 0.06);
  --radius-lg: 2rem;
  --radius-md: 0.8rem;
  --max: 1280px;
  --ease-spring: cubic-bezier(0.68, -0.55, 0.27, 1.55);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  font-family: 'Montserrat', Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  body { font-size: 0.9rem; }
}

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

img { display: block; max-width: 100%; }

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

::selection { background: #fff; color: #000; }

/* ================= Cursor glow ================= */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 600px; height: 600px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  transform: translate(-50%, -50%);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

body:hover .cursor-glow { opacity: 1; }

@media (hover: none) {
  .cursor-glow { display: none; }
}

/* ================= Hero ================= */
.hero {
  position: relative;
  min-height: 88vh;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
  margin-bottom: -2px;
  overflow: hidden;
}

/* thin glowing line on top (equivalent to the blue border on the reference) */
.hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #fff 30%, #fff 70%, transparent);
  box-shadow: 0 0 24px 2px rgba(255, 255, 255, 0.35);
}

/* subtle grid texture */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--max) + 2rem);
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
  max-width: 69ch;
}

/* animated handwritten greeting */
.greeting {
  width: min(420px, 80vw);
  height: auto;
  overflow: visible;
}

.greeting text {
  font-family: 'Caveat', cursive;
  font-size: 190px;
  font-weight: 700;
  fill: transparent;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.25));
}

.greeting.draw text {
  animation:
    draw 2.2s var(--ease-out) forwards,
    fillIn 0.8s ease 1.6s forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fillIn { to { fill: #fff; } }

.bio {
  font-size: 1.15rem;
  color: #e5e5e5;
}

.word {
  display: inline-block;
  opacity: 0;
  transform: translateX(0.5rem);
  filter: blur(4px);
  transition:
    transform 0.6s var(--ease-spring),
    opacity 0.6s ease-in-out,
    filter 0.6s ease;
}

.word.visible {
  opacity: 1;
  transform: translateX(0);
  filter: blur(0);
}

.hero-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}

.hero-links.visible { opacity: 1; transform: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}

.btn svg { width: 1.1em; height: 1.1em; }

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 255, 255, 0.12);
}

.btn-primary { background: #fff; color: #000; border-color: #fff; }
.btn-primary:hover { background: #e5e5e5; }
.btn-ghost:hover { background: #fff; color: #000; }

@media (max-width: 1200px) {
  .hero-inner {
    padding: 0;
  }
  .hero-text { padding: 1rem; }
}

/* ================= Curves ================= */
.svg-curve {
  display: block;
  width: 100%;
  height: clamp(30px, 5.5vw, 79px);
  background: var(--surface);
}

.svg-curve path { fill: var(--bg); }

/* ================= Projects ================= */
main { background: var(--surface); position: relative; }

.projects {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem 6rem;
}

.projects-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3.5rem;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
}

h2 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff 30%, #8a8a8a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.projects-text p { color: var(--muted); }

.project-grid {
  display: grid;
  width: 100%;
  max-width: calc(var(--max) + 2rem);
  padding: 0 1rem;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 1320px) { .project-grid { gap: 1rem; } }
@media (max-width: 1100px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .project-grid { grid-template-columns: 1fr; } }

.project {
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 0 1rem 1rem var(--glow);
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), border-color 0.3s ease, box-shadow 0.4s ease;
}

/* spotlight following the mouse */
.project::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(400px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.08), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.project:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 0 2rem 1rem rgba(255, 255, 255, 0.07);
}

.project:hover::before { opacity: 1; }

.project-img {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: zoom-in;
  background: #111;
}

.project-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.6s var(--ease-out), filter 0.6s ease;
  filter: grayscale(0.4) brightness(0.85);
}

.project:hover .project-img img {
  transform: scale(1.08);
  filter: grayscale(0) brightness(1);
}

.project-text {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0.5rem;
  margin-top: -2.5rem;
  z-index: 1;
}

/* soft fade from image into text, like the reference */
.project-text::before {
  content: '';
  position: absolute;
  inset: -2.5rem -1.5rem auto;
  height: 6rem;
  background: linear-gradient(transparent, var(--card) 55%);
  z-index: -1;
  pointer-events: none;
}

h3 {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
}

.project-parragraph {
  color: var(--muted);
  font-size: 0.95rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.tags li {
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: #d4d4d4;
  background: rgba(255, 255, 255, 0.03);
}

.project-buttons {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0.5rem 0.25rem;
  position: relative;
  z-index: 3;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-spring);
}

.icon-btn svg { width: 1.2rem; height: 1.2rem; }

.icon-btn:hover {
  background: #fff;
  color: #000;
  transform: scale(1.1) rotate(-6deg);
}

/* scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}

.reveal.in { opacity: 1; transform: none; }

/* ================= Footer ================= */
footer {
  background: var(--bg);
  margin-top: -2px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: var(--max);
  margin: auto;
  padding: 5rem 1rem;
}

.footer-copy { color: var(--muted); font-size: 0.95rem; }

.footer-links {
  display: flex;
  gap: 1.25rem;
  font-size: 1.5rem;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.2s ease, transform 0.25s var(--ease-spring);
  display: inline-flex;
}

.footer-links a:hover { color: #fff; transform: translateY(-3px); }

.footer-links svg { width: 1em; height: 1em; }

@media (max-width: 560px) {
  .footer-inner { flex-direction: column-reverse; padding: 3rem 1rem; }
}

/* ================= Modal ================= */
.modal {
  margin: auto;
  border: none;
  background: transparent;
  max-width: 92vw;
  max-height: 92vh;
  overflow: visible;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal[open] { animation: modalIn 0.35s var(--ease-out); }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: none; }
}

.modal-image {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  cursor: zoom-out;
}

.modal-close {
  position: absolute;
  top: -1rem;
  right: -1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: #000;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover { background: #fff; color: #000; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .greeting text { stroke-dashoffset: 0; fill: #fff; }
}
