:root {
  --ink: #211713;
  --muted: #6f5d53;
  --paper: #f5efe6;
  --paper-strong: #fffaf2;
  --copper: #9c4324;
  --copper-deep: #69301f;
  --teal: #235b5a;
  --line: rgba(58, 37, 27, 0.18);
  --shadow: 0 24px 80px rgba(42, 27, 21, 0.16);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(156, 67, 36, 0.16), transparent 26rem),
    linear-gradient(135deg, #f7f2ea 0%, #e8ddd2 47%, #f6f0e8 100%);
}

button {
  font: inherit;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #120d0b;
  opacity: 1;
  transition: opacity 720ms ease, visibility 720ms ease;
}

.intro.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

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

.intro__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(18, 13, 11, 0.1), rgba(18, 13, 11, 0.48)),
    radial-gradient(circle at 50% 62%, transparent 0 18rem, rgba(18, 13, 11, 0.2));
}

.intro__enter {
  position: absolute;
  right: clamp(1.25rem, 4vw, 4rem);
  bottom: clamp(1.25rem, 5vw, 4rem);
  min-width: 11rem;
  border: 1px solid rgba(255, 250, 242, 0.5);
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  color: #fffaf2;
  background: rgba(33, 23, 19, 0.36);
  backdrop-filter: blur(18px);
  cursor: pointer;
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease;
}

.intro__enter:hover,
.intro__enter:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 250, 242, 0.86);
  background: rgba(156, 67, 36, 0.46);
  outline: none;
}

.portfolio {
  width: min(1440px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(12px, 2.8vw, 26px) 0;
}

.stage-shell {
  position: relative;
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(58, 37, 27, 0.16);
  border-radius: 26px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.stage__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 220ms ease, filter 220ms ease, transform 620ms ease;
}

.stage.is-switching .stage__image {
  opacity: 0.35;
  filter: saturate(0.9);
  transform: scale(1.012);
}

.stage__cards {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.project-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  border: 1px solid rgba(255, 250, 242, 0);
  border-radius: 18px;
  padding: clamp(0.45rem, 1vw, 1rem);
  color: var(--ink);
  background: rgba(255, 250, 242, 0.02);
  cursor: pointer;
  transform: rotate(var(--rotate));
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 24px;
  opacity: 0;
  background: rgba(255, 250, 242, 0.18);
  box-shadow: 0 18px 44px rgba(33, 23, 19, 0.2);
  backdrop-filter: blur(6px);
  transition: opacity 220ms ease;
}

.project-card:hover,
.project-card:focus-visible,
.project-card.is-active {
  border-color: rgba(255, 250, 242, 0.58);
  background: rgba(255, 250, 242, 0.08);
  box-shadow: 0 18px 54px rgba(42, 27, 21, 0.2);
  transform: rotate(var(--rotate)) translateY(-4px) scale(1.02);
  outline: none;
}

.project-card:hover::before,
.project-card:focus-visible::before,
.project-card.is-active::before {
  opacity: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.modal.is-open {
  visibility: visible;
  opacity: 1;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 12, 0.42);
  backdrop-filter: blur(18px);
}

.modal__panel {
  position: relative;
  width: min(760px, calc(100% - 32px));
  max-height: min(78vh, 720px);
  overflow: auto;
  border: 1px solid rgba(255, 250, 242, 0.44);
  border-radius: 24px;
  padding: clamp(1.3rem, 4vw, 2.5rem);
  background:
    linear-gradient(145deg, rgba(255, 250, 242, 0.94), rgba(242, 232, 219, 0.9)),
    rgba(255, 250, 242, 0.82);
  box-shadow: 0 34px 120px rgba(20, 14, 12, 0.34);
  transform: translateY(18px) scale(0.96);
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal.is-open .modal__panel {
  transform: translateY(0) scale(1);
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.modal__kicker {
  margin: 0 0 0.6rem;
  color: var(--copper);
  font-weight: 900;
  text-transform: uppercase;
}

.modal h2 {
  margin: 0;
  max-width: 88%;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.modal__description {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.8;
}

.modal__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0;
}

.modal__chip {
  border: 1px solid rgba(35, 91, 90, 0.25);
  border-radius: 999px;
  padding: 0.45rem 0.68rem;
  color: var(--teal);
  background: rgba(35, 91, 90, 0.08);
  font-size: 0.9rem;
  font-weight: 750;
}

.modal__bullets {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.modal__bullets li {
  position: relative;
  padding-left: 1.15rem;
  color: #33241e;
  line-height: 1.75;
}

.modal__bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.76em;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--copper);
}

@media (max-width: 760px) {
  .portfolio {
    width: min(100% - 22px, 520px);
    padding-top: 12px;
  }

  .modal__panel {
    width: calc(100% - 22px);
    max-height: 82vh;
    border-radius: 20px;
  }
}

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