:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --accent: #4fd1ff;
  --text: #f4f4f6;
  --muted: rgba(244, 244, 246, .64);
  --line: rgba(255, 255, 255, .07);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 320px; background: var(--bg); }

body {
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.network,
.grain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.network { z-index: 0; }
.grain {
  z-index: 1;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.page-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100dvh;
  min-height: 600px;
  padding: clamp(24px, 3.2vh, 38px) 4vw clamp(20px, 2.7vh, 30px);
  overflow: hidden;
}

.topbar,
.footer { display: flex; align-items: flex-start; justify-content: space-between; }

.name,
.tagline,
.status,
.footer p { margin: 0; }

.name { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.tagline,
.contact-link { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.3; }
.availability { text-align: right; }
.status { display: flex; align-items: center; gap: 9px; font-size: 13px; line-height: 1.2; }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(79, 209, 255, .35);
  animation: pulse 2.6s ease-out infinite;
}
.contact-link { display: inline-block; text-decoration: none; transition: color 180ms ease; }

.projects {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.2vw, 20px);
  width: 100%;
  height: clamp(390px, 55vh, 580px);
  padding: 2px;
}

.project-card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: clamp(15px, 1.35vw, 22px);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  background:
    radial-gradient(330px circle at var(--mx) var(--my), rgba(79, 209, 255, .12), transparent 48%),
    rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 14px;
  transform-style: preserve-3d;
  transition: border-color 220ms ease, box-shadow 250ms ease, background-color 220ms ease, transform 250ms cubic-bezier(.2,.75,.25,1), opacity 220ms ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.035), transparent 38%);
}

a.project-card:hover,
a.project-card:focus-visible {
  border-color: rgba(79, 209, 255, .78);
  box-shadow: 0 0 0 1px #4fd1ff33, 0 20px 60px -20px #4fd1ff40;
  transform: translateY(-4px);
}

.card-nr {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font: 500 10px/1.2 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  letter-spacing: .08em;
}

.card-arrow,
.soon-label {
  position: absolute;
  z-index: 2;
  top: clamp(14px, 1.3vw, 21px);
  right: clamp(14px, 1.3vw, 21px);
}

.card-arrow {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transform: translate(-7px, 7px);
  transition: opacity 200ms ease, transform 240ms cubic-bezier(.2,.75,.25,1);
}

a.project-card:hover .card-arrow,
a.project-card:focus-visible .card-arrow { opacity: 1; transform: translate(0, 0); }

.card-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-self: flex-end;
  flex-direction: column;
  min-width: 0;
  margin: auto 0 0 calc(-1ch - 2px);
  transform: translateZ(20px);
}

.card-title {
  overflow: hidden;
  font-size: clamp(15px, 1.05vw, 17px);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-sector { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
.tags > span {
  padding: 4px 7px;
  color: rgba(244, 244, 246, .72);
  font-size: 9px;
  line-height: 1;
  letter-spacing: .015em;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
}

.is-soon { cursor: default; opacity: .45; }
.soon-label { color: var(--muted); font: 500 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }

.footer { align-items: center; color: var(--muted); font-size: 10px; line-height: 1.3; }
.socials { display: flex; align-items: center; gap: 8px; }
.text-link { text-decoration: none; text-underline-offset: 4px; transition: color 180ms ease; }
.text-link:hover { color: var(--text); }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}
.project-card:focus-visible { outline-offset: 3px; border-radius: 14px; }

.motion-on .project-card,
.motion-on .reveal-late { animation: reveal 620ms cubic-bezier(.2,.75,.25,1) backwards; }
.motion-on .project-card:nth-child(1) { animation-delay: 0ms; }
.motion-on .project-card:nth-child(2) { animation-delay: 45ms; }
.motion-on .project-card:nth-child(3) { animation-delay: 90ms; }
.motion-on .project-card:nth-child(4) { animation-delay: 135ms; }
.motion-on .project-card:nth-child(5) { animation-delay: 180ms; }
.motion-on .project-card:nth-child(6) { animation-delay: 225ms; }
.motion-on .project-card:nth-child(7) { animation-delay: 270ms; }
.motion-on .project-card:nth-child(8) { animation-delay: 315ms; }
.motion-on .project-card:nth-child(9) { animation-delay: 360ms; }
.motion-on .project-card:nth-child(10) { animation-delay: 405ms; }
.motion-on .topbar { animation-delay: 520ms; }
.motion-on .footer { animation-delay: 590ms; }

.cursor-dot,
.cursor-ring {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
}
.cursor-dot { width: 6px; height: 6px; background: var(--accent); }
.cursor-ring { width: 28px; height: 28px; border: 1px solid rgba(79, 209, 255, .65); transition: width 180ms ease, height 180ms ease, opacity 160ms ease; }
.cursor-ready { cursor: none; }
.cursor-ready .cursor-dot,
.cursor-ready .cursor-ring { opacity: 1; }
.cursor-ready .cursor-ring.is-large { width: 44px; height: 44px; }
.cursor-ready .text-link,
.cursor-ready .is-soon { cursor: pointer; }
.cursor-ready .is-soon { cursor: default; }
.cursor-ready.cursor-native .cursor-dot,
.cursor-ready.cursor-native .cursor-ring { opacity: 0; }

@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(79,209,255,0); } 100% { box-shadow: 0 0 0 0 rgba(79,209,255,0); } }

@media (max-width: 1023px) {
  .page-shell { height: auto; min-height: 100dvh; padding: 26px 4vw 22px; overflow: visible; }
  .projects { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; height: auto; margin: 52px 0; }
  .project-card { min-height: 210px; }
}

@media (max-width: 639px) {
  .page-shell { padding: 22px 16px 20px; }
  .topbar { gap: 22px; }
  .name { font-size: 18px; }
  .tagline { max-width: 145px; }
  .availability { max-width: 155px; }
  .status { align-items: flex-start; font-size: 11px; }
  .status-dot { flex: 0 0 auto; margin-top: 3px; }
  .contact-link { font-size: 10px; }
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 38px 0; }
  .project-card { min-height: 162px; padding: 14px; }
  .card-content { margin-left: calc(-1ch - 2px); }
  .card-title { font-size: 14px; }
  .card-sector { font-size: 10px; }
  .tags { display: none; }
  .card-arrow, .soon-label { top: 14px; right: 14px; }
  .footer { align-items: flex-end; gap: 16px; }
  .socials { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .grain, .cursor-dot, .cursor-ring { display: none; }
}
