:root {
  --bg: #050608;
  --text: #f4f1ea;
  --muted: #a7a7a7;
  --orange: #ff8a2a;
  --line: rgba(255, 255, 255, 0.14);
  --card-bg: rgba(255, 255, 255, 0.035);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a { color: inherit; }

/* ---------- topbar ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 48px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-mark { border-radius: 3px; }
.brand-word .accent { color: var(--orange); }

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 28px);
  font-size: 13px;
}

.topnav a {
  text-decoration: none;
  color: rgba(244, 241, 234, 0.72);
  transition: color 0.2s ease;
}

.topnav a:hover { color: var(--orange); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: clamp(28px, 6vw, 96px);
  isolation: isolate;
  overflow: hidden;
}

canvas#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  background:
    radial-gradient(circle at 72% 46%, rgba(255, 138, 42, 0.08), transparent 26%),
    radial-gradient(circle at 55% 66%, rgba(255, 255, 255, 0.05), transparent 30%),
    linear-gradient(135deg, #030405 0%, #080a0f 48%, #050608 100%);
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3,4,5,0.94) 0%, rgba(3,4,5,0.78) 28%, rgba(3,4,5,0.20) 66%, rgba(3,4,5,0.64) 100%),
    radial-gradient(circle at 50% 50%, transparent 0%, rgba(0,0,0,0.52) 78%);
}

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

/* ---------- projects ---------- */

.projects {
  position: relative;
  padding: clamp(48px, 8vw, 96px) clamp(20px, 6vw, 96px) clamp(80px, 10vw, 140px);
  max-width: 1180px;
  margin: 0 auto;
}

.projects-head { max-width: 560px; margin-bottom: clamp(28px, 5vw, 48px); }

.projects-head h2 {
  margin: 0 0 10px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 40px);
}

.projects-head p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  height: 260px;
  perspective: 1200px;
  cursor: pointer;
  outline: none;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-style: preserve-3d;
}

/* flip on click/tap — applied via JS on all pointer types so keyboard + touch always work */
.card.is-flipped .card-inner { transform: rotateY(180deg); }

/* on devices with real hover, flip on mouseover too, no click needed */
@media (hover: hover) and (pointer: fine) {
  .card:hover .card-inner { transform: rotateY(180deg); }
}

.card:focus-visible .card-inner { outline: 2px solid var(--orange); outline-offset: 4px; }

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.card-front {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
}

.card-art {
  flex: 1;
  display: grid;
  place-items: center;
  /* ponytail: gradient placeholder tile — swap to background-image: url(...) per project once a screenshot exists */
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 138, 42, 0.24), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(244, 241, 234, 0.08), transparent 50%),
    #0b0c0f;
}

.card-glyph {
  font-family: Georgia, serif;
  font-size: 40px;
  color: rgba(244, 241, 234, 0.5);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.card-meta h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-status {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
}

.card-back {
  transform: rotateY(180deg);
  background: #0b0c0f;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-back p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(244, 241, 234, 0.82);
}

.card-cta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.card-ghost {
  height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
  cursor: default;
}

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(20px, 6vw, 96px) 40px;
  max-width: 1180px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

.site-footer a { text-decoration: none; color: rgba(244, 241, 234, 0.72); }
.site-footer a:hover { color: var(--orange); }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .card { height: 220px; }
  .card-ghost { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  canvas#field { opacity: 0.72; }
  .card-inner { transition: none; }
}
