/* ============================================================
   PORTFOLIO — shared styles
   Change colours and fonts here later to restyle the whole site.
   ============================================================ */

:root {
  /* [EDIT COLOURS HERE] */
  --paper: #f3eee6;
  --paper-deep: #e7dfd2;
  --ink: #1c1915;
  --ink-soft: #4a433a;
  --ink-faint: rgba(28, 25, 21, 0.12);
  --accent: #6e4a3a;
  --placeholder: #d9d0c3;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;

  --space: clamp(1.25rem, 4vw, 2.5rem);
  --max: 72rem;
  --header-h: 4.25rem;
  --sidebar-w: clamp(11rem, 12vw, 13.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.6;
}

body.page:not(.home) {
  padding-left: var(--sidebar-w);
}

body.page.home {
  padding-left: 0;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* =========================================================
   HOME HEADER — KEEP ABOVE HERO
========================================================= */

header,
.site-header {
  position: relative;
  z-index: 100;
}

/* ---------- Header & navigation ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  width: var(--sidebar-w);
  padding: 1.1rem 1.1rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  background: rgba(247, 242, 236, 0.94);
  border-right: 1px solid rgba(28, 25, 21, 0.08);
  pointer-events: none;
}

.site-header a,
.site-header button {
  pointer-events: auto;
}

.primary-sidebar {
  width: 100%;
  display: grid;
  gap: 1.25rem;
}

.site-name {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 2.3vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
  opacity: 0;
  animation: fadeIn 1.2s ease 1.1s forwards;
}

.page:not(.home) .site-name {
  opacity: 1;
  animation: none;
}

.primary-nav {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.primary-nav > .nav-item {
  display: grid;
  gap: 0.35rem;
}

.primary-nav a {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(1.38rem, 1.7vw, 1.75rem);
  font-weight: 500;
  line-height: 1.15;
  text-decoration: none;
  letter-spacing: 0.02em;
  color: rgba(28, 25, 21, 0.74);
  transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.primary-nav a:hover,
.primary-nav a:focus-visible,
.primary-nav a[aria-current="page"] {
  color: var(--ink);
  transform: translateX(2px);
  font-style: italic;
}

.nav-item-with-children {
  display: grid;
  gap: 0.2rem;
}

.nav-subnav {
  list-style: none;
  margin: 0 0 0 0.9rem;
  padding: 0;
  display: none;
  gap: 0.18rem;
}

.nav-item-with-children.is-open .nav-subnav,
.nav-item-with-children:hover .nav-subnav,
.nav-item-with-children:focus-within .nav-subnav {
  display: grid;
}

.nav-subnav a {
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(28, 25, 21, 0.68);
}

.nav-subnav a:hover,
.nav-subnav a:focus-visible,
.nav-subnav a[aria-current="page"] {
  color: var(--ink);
}

.menu-toggle {
  width: 2.8rem;
  height: 2.8rem;
  display: none;
  place-items: center;
  border-radius: 50%;
  opacity: 0;
  animation: fadeIn 1.2s ease 1.1s forwards;
}

.page:not(.home) .menu-toggle {
  opacity: 1;
  animation: none;
}

.menu-toggle:hover,
.menu-toggle:focus-visible,
.menu-toggle:active {
  background: var(--ink-faint);
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 1.15rem;
  height: 1.5px;
  background: var(--ink);
  position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle span::before {
  top: -6px;
}

.menu-toggle span::after {
  top: 6px;
}

body.nav-open .menu-toggle span {
  background: transparent;
}

body.nav-open .menu-toggle span::before {
  top: 0;
  transform: rotate(45deg);
}

body.nav-open .menu-toggle span::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Home header stays readable on the dark ink, then on the warm hero */
.page.home .site-header {
  background: rgba(12, 8, 7, 0.12);
  border-right-color: rgba(255, 255, 255, 0.12);
}

.page.home .site-name {
  color: #f6f1e8;
  text-shadow: 0 1px 12px rgba(22, 19, 16, 0.45);
}

.page.home .primary-nav a {
  color: rgba(246, 241, 232, 0.82);
}

.page.home .primary-nav a:hover,
.page.home .primary-nav a:focus-visible,
.page.home .primary-nav a[aria-current="page"] {
  color: #fff;
}

.page.home .menu-toggle span,
.page.home .menu-toggle span::before,
.page.home .menu-toggle span::after {
  background: #f6f1e8;
}

body.nav-open.home .site-name {
  color: var(--ink);
  text-shadow: none;
}

body.nav-open.home .menu-toggle span {
  background: transparent;
}

body.nav-open.home .menu-toggle span::before,
body.nav-open.home .menu-toggle span::after {
  background: var(--ink);
}

/* ---------- Navigation panel ---------- */

.nav-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(243, 238, 230, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

body.nav-open .nav-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}

@media (min-width: 921px) {
  .nav-panel {
    display: none;
  }
}

@media (max-width: 920px) and (orientation: portrait) {
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.page:not(.home) {
    padding-left: 0;
  }

  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--header-h);
    padding: 0 var(--space);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border-right: 0;
    backdrop-filter: none;
  }

  .primary-sidebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .site-name {
    opacity: 1;
    animation: none;
    font-size: clamp(1.4rem, 4vw, 1.9rem);
  }

  .primary-nav {
    display: none;
  }

  .menu-toggle {
    display: grid;
    opacity: 1;
    animation: none;
  }

  main,
  .page-main,
  .page-main.wide,
  .site-footer,
  .recently-content,
  .blog-content {
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding-left: var(--space);
    padding-right: var(--space);
  }

  .page-layout,
  .page-layout:not(.single-column) {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
  }

  .category-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    padding: 0 0 0.9rem;
    margin: 0 0 1.5rem;
    border-left: 0;
    border-bottom: 1px solid var(--ink-faint);
    background: transparent;
  }
}

.nav-list a {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  padding: 0.15em 0.2em;
}

.nav-list a:hover,
.nav-list a:focus-visible,
.nav-list a:active,
.nav-list a[aria-current="page"] {
  font-style: italic;
  color: var(--accent);
}

.nav-panel .nav-item-with-children {
  display: grid;
  gap: 0.2rem;
}

.nav-panel .nav-subnav {
  margin: 0.1rem 0 0 1rem;
  display: none;
  gap: 0.2rem;
}

.nav-panel .nav-item-with-children.is-open .nav-subnav,
.nav-panel .nav-item-with-children:hover .nav-subnav,
.nav-panel .nav-item-with-children:focus-within .nav-subnav {
  display: grid;
}

.nav-panel .nav-subnav a {
  font-size: clamp(1.05rem, 3vw, 1.5rem);
  font-weight: 500;
  padding: 0.1em 0.2em;
}

.nav-list .nav-soon a {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  opacity: 0.55;
  margin-top: 1.5rem;
}

/* ---------- Home / ink hero ---------- */

.hero {
  position: relative;
  background: var(--paper-deep);
}

@media (max-width: 640px) {
  /* On mobile: show full image without cropping */
  .hero {
    overflow: visible;
    padding-bottom: 0;
  }
}

@media (min-width: 641px) {
  /* On desktop: preserve full viewport height */
  .hero {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
  }
}

/* [REPLACE HERO IMAGE]
   Put your file in assets/images/hero.jpg
   Then add this inside .hero-media:
   <img src="assets/images/hero.jpg" alt="[DESCRIBE HERO IMAGE]">
*/
.hero-media {
  position: relative;
  width: 100%;
  height: auto;
}

@media (min-width: 641px) {
  /* On desktop: position absolute for full viewport fill */
  .hero-media {
    position: absolute;
    inset: 0;
    height: 100%;
  }
}

@media (max-width: 640px) {
  /* On mobile: static positioning so Recently doesn't overlap */
  .hero-media {
    position: static;
  }
}

.hero-placeholder {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 30% 40%, #cfc4b4 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, #b9a894 0%, transparent 45%),
    linear-gradient(160deg, #e8dfd1, #c9bba8);
}

.hero-label {
  position: absolute;
  bottom: 1.5rem;
  left: var(--space);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  z-index: 2;
}

.ink-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: #161310;
}

.ink-blot {
  position: absolute;
  border-radius: 46% 54% 48% 52%;
  background: radial-gradient(circle, #120f0c 0%, #120f0c 42%, transparent 70%);
  transform: scale(0.12);
  opacity: 0.95;
  animation: blotSpread 2.6s ease-out forwards;
  will-change: transform, opacity;
}

.ink-blot:nth-child(1) {
  width: 85vw;
  height: 85vw;
  top: 8%;
  left: -10%;
  animation-delay: 0.05s;
}

.ink-blot:nth-child(2) {
  width: 70vw;
  height: 70vw;
  top: 30%;
  right: -15%;
  animation-delay: 0.18s;
}

.ink-blot:nth-child(3) {
  width: 55vw;
  height: 55vw;
  bottom: -5%;
  left: 25%;
  animation-delay: 0.32s;
}

.ink-veil {
  position: absolute;
  inset: 0;
  background: #161310;
  animation: veilLift 2.8s ease 0.35s forwards;
}

@keyframes blotSpread {
  0% {
    transform: scale(0.08);
    opacity: 1;
  }
  55% {
    opacity: 1;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes veilLift {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ink-blot {
    animation: none;
    opacity: 0;
  }

  .ink-veil {
    animation: fadeIn 0.8s ease reverse forwards;
  }

  .site-name,
  .menu-toggle {
    animation: none;
    opacity: 1;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Temporary home reveal */
.hero-media.simple-reveal{
opacity:0;
transform:translateY(18px);
animation:simpleReveal 1.8s ease-out forwards;
}

.hero-media.simple-reveal img{
width:100%;
height:100%;
object-fit:cover;
display:block;
}

/* Ensure hero images scale proportionally on mobile, no cropping */
.hero-media img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

@media (min-width: 641px) {
  /* Desktop: use cover to fill the fixed-height hero area */
  .hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

@keyframes simpleReveal{
from{
opacity:0;
transform:translateY(18px);
}

to{
opacity:1;
transform:translateY(0);
}
}

/* ---------- Recently section (home page) ---------- */

.recently-section {
  padding: 4rem var(--space) 3rem;
  background: var(--paper);
  border-top: 1px solid var(--ink-faint);
}

.recently-content {
  max-width: var(--max);
  margin: 0 auto;
}

.recently-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 2rem;
}

.recently-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
  /* Default: 2 columns on mobile */
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 900px) {
  .recently-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .recently-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.showcase-slide {
  display: block;
  text-decoration: none;
  color: inherit;
}

.showcase-media {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: var(--paper-deep);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.showcase-slide:hover .showcase-media,
.showcase-slide:focus-visible .showcase-media {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(28, 25, 21, 0.1);
}

.showcase-media img,
.showcase-media video {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.recently-caption {
  max-width: 38rem;
  margin: 0 auto;
  text-align: center;
  padding: 0 var(--space);
}

.recently-caption h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.recently-caption p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}


/* ---------- Blog section (home page) ---------- */

.blog-section {
  padding: 2rem var(--space) 3rem;
  background: var(--paper);
  border-top: 1px solid var(--ink-faint);
}

.blog-content {
  max-width: var(--max);
  margin: 0 auto;
}

.blog-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.blog-card:hover,
.blog-card:focus-visible {
  box-shadow: 0 12px 28px rgba(28, 25, 21, 0.1);
  transform: translateY(-2px);
}

.blog-card-media {
  width: 100%;
  aspect-ratio: 16 / 6;
  overflow: hidden;
  background: var(--placeholder);
}

.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.blog-card-content {
  padding: 1.5rem var(--space);
  background: var(--paper-deep);
}

.blog-card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}

.blog-card-meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0.5rem 0 0;
  letter-spacing: 0.04em;
}

.blog-empty {
  text-align: center;
  padding: 3rem var(--space);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  .blog-section {
    padding: 1.5rem var(--space) 2.5rem;
  }

  .blog-card-media {
    aspect-ratio: 16 / 9;
  }

  .blog-card-content {
    padding: 1rem var(--space);
  }

  .blog-card-title {
    font-size: 1.1rem;
  }

  .blog-card-meta {
    font-size: 0.8rem;
  }
}


/* ---------- Page layout ---------- */

.page-main {
  padding: 2.5rem var(--space) 4rem;
  max-width: min(var(--max), calc(100vw - var(--sidebar-w) - 2 * var(--space)));
  margin: 0;
}

.page-main.wide {
  max-width: min(92rem, calc(100vw - var(--sidebar-w) - 2 * var(--space)));
  margin: 0;
}

.page-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0 0 1.4rem;
}

.lede {
  max-width: 42rem;
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin: 0 0 2.5rem;
}

/* ---------- Placeholders ---------- */

.placeholder-block {
  background: var(--placeholder);
  border: 1px dashed rgba(28, 25, 21, 0.28);
  min-height: 12rem;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.placeholder-block.tall {
  min-height: 22rem;
}

.placeholder-block.video {
  min-height: 16rem;
  aspect-ratio: 16 / 9;
}

.editable-note {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* ---------- Intro flexible grid ---------- */

.intro-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 800px) {
  .intro-grid {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }
}

.intro-text,
.intro-media {
  display: grid;
  gap: 1rem;
}

/* ---------- Category tabs (illustration / animation) ---------- */

.page-layout {
  display: grid;
  gap: 2rem;
}

.page-layout > :only-child {
  grid-column: 1 / -1;
}

.page-layout.single-column {
  grid-template-columns: 1fr;
}

@media (min-width: 980px) {
  .page-layout:not(.single-column) {
    grid-template-columns: minmax(12rem, 14rem) minmax(0, 1fr);
    align-items: start;
  }
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 2rem;
  border-bottom: 1px solid var(--ink-faint);
  padding-bottom: 0.75rem;
}

.category-nav a {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 500;
  opacity: 0.8;
}

.category-nav a:hover,
.category-nav a:focus-visible,
.category-nav a:active,
.category-nav a.is-active {
  opacity: 1;
  color: var(--ink);
  font-style: italic;
}

.category-nav a[aria-current="page"] {
  opacity: 1;
  color: var(--ink);
  font-style: italic;
}

@media (min-width: 980px) {
  .category-nav {
    position: sticky;
    top: 1.25rem;
    display: grid;
    gap: 0.6rem;
    margin: 0;
    padding: 0.9rem 0 0 1rem;
    border-bottom: 0;
    border-left: 1px solid var(--ink-faint);
    background: rgba(247, 242, 236, 0.7);
  }

  .category-nav a {
    font-size: 1.55rem;
    line-height: 1.2;
  }
}

.category-block {
  scroll-margin-top: 1.5rem;
  margin-bottom: 3.5rem;
}

.category-block h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.8rem;
  margin: 0 0 1.25rem;
}

/* ---------- Cards (blog, illustration, animation) ---------- */

.card-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 700px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.work-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.work-card .placeholder-block {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.work-card:hover .placeholder-block,
.work-card:focus-visible .placeholder-block,
.work-card:active .placeholder-block {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(28, 25, 21, 0.08);
}

.work-card h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  margin: 0.85rem 0 0.25rem;
}

.work-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.add-hint {
  border: 1px dashed rgba(28, 25, 21, 0.28);
  padding: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- Project / post pages ---------- */

.project-meta {
  color: var(--ink-soft);
  margin: 0 0 2rem;
}

.media-stack {
  display: grid;
  gap: 1.25rem;
  margin: 2rem 0;
  grid-template-columns: repeat(2, 1fr);
}

/* Videos and single-column items span full width */
.media-stack > video {
  grid-column: 1 / -1;
}

.media-stack > .placeholder-block {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .media-stack {
    grid-template-columns: 1fr;
  }
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ---------- Footer / contact ---------- */

.site-footer {
  border-top: 1px solid var(--ink-faint);
  padding: 2.5rem var(--space) 3rem;
  max-width: var(--max);
  margin: 0 auto;
}

.site-footer h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.contact-list a[href="#"] {
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}

.privacy-note {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Illustration photo wall ---------- */

.photo-wall {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, 1fr);
  /* row-based masonry using auto rows; items sized via JS to preserve aspect ratios */
  grid-auto-rows: 8px;
  align-items: start;
}

@media (min-width: 800px) {
  .photo-wall {
    grid-template-columns: repeat(4, 1fr);
  }
}

.photo-wall > * {
  margin: 0;
  width: 100%;
}

.gallery-item {
  margin: 0 0 0.75rem;
}

.gallery-hit {
  display: block;
  width: 100%;
  border-radius: 2px;
}

.gallery-hit img {
  width: 100%;
  height: auto;
}

.gallery-hit:hover img,
.gallery-hit:focus-visible img,
.gallery-hit:active img,
.gallery-hit:hover .placeholder-block,
.gallery-hit:focus-visible .placeholder-block,
.gallery-hit:active .placeholder-block {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.gallery-placeholder {
  min-height: 0;
  width: 100%;
}

/* ---------- Lightbox ---------- */

body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(22, 19, 16, 0.88);
  overflow: auto;
  padding: 5rem var(--space) 2.5rem;
}

.lightbox-inner {
  max-width: 46rem;
  margin: 0 auto;
  color: #f3eee6;
}

.lightbox-media img {
  width: 100%;
  height: auto;
}

.lightbox-copy h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 1.25rem 0 0.5rem;
}

.lightbox-copy .editable-note {
  color: rgba(243, 238, 230, 0.7);
}

.lightbox-close {
  position: fixed;
  top: 0.85rem;
  right: var(--space);
  z-index: 51;
  min-width: 3.2rem;
  min-height: 2.6rem;
  padding: 0.45rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.95rem;
}

.lightbox-close:hover,
.lightbox-close:focus-visible,
.lightbox-close:active {
  background: #fff;
}

/* ---------- Animation film showcase ---------- */

.film-block {
  margin-bottom: 4.5rem;
}

/*.film-showcase {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "prev view next"
    "cap cap cap";
  gap: 0.85rem 0.4rem;
  align-items: center;
}

.film-viewport {
  grid-area: view;
  overflow: hidden;
  touch-action: pan-y;
}

.film-track {
  display: flex;
  align-items: center;
  gap: 1rem;
  will-change: transform;
}

.film-track.is-shifting {
  transition: transform 0.45s ease;
}

.film-slide {
  flex: 0 0 min(78%, 36rem);
  opacity: 0.38;
  transform: scale(0.94);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.film-slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.film-slide.is-prev,
.film-slide.is-next {
  cursor: pointer;
}

.film-slide.is-idle {
  opacity: 0.18;
}
*/

/* ---------- Animation + Recent carousel ---------- */

.film-showcase {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "prev view next"
    "cap cap cap";
  gap: 0.85rem 0.4rem;
  align-items: center;
}


/* 中间显示作品的窗口 */

.film-viewport {
  grid-area: view;
  overflow: hidden;
  touch-action: pan-y;

  /* 给两侧作品一点立体景深 */
  perspective: 1200px;

  /* 防止放大缩小时上下被切掉 */
  padding: 1.5rem 0;
}


/* 所有作品排成一整条横向轨道 */

.film-track {
  display: flex;
  align-items: center;
  gap: 1rem;

  width: max-content;

  will-change: transform;
}


/* 点击箭头时，整条轨道真正滑动 */

.film-track.is-shifting {
  transition:
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}


/* 所有非中间作品的默认状态 */

.film-slide {
  flex: 0 0 min(78%, 36rem);

  opacity: 0.22;

  transform:
    scale(0.82)
    translateZ(-80px);

  filter: blur(2.5px);

  transform-origin: center center;

  transition:
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.45s ease,
    filter 0.45s ease;
}


/* 正中间：最大、最清晰、最前面 */

.film-slide.is-active {
  opacity: 1;

  transform:
    scale(1)
    translateZ(0);

  filter: blur(0);

  z-index: 3;
}


/* 左右紧邻的作品：稍小、稍微退后 */

.film-slide.is-prev,
.film-slide.is-next {
  opacity: 0.5;

  transform:
    scale(0.9)
    translateZ(-40px);

  filter: blur(1.2px);

  cursor: pointer;

  z-index: 2;
}


/* 更远的作品 */

.film-slide.is-idle {
  opacity: 0.12;

  transform:
    scale(0.76)
    translateZ(-100px);

  filter: blur(3.5px);

  z-index: 1;
}

.film-slide video,
.film-slide iframe,
.film-slide img,
.film-slide .placeholder-block {
  width: 100%;
  height: auto;
  display: block;
}

.film-slide video {
  aspect-ratio: 16 / 9;
}

.film-slide iframe {
  aspect-ratio: 16 / 9;
  border: 0;
  min-height: 12rem;
}

.film-arrow {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  font-size: 1.2rem;
  background: var(--ink-faint);
}

.film-arrow:hover,
.film-arrow:focus-visible,
.film-arrow:active {
  background: rgba(28, 25, 21, 0.18);
}

.film-arrow:disabled {
  opacity: 0.28;
  cursor: default;
}

.film-showcase [data-film-prev] {
  grid-area: prev;
}

.film-showcase [data-film-next] {
  grid-area: next;
}

.film-caption {
  grid-area: cap;
  max-width: 38rem;
  margin: 0 auto;
  text-align: center;
}

.film-caption h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.7rem;
  margin: 0.2rem 0 0.35rem;
}

@media (max-width: 640px) {
  .film-showcase {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "view view"
      "prev next"
      "cap cap";
  }

  .film-arrow {
    justify-self: center;
  }

  .film-slide {
    flex: 0 0 calc(82vw);
    max-height: none;
    min-height: auto;
  }

  .film-slide video,
  .film-slide iframe {
    width: 100%;
    height: auto;
    display: block;
    max-height: none;
  }

  .film-slide iframe {
    min-height: auto;
    aspect-ratio: 16 / 9;
  }

  .film-viewport {
    overflow: hidden;
    padding: 0;
  }
}

/* ---------- Interactive project page ---------- */

.project-section {
  margin: 0 0 2.75rem;
}

.project-section h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.7rem;
  margin: 0 0 0.8rem;
}

.control-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
}

.game-embed {
  position: relative;
}

.game-frame {
  width: 100%;
  /* Use aspect-ratio to preserve proportions and avoid scrollbars */
  aspect-ratio: 16 / 9;
  height: auto;
  max-width: 100%;
  border: 0;
  background: #111;
}

/* Audio toggle button overlay */
.audio-toggle {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 60;
  background: rgba(243,238,230,0.95);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.35rem;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 12px rgba(28,25,21,0.08);
}

.audio-toggle:focus {
  outline: 2px solid var(--accent);
}


.mobile-game-note {
  border: 1px dashed rgba(28, 25, 21, 0.28);
  padding: 1.5rem;
  color: var(--ink-soft);
}

.screenshot-wall {
  column-count: 1;
}

@media (min-width: 700px) {
  .screenshot-wall {
    column-count: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .film-track.is-shifting,
  .film-slide {
    transition: none;
  }
}

/* =========================
   INTERACTIVE 3D MODEL VIEWER
========================= */

.model-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.model-modal.is-open {
  display: block;
}

.model-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.model-modal-window {
  position: absolute;
  left: 50%;
  bottom: 4vh;
  transform: translateX(-50%);

  width: min(950px, 92vw);
  height: min(720px, 84vh);

  background: #f5f2eb;
  padding: 24px;
  box-sizing: border-box;
}

.model-modal-content {
  width: 100%;
  height: 100%;
}

#portfolio-model {
  display: block;
  width: 100%;
  height: calc(100% - 105px);
  background: transparent;
}

.model-modal-close {
  position: absolute;
  top: 10px;
  right: 16px;

  z-index: 10;

  border: none;
  background: transparent;

  font-size: 30px;
  line-height: 1;

  cursor: pointer;
}

.model-modal-info {
  text-align: center;
}

.model-instruction {
  margin: 8px 0 5px;

  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#model-title {
  margin: 0;
}

#model-description,
#model-extra {
  margin: 5px 0;
}

body.model-modal-open {
  overflow: hidden;
}



/* =========================================================
   HOME INTERACTIVE HERO
========================================================= */

.home-hero {
  position: relative;
  height: 180vh;
}

.home-hero-sticky {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 640px) {
  .home-hero {
    height: 110vh;
  }

  .home-hero-sticky {
    height: 100vh;
    top: 0;
  }

  .hero-intro {
    width: min(86vw, 580px);
    padding-top: 22vh;
  }

  .hero-intro h1 {
    font-size: clamp(2.6rem, 12vw, 4.3rem);
  }

  .hero-description {
    max-width: 29rem;
    font-size: 0.95rem;
  }
}

.home-hero-sticky::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(19, 16, 14, 0.2) 0%, rgba(19, 16, 14, 0.18) 40%, rgba(19, 16, 14, 0.22) 100%);
}

/* =========================================================
    ARTWORK
===================================================== */

.hero-art-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  will-change: transform, opacity;
}

.hero-art {
  position: absolute;
  width: min(100vw, 1500px);
  max-width: none;
  height: auto;
  object-fit: contain;
  will-change: transform, opacity, filter;
  transform-origin: center center;
}

/* =========================================================
    INTRO TEXT
===================================================== */

.hero-intro {
  position: relative;
  z-index: 2;
  width: min(680px, 86vw);
  margin: 0 auto;
  padding-top: 35vh;
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  will-change: opacity, transform;
  color: #f6f1e8;
  animation: heroIntroReveal 1.7s ease-out 0.25s forwards;
}

.hero-kicker {
  margin-bottom: 12px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(246, 241, 232, 0.86);
}

.hero-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 6vw, 6rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: #fffaf5;
}

.hero-description {
  max-width: 500px;
  margin: 22px auto 0;
  line-height: 1.7;
  font-size: 1.05rem;
  color: rgba(246, 241, 232, 0.92);
}

.hero-scroll {
  margin-top: 32px;
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.82;
  color: rgba(246, 241, 232, 0.82);
}

@keyframes heroIntroReveal {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
