/* ==========================================================================
   Page: projects — Hero, project cards grid, experimental flipbook
   ========================================================================== */

/* ---- Page wrapper / shared rhythm -------------------------------------- */

.page-projects main {
  background-color: var(--bg);
}

/* ---- HERO -------------------------------------------------------------- */

.proj-hero {
  position: relative;
  padding-block: clamp(3rem, 7vw, 6rem) clamp(2rem, 5vw, 4rem);
  text-align: center;
  background-image:
    radial-gradient(rgba(17, 17, 17, 0.10) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
}

[data-theme="dark"] .proj-hero {
  background-image:
    radial-gradient(rgba(244, 244, 238, 0.08) 1.4px, transparent 1.4px);
}

.proj-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
}

.proj-hero__lead {
  max-width: 56ch;
  font-size: var(--fs-body);
  color: var(--ink-soft);
  line-height: var(--lh-base);
}

.proj-hero__title {
  font-family: var(--ff-display);
  font-size: clamp(4rem, 14vw, 9rem);
  line-height: 0.85;
  letter-spacing: -0.04em;
  text-transform: lowercase;
  color: var(--ink);
  margin: var(--sp-2) 0;
}

.proj-hero__media {
  position: relative;
  display: inline-block;
  margin-top: var(--sp-4);
}

.proj-hero__media img {
  display: block;
  max-width: min(420px, 70vw);
  height: auto;
  border: 4px solid var(--stroke);
  background-color: var(--accent);
  box-shadow: var(--sh-lg);
  padding: var(--sp-3);
}

.proj-hero__sub {
  max-width: 60ch;
  font-size: var(--fs-body-sm);
  color: var(--ink-dim);
  line-height: var(--lh-base);
  margin-top: var(--sp-3);
}

.proj-hero__cats {
  justify-content: center;
  margin-top: var(--sp-3);
}

/* ---- GRID OF PROJECT CARDS --------------------------------------------- */

.proj-grid-section {
  padding-block: clamp(3rem, 6vw, 5rem);
  border-top: 2px solid var(--stroke);
}

.proj-grid {
  display: grid;
  gap: var(--sp-6);
  grid-template-columns: 1fr;
}

@media (min-width: 600px)  { .proj-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .proj-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1320px) { .proj-grid { grid-template-columns: repeat(4, 1fr); } }

.proj-card {
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  color: var(--ink);
  border: 3px solid var(--stroke);
  box-shadow: var(--sh-md);
  text-decoration: none;
  background-image: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .proj-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: var(--sh-lg);
  }
}

.proj-card:active {
  transform: translate(2px, 2px);
  box-shadow: var(--sh-sm);
}

.proj-card__media {
  position: relative;
  aspect-ratio: 16 / 11;
  background-color: var(--ink);
  border-bottom: 3px solid var(--stroke);
  overflow: hidden;
}

.proj-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .proj-card:hover .proj-card__media img {
    transform: scale(1.04);
  }
}

.proj-card__cat {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 2;
}

.proj-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  flex: 1;
}

.proj-card__title {
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  margin: 0;
}

.proj-card__desc {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-base);
  color: var(--ink-soft);
  margin: 0;
}

.proj-card__footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 2px solid var(--stroke);
  font-family: var(--ff-mono);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--ink);
}

.proj-card__footer .arrow {
  display: inline-block;
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .proj-card:hover .proj-card__footer .arrow { transform: translateX(4px); }
}

/* ---- EXPERIMENTAL SECTION (Flipbook) ----------------------------------- */

.exp-section {
  padding-block: clamp(4rem, 8vw, 6rem);
  background-color: var(--ink);
  color: var(--bg);
  border-top: 3px solid var(--stroke);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .exp-section {
  background-color: var(--surface-2);
  color: var(--ink);
}

.exp-section__head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.exp-section__head .t-kicker {
  color: var(--accent);
}

.exp-section__title {
  font-family: var(--ff-display);
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: lowercase;
  color: var(--bg);
  margin: 0;
}

[data-theme="dark"] .exp-section__title { color: var(--ink); }

.exp-section__lead {
  max-width: 60ch;
  font-size: var(--fs-body-sm);
  line-height: var(--lh-base);
  color: var(--bg);
  opacity: 0.75;
}

[data-theme="dark"] .exp-section__lead { color: var(--ink); opacity: 0.7; }

/* The big stage/scene */
.exp-scene {
  position: relative;
  width: min(100%, 1180px);
  margin-inline: auto;
  min-height: 540px;
  padding: var(--sp-12) var(--sp-6);
  border: 4px solid var(--stroke);
  background-color: rgba(255, 255, 255, 0.03);
  background-image:
    linear-gradient(to right,  rgba(209, 254, 23, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(209, 254, 23, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  transform-style: preserve-3d;
  overflow: hidden;
}

.exp-scene__bg-type {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-inline: 4vw;
  font-family: var(--ff-display);
  font-size: clamp(3rem, 11vw, 10rem);
  font-weight: var(--fw-black);
  line-height: 0.8;
  letter-spacing: -0.06em;
  text-transform: uppercase;
  color: rgba(209, 254, 23, 0.10);
  pointer-events: none;
  user-select: none;
}

/* Flipbook */
.exp-book {
  position: relative;
  width: 200px;
  height: 300px;
  perspective: 1200px;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  --spine-shift: 0px;
  transform: translateX(var(--spine-shift));
  transition: transform var(--dur-slow) var(--ease);
}

.exp-book.book-open { --spine-shift: 100px; }

.exp-book__item {
  position: absolute;
  width: 200px;
  height: 300px;
  transform-style: preserve-3d;
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform 0.6s var(--ease), z-index 0s linear 0.3s;
  cursor: pointer;
  z-index: calc(10 - var(--i));
  border: 3px solid var(--stroke);
  box-shadow: var(--sh-lg);
  background-color: var(--bg);
}

.exp-book__item.is-open {
  transform: rotateY(-180deg);
  transition: transform 0.6s var(--ease), z-index 0s;
  z-index: calc(20 + var(--i));
}

.exp-book__item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
  display: block;
}

.exp-book__item img:nth-child(2) {
  transform: rotateY(180deg) translateZ(1px);
  z-index: 1;
}

.exp-section__note {
  margin-top: var(--sp-5);
  text-align: center;
  font-family: var(--ff-mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
}

/* ---- Mobile flipbook adjustments --------------------------------------- */

@media (max-width: 640px) {
  .exp-scene {
    min-height: 440px;
    padding: var(--sp-8) var(--sp-3);
  }
  .exp-book,
  .exp-book__item {
    width: 150px;
    height: 225px;
  }
  .exp-book.book-open { --spine-shift: 70px; }
  .exp-scene__bg-type {
    font-size: clamp(2rem, 14vw, 4.5rem);
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--sp-4);
  }
}
