:root {
  --bg: #fbfaf7;
  --bg-elev: #ffffff;
  --text: #1d1c1a;
  --text-dim: #7a766d;
  --accent: #a8784f;
  --border: #e7e2d8;
  --shadow: 0 4px 10px rgba(30, 28, 22, 0.09), 0 16px 36px rgba(30, 28, 22, 0.12);
  --shadow-hover: 0 6px 14px rgba(30, 28, 22, 0.12), 0 24px 52px rgba(30, 28, 22, 0.18);
  --max-width: 1140px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

#ambient-scanlines {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(30, 28, 22, 0.05) 0px,
    rgba(30, 28, 22, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  animation: scanline-flicker 6s steps(2, jump-none) infinite;
}

@keyframes scanline-flicker {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #ambient-scanlines {
    animation: none;
  }
}

#ambient-noise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  image-rendering: pixelated;
  mix-blend-mode: multiply;
  opacity: 0.06;
}

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

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

h1, h2 {
  font-family: "Manrope", "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Header / Nav */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
}

.logo-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.user-tag {
  font-family: "Share Tech Mono", "SFMono-Regular", "Menlo", monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  animation: terminal-blink 0.9s steps(2, jump-none) infinite;
}

.nav .logo {
  font-family: "Manrope", "Inter", sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.nav .logo::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.nav ul {
  display: flex;
  gap: 2.4rem;
  list-style: none;
}

.nav a {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s ease;
  position: relative;
  padding-bottom: 2px;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
}

.nav a:hover::after,
.nav a.active::after {
  width: 100%;
}

/* Hero */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem 2.25rem;
  display: flex;
  flex-direction: column;
}

.aw-wrap .hero {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.title-frame {
  position: relative;
  display: block;
  width: 100%;
}

.hero h1 {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  line-height: 1.3;
  letter-spacing: 0.035em;
  background: var(--text);
  color: var(--bg);
  text-shadow: 0 0 6px rgba(251, 250, 247, 0.5), 0 0 16px rgba(251, 250, 247, 0.3), 0 0 28px rgba(168, 120, 79, 0.35);
  padding: 0.45em 0.7em 0.45em 0.6em;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  position: relative;
  transform: translate(var(--gx, 0px), var(--gy, 0px));
  filter: drop-shadow(0 4px 10px rgba(30, 28, 22, 0.09)) drop-shadow(0 16px 36px rgba(30, 28, 22, 0.12));
}

#hero-title-text {
  display: inline;
  filter: brightness(var(--text-brightness, 1));
}

.tx-id {
  position: absolute;
  right: 0.7em;
  bottom: 0.4em;
  font-family: "Share Tech Mono", "SFMono-Regular", "Menlo", monospace;
  font-size: 0.32em;
  letter-spacing: 0.06em;
  color: var(--bg);
  opacity: 0.45;
  z-index: 2;
  pointer-events: none;
}

.eom-tag {
  display: inline-block;
  font-family: "Share Tech Mono", "SFMono-Regular", "Menlo", monospace;
  font-size: 0.42em;
  font-weight: 400;
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 0.5em;
  color: var(--accent);
  text-shadow: 0 0 4px var(--accent), 0 0 10px var(--accent), 0 0 18px rgba(168, 120, 79, 0.6);
  animation: terminal-blink 0.9s steps(2, jump-none) infinite;
}

.hero h1::before,
.hero h1::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0.45em 0.7em 0.45em 0.6em;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  pointer-events: none;
  mix-blend-mode: screen;
}

.hero h1::before {
  background: #ff1f44;
  color: #ff1f44;
  opacity: var(--op1, 0);
  transform: translate(var(--gx1, 0px), var(--gy1, 0px));
}

.hero h1::after {
  background: #00eaff;
  color: #00eaff;
  opacity: var(--op2, 0);
  transform: translate(var(--gx2, 0px), var(--gy2, 0px));
}

@media (prefers-reduced-motion: reduce) {
  .eom-tag,
  .user-tag {
    animation: none;
  }
}

@keyframes terminal-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}


/* Project grid */
.projects {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 3.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}

.boxart-gutter {
  position: fixed;
  top: 0;
  bottom: 0;
  width: calc((100vw - var(--max-width)) / 2);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.boxart-gutter-left {
  left: 0;
}

.boxart-gutter-right {
  right: 0;
}

@media (max-width: 1420px) {
  .boxart-gutter {
    display: none;
  }
}

.boxart-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: boxart-scroll-down var(--dur, 34s) linear infinite;
}

@keyframes boxart-scroll-down {
  from { transform: translateY(-50%); }
  to { transform: translateY(0%); }
}

.boxart-item {
  width: 128px;
  height: auto;
  border-radius: 3px;
  opacity: 0.17;
  box-shadow: 0 4px 14px rgba(30, 28, 22, 0.18);
}

.card {
  background: var(--bg-elev);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card-link {
  cursor: pointer;
}

.card-link .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.35);
  transition: background 0.25s ease;
}

.card-link:hover .thumb::after {
  background: rgba(20, 18, 14, 0.15);
}

.card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .thumb img {
  transform: scale(1.04);
}

.card .thumb a.trailer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 14, 0.2);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.card .thumb a.trailer:hover {
  opacity: 1;
}

.card .thumb a.trailer .play {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card .thumb a.trailer .play::after {
  content: "";
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent var(--text);
  margin-left: 3px;
}

.card .body {
  padding: 1.2rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.card h2 {
  font-size: 1rem;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.card h2::before {
  content: "";
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.card .year {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: "Inter", sans-serif;
  white-space: nowrap;
}

.card .role {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card .details {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  background: #6b6862;
  color: var(--bg);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
}

.card-link .body {
  padding-bottom: 0.6rem;
}

.card-note {
  padding: 0 1.3rem 1.2rem;
  color: var(--text-dim);
  font-size: 0.76rem;
}

.card-note a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-note a:hover {
  color: var(--accent);
}

.card .details span:first-child {
  font-weight: 700;
}

.card .details span:last-child {
  font-size: 0.64rem;
}

.card blockquote {
  margin-top: 0.2rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--accent);
  font-size: 0.86rem;
  font-style: italic;
  color: var(--text);
}

.card blockquote cite {
  display: block;
  margin-top: 0.35rem;
  font-style: normal;
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
}

/* About page */
.about-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.75rem 2rem 3.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.25rem;
}

@media (min-width: 760px) {
  .about-wrap {
    grid-template-columns: 260px 1fr;
  }
}

.about-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.about-body h1 {
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.about-body h1::before {
  content: "";
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.about-body .title {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 1.2rem;
}

.about-body p {
  color: var(--bg);
  background: #6b6862;
  padding: 0.9rem 1.1rem;
  border-radius: 4px;
  margin-bottom: 0.9rem;
  max-width: 640px;
  font-size: 0.97rem;
}

.about-body ul {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  margin: 1.2rem 0 1.6rem;
  max-width: 640px;
}

.about-body ul li {
  padding-left: 1.3rem;
  position: relative;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.about-body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.links {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.links a {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 0.65rem 1.2rem;
  border-radius: 3px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* Password gate */
.gate-wrap {
  max-width: 420px;
  margin: 3.5rem auto;
  padding: 0 2rem;
  text-align: center;
}

.gate-wrap h1 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}

.gate-wrap p {
  color: var(--text-dim);
  margin-bottom: 1.6rem;
}

.gate-form {
  display: flex;
  gap: 0.6rem;
}

.gate-form input {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
}

.gate-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.gate-form button {
  background: var(--accent);
  border: none;
  border-radius: 3px;
  padding: 0.75rem 1.3rem;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.gate-form button:hover {
  opacity: 0.88;
}

.gate-error {
  color: #b3473f;
  font-size: 0.85rem;
  margin-top: 0.9rem;
  display: none;
}

/* Additional Works content */
.aw-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 3.5rem;
  display: none;
}

.aw-intro {
  color: var(--text-dim);
  max-width: 760px;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.aw-block {
  margin-bottom: 2.75rem;
}

.aw-block h2 {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
}

.aw-block .aw-desc {
  color: var(--text-dim);
  max-width: 760px;
  margin-bottom: 1rem;
  line-height: 1.6;
  font-size: 0.88rem;
}

.aw-block video {
  width: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow);
  background: #000;
}

.aw-card {
  display: grid;
  grid-template-columns: 340px 1fr;
  background: var(--bg-elev);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  margin-bottom: 2.75rem;
}

.aw-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.aw-card .thumb {
  position: relative;
  overflow: hidden;
  background: #000;
  min-height: 220px;
}

.aw-card .thumb .video-trigger {
  position: absolute;
  inset: 0;
  border-radius: 0;
  box-shadow: none;
}

.aw-card .thumb .video-trigger video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aw-card .thumb.multi {
  display: flex;
  flex-direction: column;
  height: 320px;
}

.aw-card .thumb.multi .video-trigger {
  position: relative;
  inset: auto;
  flex: 1;
  min-height: 0;
}

.aw-card .body {
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
}

.aw-card .body h2 {
  font-size: 1rem;
  letter-spacing: 0.03em;
  line-height: 1.45;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.aw-card .body h2::before {
  content: "";
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  margin-top: 0.5em;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.aw-card .body .aw-desc {
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
  max-width: none;
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .aw-card {
    grid-template-columns: 1fr;
  }

  .aw-card .thumb {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }
}

.aw-gallery {
  columns: 3 280px;
  column-gap: 1.4rem;
}

.aw-gallery figure {
  margin: 0 0 1.4rem;
  break-inside: avoid;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.aw-gallery figure img {
  width: 100%;
  display: block;
}

/* Video modal (lightbox trailer player) */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 14, 0.85);
  padding: 4vh 4vw;
}

.video-modal.open {
  display: flex;
}

.video-modal-frame {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
}

.video-modal-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-modal-frame.local {
  width: auto;
  max-width: 92vw;
  aspect-ratio: auto;
  background: transparent;
  box-shadow: none;
}

.video-modal-frame.local video {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 4px;
  box-shadow: var(--shadow-hover);
  background: #000;
}

/* Local video thumbnails (open in lightbox on click) */
.video-trigger {
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}

.video-trigger:hover {
  box-shadow: var(--shadow-hover);
}

.video-trigger video {
  width: 100%;
  display: block;
  pointer-events: none;
}

.video-trigger .play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 14, 0.25);
  transition: background 0.25s ease;
}

.video-trigger:hover .play-badge {
  background: rgba(20, 18, 14, 0.4);
}

.video-trigger .play-badge .play {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-trigger .play-badge .play::after {
  content: "";
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent var(--text);
  margin-left: 3px;
}

.video-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image lightbox */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 14, 0.85);
  padding: 4vh 4vw;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

.image-modal.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.18s ease;
}

.image-modal img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 4px;
  box-shadow: var(--shadow-hover);
  cursor: zoom-out;
  transform: scale(0.88);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.image-modal.open img {
  transform: scale(1);
}

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.4rem 2rem;
  color: var(--text-dim);
  font-size: 0.65rem;
}

footer a:hover {
  color: var(--accent);
}
