:root {
  color-scheme: light;
  font-family: ui-rounded, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #4f3b3c;
  background: #fff7e8;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #fff7e8;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 12%, rgb(255 210 217 / 72%) 0 7rem, transparent 7.1rem),
    radial-gradient(circle at 92% 18%, rgb(200 236 255 / 75%) 0 8rem, transparent 8.1rem),
    linear-gradient(150deg, #fff8e9 0%, #fff3ed 42%, #f3f3ff 100%);
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.portal-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding:
    max(28px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(40px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

.portal-header {
  margin: 0 auto 28px;
  text-align: center;
}

.portal-kicker {
  display: inline-block;
  margin-bottom: 6px;
  color: #e07878;
  font-size: clamp(0.88rem, 2vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.portal-header h1 {
  margin: 0;
  color: #51405f;
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.18;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.portal-header p {
  margin: 10px 0 0;
  color: #806a72;
  font-size: clamp(1rem, 2.8vw, 1.25rem);
  font-weight: 600;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 30px);
}

.project-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  min-height: 160px;
  overflow: hidden;
  border: 5px solid rgb(255 255 255 / 92%);
  border-radius: clamp(22px, 3vw, 32px);
  outline: none;
  background: linear-gradient(135deg, #bfe6ff, #ffd5de);
  box-shadow:
    0 16px 34px rgb(94 73 84 / 18%),
    inset 0 0 0 1px rgb(84 56 71 / 8%);
  color: #fff;
  text-decoration: none;
  touch-action: manipulation;
  transform: translateY(0) scale(1);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.project-card::after {
  position: absolute;
  inset: auto 0 0;
  height: 48%;
  content: "";
  background: linear-gradient(to bottom, transparent, rgb(43 34 48 / 78%));
  pointer-events: none;
}

.project-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.002);
}

.project-card__title {
  position: absolute;
  z-index: 1;
  right: 18px;
  bottom: 16px;
  left: 18px;
  color: #fff;
  font-size: clamp(1.35rem, 3.5vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-align: center;
  text-shadow: 0 2px 8px rgb(30 21 36 / 62%);
}

.project-card:hover {
  transform: translateY(-5px) scale(1.012);
  box-shadow:
    0 22px 44px rgb(94 73 84 / 24%),
    inset 0 0 0 1px rgb(84 56 71 / 8%);
}

.project-card:active {
  transform: translateY(1px) scale(0.985);
}

.project-card:focus-visible {
  outline: 6px solid #ffb438;
  outline-offset: 5px;
}

.project-card--image-missing::before {
  position: absolute;
  inset: 20% 0 auto;
  content: "✦";
  color: rgb(255 255 255 / 78%);
  font-size: clamp(3rem, 9vw, 6rem);
  text-align: center;
}

.load-error {
  width: min(100%, 460px);
  margin: 28px auto 0;
  padding: 22px;
  border: 3px solid #fff;
  border-radius: 24px;
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 12px 30px rgb(94 73 84 / 12%);
  color: #664f55;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.load-error p {
  margin: 0 0 14px;
}

.load-error button {
  min-width: 140px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: #ffbd54;
  color: #513b32;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 6px 0 #dd9341;
}

.load-error button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #dd9341;
}

.load-error button:focus-visible {
  outline: 4px solid #6951a5;
  outline-offset: 4px;
}

.portal-footer {
  padding: 0 24px max(20px, env(safe-area-inset-bottom));
  color: #806a72;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
}

.portal-footer a {
  color: inherit;
  text-decoration: none;
}

.portal-footer a:hover,
.portal-footer a:focus-visible {
  color: #51405f;
  text-decoration: underline;
}

.portal-footer a:focus-visible {
  outline: 3px solid #ffb438;
  outline-offset: 4px;
}

@media (max-width: 680px) {
  .portal-shell {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .portal-header {
    margin-bottom: 22px;
  }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .project-card {
    border-width: 4px;
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card {
    scroll-behavior: auto;
    transition: none;
  }

  .project-card:hover,
  .project-card:active {
    transform: none;
  }
}
