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

/* Author display rules (e.g. .nda-panel { display: flex }) beat the UA [hidden]
   stylesheet, so force hidden elements to stay out of layout. */
[hidden] {
  display: none !important;
}

:root {
  --bg: #0a0e14;
  --panel: rgba(9, 14, 20, 0.78);
  --panel-strong: rgba(11, 17, 24, 0.9);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f5efe3;
  --muted: rgba(245, 239, 227, 0.72);
  --accent: #f6b36c;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --radius-panel: 32px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --font-sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button,
a,
input,
textarea {
  font: inherit;
}

.bg-video-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url("assets/videos/StillFrame.webp") center center / cover no-repeat;
}

.bg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 10, 16, 0.18) 0%, rgba(6, 10, 16, 0.48) 48%, rgba(6, 10, 16, 0.72) 100%),
    radial-gradient(circle at 20% 20%, rgba(246, 179, 108, 0.2), transparent 28%),
    radial-gradient(circle at 85% 25%, rgba(255, 255, 255, 0.16), transparent 24%);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 84px 84px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.9) 25%, rgba(0, 0, 0, 0.85) 100%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.9) 25%, rgba(0, 0, 0, 0.85) 100%);
  opacity: 0.2;
}

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  overflow-y: auto;
  transition: opacity 220ms ease;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

#view-about,
#view-projects,
#view-project {
  align-items: flex-start;
  padding-top: 5.5rem;
  padding-bottom: 2rem;
}

#view-contact {
  align-items: center;
  padding-top: 5.5rem;
  padding-bottom: 2rem;
}

#view-home {
  overflow: hidden;
  justify-content: flex-start;
}

.site-nav,
.top-nav {
  position: fixed;
  z-index: 10;
  display: flex;
  gap: 0.65rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.site-nav {
  top: 1.25rem;
  left: 1.25rem;
  transform: translateY(-0.4rem);
}

.site-nav.visible,
.top-nav.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.top-nav {
  top: 1.25rem;
  right: 1.25rem;
  transform: translateY(-0.4rem);
}

.nav-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.8rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(10, 15, 21, 0.68);
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.nav-chip:hover,
.nav-chip:focus-visible {
  background: rgba(246, 179, 108, 0.16);
  border-color: rgba(246, 179, 108, 0.58);
  transform: translateY(-1px);
  outline: none;
}

.nav-chip.active {
  background: rgba(246, 179, 108, 0.22);
  border-color: rgba(246, 179, 108, 0.7);
}

.hero-shell {
  width: min(980px, calc(100% - 8vw));
  min-height: min(72vh, 680px);
  max-height: calc(100dvh - 3rem);
  display: grid;
  align-content: center;
  gap: clamp(1rem, 2vw, 1.75rem);
  padding: clamp(1.25rem, 2.5vw, 2.5rem);
  justify-items: start;
  margin-left: 4vw;
}

.panel-kicker,
.project-index,
.contact-label,
.project-meta-label,
.nda-label {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
}

.hero-main {
  width: min(60vw, 68rem);
  min-width: 0;
  margin-bottom: 1rem;
}

.hero-index {
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.86rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 239, 227, 0.28);
  background: rgba(8, 12, 18, 0.46);
  color: rgba(245, 239, 227, 0.9);
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.hero-title {
  margin: 0;
  padding: 0.35rem 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6.2vw, 4.9rem);
  line-height: 1.06;
  font-weight: 600;
  max-width: 100%;
  text-wrap: pretty;
  overflow-wrap: anywhere;
  text-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}

.hero-actions,
.nda-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#view-home .hero-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: clamp(22rem, 52vw, 46rem);
  max-width: 100%;
  gap: clamp(0.4rem, 0.9vw, 0.75rem);
}

#view-home .hero-actions .nav-chip {
  width: 100%;
  justify-content: center;
  min-height: clamp(2.35rem, 4.2vw, 2.85rem);
  padding: clamp(0.5rem, 1vw, 0.8rem) clamp(0.45rem, 1.1vw, 1rem);
  font-size: clamp(0.6rem, 0.95vw, 0.78rem);
  letter-spacing: clamp(0.04em, 0.12vw, 0.08em);
  animation: heroFadeUp 420ms ease 500ms both;
}

#view-home .hero-index {
  animation: heroDropIn 420ms ease 500ms both;
}

@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  width: min(1180px, 100%);
  padding: clamp(1.4rem, 2.5vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%),
    var(--panel);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  margin-bottom: 0;
}

.panel-intro {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

#view-about .panel-intro,
#view-projects .panel-intro {
  margin-bottom: 1.5rem;
  text-align: center;
}

.panel-kicker {
  margin: 0;
  color: rgba(246, 179, 108, 0.88);
}

#view-about .panel-kicker,
#view-projects .panel-kicker {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.6vw, 2.65rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(246, 179, 108, 0.88);
}

.panel-title,
.project-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 4.25rem);
  line-height: 0.98;
  font-weight: 600;
  max-width: 15ch;
  text-wrap: balance;
}

#view-contact .panel-title {
  font-size: clamp(1.2rem, 1.9vw, 1.75rem);
  max-width: min(58vw, 34ch);
  margin-inline: 0;
  text-align: left;
  font-weight: 400;
  line-height: 1.18;
}

.project-card,
.contact-card,
.nda-panel {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--panel-strong);
  border-radius: 24px;
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  gap: 1rem;
}

.story-block {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 1.35rem 1.5rem;
  border-top: 1px solid rgba(246, 179, 108, 0.4);
  background: linear-gradient(180deg, rgba(246, 179, 108, 0.08), rgba(255, 255, 255, 0.02));
  border-radius: 24px;
}

.story-block p,
.project-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

#view-about .story-block p {
  font-size: 1.15rem;
  line-height: 1.7;
  max-width: none;
}

.story-block p + p,
.project-body p + p {
  margin-top: 1rem;
}

.story-block strong,
.project-body strong {
  color: var(--text);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.project-card {
  position: relative;
  display: grid;
  align-content: end;
  gap: 0.85rem;
  min-height: 280px;
  padding: 1.4rem;
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    radial-gradient(circle at top right, rgba(246, 179, 108, 0.22), transparent 38%);
  opacity: 0.9;
  pointer-events: none;
}

.project-card > * {
  position: relative;
  z-index: 1;
}

.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(246, 179, 108, 0.45);
  background: rgba(17, 25, 36, 0.95);
  outline: none;
}

.project-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
}

.project-card p {
  margin: 0;
  max-width: 28ch;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.92rem;
}

.project-tag {
  color: rgba(245, 239, 227, 0.6);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nda-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem;
}

.nda-label {
  margin: 0 0 0.45rem;
  color: var(--accent);
}

.nda-unlock-form {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) auto;
  align-items: center;
  gap: 0.7rem;
}

.nda-unlock-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 239, 227, 0.88);
}

.nda-password-input {
  min-height: 44px;
  width: 100%;
  padding: 0.68rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(7, 11, 16, 0.9);
  color: var(--text);
}

.nda-password-input:focus-visible {
  outline: none;
  border-color: rgba(246, 179, 108, 0.7);
}

.nda-status {
  width: 100%;
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.nda-projects-wrap {
  margin-top: 1rem;
}

.nda-list-title {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 239, 227, 0.75);
}

.nda-projects-grid {
  margin-bottom: 0;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.contact-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.5rem;
  justify-items: center;
  align-items: start;
  text-align: center;
  min-height: 140px;
  padding: 1.4rem;
  color: inherit;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.contact-card:hover,
.contact-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(246, 179, 108, 0.45);
  background: rgba(17, 25, 36, 0.95);
  outline: none;
}

.contact-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-self: center;
  padding-top: 0.35rem;
}

.contact-action-btn {
  min-height: 36px;
  padding: 0.5rem 0.85rem;
  font-size: 0.66rem;
}

.contact-copy-status {
  min-height: 1.1rem;
  margin: 0;
  font-size: 0.76rem;
  color: rgba(245, 239, 227, 0.72);
  text-align: center;
  align-self: end;
}

.panel-project {
  display: grid;
  gap: 2rem;
}

.project-header {
  display: grid;
  gap: 0.65rem;
  align-items: start;
}

.project-eyebrow {
  margin: 0 0 0.75rem;
  color: rgba(246, 179, 108, 0.88);
}

.project-body {
  display: block;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.project-gallery-item {
  position: relative;
  margin: 0;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.project-gallery-media {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transform: scale(1);
  transition: transform 260ms ease;
}

.project-gallery-item:hover .project-gallery-media,
.project-gallery-item:focus-within .project-gallery-media {
  transform: scale(1.06);
}

.project-gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0.7rem 0.8rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(245, 239, 227, 0.95);
  background: linear-gradient(
    to top,
    rgba(8, 12, 18, 0.92),
    rgba(8, 12, 18, 0.7) 55%,
    rgba(8, 12, 18, 0)
  );
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.project-gallery-item:hover .project-gallery-caption,
.project-gallery-item:focus-within .project-gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

.project-meta {
  display: grid;
  gap: 0.85rem;
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
}

.project-body-with-meta::after {
  content: "";
  display: table;
  clear: both;
}

.project-meta-float {
  float: right;
  width: min(320px, 46%);
  margin: 0 0 1rem 1.25rem;
}

.project-meta-item {
  display: grid;
  gap: 0.3rem;
}

.project-meta-label {
  color: rgba(245, 239, 227, 0.55);
}

.project-meta-value {
  font-size: 1rem;
  color: var(--text);
}

@media (max-width: 900px) {
  .top-nav {
    left: 1.25rem;
    right: 1.25rem;
    top: auto;
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    justify-content: center;
    flex-wrap: wrap;
  }

  .site-nav {
    left: 50%;
    top: calc(1.25rem + env(safe-area-inset-top));
    transform: translate(-50%, -0.4rem);
  }

  .site-nav.visible {
    transform: translate(-50%, 0);
  }

  #view-home {
    justify-content: center;
  }

  .hero-shell {
    width: min(1100px, 100%);
    margin-left: 0;
  }

  #view-about,
  #view-projects,
  #view-project,
  #view-contact {
    align-items: flex-start;
    padding-top: 5rem;
    padding-bottom: calc(7.5rem + env(safe-area-inset-bottom));
  }

  .projects-grid,
  .contact-grid,
  .project-header {
    grid-template-columns: 1fr;
  }

  .project-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-meta-float {
    float: none;
    width: 100%;
    margin: 0 0 1rem;
  }

  .nda-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .nda-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .nda-unlock-form {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .nda-actions > .nav-chip {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .view {
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .hero-shell {
    min-height: calc(100dvh - 2rem);
    max-height: calc(100dvh - 2rem);
    align-content: center;
    gap: 1.1rem;
    padding: 0.5rem 0.25rem calc(1rem + env(safe-area-inset-bottom));
    justify-items: stretch;
  }

  .hero-main {
    width: 100%;
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 3.1rem);
    line-height: 1.05;
    max-width: 100%;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  #view-home .hero-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 0.45rem;
  }

  /* Game link is hidden on small screens — keep remaining chips equal width */
  #view-home .hero-actions .nav-chip {
    min-height: clamp(2.5rem, 8vw, 2.75rem);
    font-size: clamp(0.64rem, 2.6vw, 0.74rem);
    padding: 0.55rem 0.7rem;
  }

  .game-link {
    display: none;
  }

  .top-nav,
  .site-nav {
    gap: 0.5rem;
  }

  .panel {
    padding: 1.1rem;
    border-radius: 24px;
  }

  #view-contact .panel-title {
    max-width: 100%;
  }

  .story-block,
  .project-card,
  .contact-card,
  .nda-panel,
  .project-meta {
    border-radius: 20px;
  }

  .story-block {
    padding: 1.15rem 1.2rem;
  }

  .project-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .project-gallery-item-video {
    display: none;
  }

  /* Make captions always visible on touch/mobile since hover doesn't work reliably */
  .project-gallery-caption {
    opacity: 1;
    transform: none;
    font-size: 0.62rem;
    padding: 0.5rem 0.6rem;
    background: linear-gradient(to top, rgba(8, 12, 18, 0.96), rgba(8, 12, 18, 0.85) 60%, rgba(8, 12, 18, 0));
  }

  /* Disable hover scale on mobile/touch — it feels bad and doesn't add value */
  .project-gallery-item:hover .project-gallery-media,
  .project-gallery-item:focus-within .project-gallery-media {
    transform: none;
  }

  .project-card {
    min-height: 240px;
  }

  .contact-card {
    min-height: 132px;
    padding: 1rem;
  }

  .contact-card-actions {
    gap: 0.45rem;
    padding-top: 0.2rem;
  }

  .contact-action-btn {
    min-height: 40px;
    padding: 0.44rem 0.72rem;
    font-size: 0.72rem;
  }
}

@media (max-height: 820px) {
  .hero-shell {
    min-height: calc(100dvh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    gap: 0.9rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .hero-title {
    font-size: clamp(2.1rem, 5.2vw, 4.2rem);
  }
}

/* Lighter blur on small / likely-mobile screens to reduce GPU cost. */
@media (max-width: 700px) {
  .panel {
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .nav-chip {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .bg-video {
    display: none;
  }

  .project-gallery-media {
    transform: none !important;
  }

}
