/* ---------- Font (self-hosted, see /fonts/OFL.txt) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2?v=8R1ym7Ck2D") format("woff2");
}

:root {
  color-scheme: dark;

  --bg: #0b0b0c;
  --surface: #111113;
  --line: #1e1e21;
  --line-strong: #2c2c30;

  --text: #ededee;
  --text-soft: #c7c7ca;
  --muted: #8b8b90;
  --subtle: #5c5c61;


  --radius: 2px;
  --max-width: 1040px;
  --header-height: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  animation: page-in 0.9s var(--ease) backwards;
}

@keyframes page-in {
  from {
    opacity: 0;
  }
}

::selection {
  background: var(--text);
  color: var(--bg);
}

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

:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 4px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transform: translateY(-200%);
  transition: transform 0.25s var(--ease);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Header (portfolio) ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--header-height);
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.45s var(--ease-out);
  animation: header-in 0.8s var(--ease-out) backwards; /* backwards only, so transitions work afterwards */
}

@keyframes header-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.site-header.is-scrolled {
  background: rgba(11, 11, 12, 0.94); /* nearly solid instead of a blur: blurring the animated background every frame is costly */
  border-bottom-color: var(--line);
}

/* hides while scrolling down, comes back when scrolling up */
.site-header.is-hidden {
  transform: translateY(-100%);
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.875rem;
}

.nav a {
  padding: 6px 0;
}

/* "Main Menu": the only header link, back to the top (hover from .menu-link) */
.nav .wordmark {
  font-size: 0.875rem;
}

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.btn:hover {
  background: transparent;
  color: var(--text);
}

.text-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-soft);
  transition: color 0.25s var(--ease);
}

/* underline that wipes in from the left */
.text-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}

.text-link:hover {
  color: var(--text);
}

.text-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.text-link svg {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform 0.35s var(--ease-out), color 0.25s var(--ease);
}

.text-link:hover svg {
  transform: translate(2px, -2px);
}

/* ---------- Load and scroll animations ---------- */
.intro {
  animation: fade-up 0.9s var(--ease-out) both;
  animation-delay: calc(0.15s + var(--delay, 0s));
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* Only hidden when JS is running (html.js), so content is never lost without it */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--delay, 0s);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Text links with a grow hover (Main Menu, Work | About | Contact) ---------- */
.menu-link {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: color 0.25s var(--ease), transform 0.45s var(--ease-out);
}

.menu-link:hover {
  color: var(--text);
  transform: scale(1.06);
}

.link-divider {
  width: 36px;
  height: 1px;
  background: var(--line-strong);
}

/* ---------- Project cards (Previous Work) and contact email ---------- */
.work-index {
  display: block;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--subtle);
}

.work-summary {
  max-width: 480px;
  margin: 0 auto 14px;
  color: var(--text-soft);
}

.work-highlights {
  margin: 0 0 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.work-meta {
  margin: 0 0 24px;
  font-size: 0.825rem;
  color: var(--subtle);
}

.work-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 28px;
}

.work-status {
  display: inline-block;
  margin: 0;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--muted);
}

.contact-email {
  position: relative;
  display: inline-block;
  margin-bottom: 28px;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* resting underline, with a brighter line that wipes across on hover */
.contact-email::before,
.contact-email::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
}

.contact-email::before {
  background: var(--line-strong);
}

.contact-email::after {
  background: var(--text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s var(--ease-out);
}

.contact-email:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Footer */
.site-footer {
  padding: 28px 24px 32px;
  font-size: 0.8rem;
  text-align: center;
  color: var(--subtle);
}

/* ---------- Background (welcome screen) ----------
   Faint topographic contour lines that drift very slowly, drawn by backdrop.js. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.backdrop canvas {
  display: block;
  transition: opacity 0.8s var(--ease);
}

/* The welcome screen brings the background in slowly */
.welcome .backdrop {
  animation: backdrop-in 2.4s var(--ease) backwards;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

/* Content sits above the background */
.site-footer,
.welcome-screen {
  position: relative;
  z-index: 1;
}

/* ---------- Welcome screen (/) ----------
   One screen, no scrolling. Clicking anywhere continues to /portfolio. */
body.welcome {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.welcome-screen {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  padding: 24px;
  cursor: pointer;
  user-select: none;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 0.7s var(--ease), transform 0.9s var(--ease-out), filter 0.7s var(--ease);
}

.welcome-name {
  margin: 0;
  font-size: clamp(2.6rem, 7.5vw, 4.25rem); /* same size as the name on /portfolio */
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.welcome-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 36px;
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
  color: var(--muted);
  transition: opacity 0.4s var(--ease);
}

/* Only shown when JavaScript is off */
.welcome-continue {
  margin-top: 32px;
}

/* the hint breathes gently once it has faded in */
.welcome-hint.intro {
  animation: fade-up 0.9s var(--ease-out) both, breathe 3.2s var(--ease) 2s infinite;
  animation-delay: calc(0.15s + var(--delay, 0s)), 2s;
}

@keyframes breathe {
  50% {
    opacity: 0.45;
  }
}

/* Leaving: everything drifts up, softens, and fades to the background colour.
   The portfolio then fades in from the same colour, so the two pages blend into each other. */
.welcome.is-leaving .welcome-content {
  opacity: 0;
  transform: translateY(-10px) scale(0.985);
  filter: blur(4px);
}

.welcome.is-leaving .welcome-hint {
  opacity: 0;
  animation: none;
}

/* ---------- 404 ---------- */
.not-found {
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
}

.not-found .code {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.not-found h1 {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.not-found p {
  margin: 0 0 32px;
  color: var(--muted);
}
