/* ==========================================================================
   portfolio|视频作品|pt
   风格：editorial — 杂志编排（衬线字 + 刊头 + 序号 + 细分隔线）
   ========================================================================== */

/* ---------- 变量 ---------- */
:root {
  --gap: 30px;   /* 列间距 */
  --vgap: 64px;  /* 行间距 */
  --maxw: 1400px;
  --radius: 2px;

  --bg: #fbfaf7;
  --fg: #14120e;
  --muted: #55524a;
  --faint: #67645b;
  --line: rgba(20, 18, 14, 0.16);
  --surface: #eeebe3;
  --panel: #fffefb;
  --accent: #1b4d3e;

  --serif: Georgia, "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- 刊头 ---------- */
.masthead {
  padding: 88px 0 72px;
  border-bottom: 2px solid var(--fg);
  margin-bottom: 56px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.masthead__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6.4vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  margin: 0;
}

.masthead__intro {
  font-size: clamp(15px, 1.5vw, 17px);
  color: var(--muted);
  max-width: 46ch;
  margin: 0;
}

.masthead__notice {
  font-size: 13px;
  color: var(--faint);
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  max-width: 52ch;
  margin: 0;
}

/* 刊号标记 */
.masthead__mark {
  position: absolute;
  top: 34px;
  right: 32px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--faint);
  text-align: right;
  line-height: 1.8;
}

/* ---------- 网格 ----------
   所有封面统一横屏比例，卡片高度一致，用纯 CSS Grid 即可。
   不需要 JS 计算 masonry：Grid 天然在任何宽度下自适应。 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  column-gap: var(--gap);
  row-gap: var(--vgap);
  padding-bottom: 120px;
  align-items: stretch;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  padding: 0;
  background: none;
}

.card__media {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  background: var(--surface);
  background-size: cover;
  background-position: center;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s var(--ease), transform 0.7s var(--ease);
}

.card__media img.is-loaded { opacity: 1; }

.card:hover .card__media img.is-loaded { transform: scale(1.035); }

.card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0) 55%);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.card:hover .card__play,
.card:focus-visible .card__play { opacity: 1; }

.card__play span {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.card__play svg { width: 20px; height: 20px; fill: #111; margin-left: 3px; }

/* 元信息：贴卡片底部对齐，整行文字基线一致 */
.card__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* 客户名：占据原标题的位置与样式（衬线大字） */
.card__client {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  gap: 9px;
}

/* 序号：小号等宽字，作为前缀 */
.card__client::before {
  content: counter(work, decimal-leading-zero);
  counter-increment: work;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--accent);
  transform: translateY(-2px);
}

.grid { counter-reset: work; }

/* 作品名：放在客户名下方，小号等宽字 */
.card__name {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}

/* 待补充素材的作品：低调斜纹占位 */
.card--pending .card__media {
  display: grid;
  place-items: center;
}

.card--pending .card__pending {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.card--pending .card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    var(--line) 10px,
    var(--line) 11px
  );
  opacity: 0.4;
}

.card--pending .card__client { color: var(--muted); }
.card--pending:hover .card__client { color: var(--fg); }

/* ---------- 详情弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 18, 14, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s var(--ease), visibility 0s;
}

.modal__panel {
  position: relative;
  width: min(1080px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border-radius: 4px;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  transform: translateY(14px);
  transition: transform 0.35s var(--ease);
}

.modal.is-open .modal__panel { transform: none; }

.modal__stage {
  background: #0a0a0a;
  display: grid;
  place-items: center;
  min-height: 240px;
  width: 100%;
  padding: 0;
}

/* 本地视频：尺寸由 <video> 的 width/height 属性决定（表现性提示），
   这里只做等比约束。不要在 CSS 里写 width/height —— 那会覆盖掉属性，
   导致竖屏视频被塞成横屏。 */
.modal__stage video {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #0a0a0a;
}

/* 第三方播放器（Wistia 等）：固定 16:9 */
.modal__stage iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #0a0a0a;
}

.modal__stage__note {
  padding: 60px 24px;
  text-align: center;
  color: #8a8a8a;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.modal__side {
  padding: 34px 30px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid var(--line);
}

.modal__side h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.modal__client {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.modal__dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  margin: 0;
  font-size: 14px;
}

.modal__dl dt { color: var(--faint); margin: 0; }
.modal__dl dd { margin: 0; color: var(--fg); }

.modal__summary {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.78;
}

.modal__highlights {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}

.modal__highlights li { margin-bottom: 6px; }
.modal__highlights li:last-child { margin-bottom: 0; }

.modal__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.modal__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 14px;
  transition: border-color 0.25s, background-color 0.25s;
}

.modal__link:hover { border-color: var(--accent); background: var(--surface); }
.modal__link span:last-child { color: var(--faint); }

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(20, 18, 14, 0.62);
  color: #fff;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  font-size: 19px;
  line-height: 1;
}

.modal__close:hover { background: rgba(20, 18, 14, 0.85); }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 60px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 13px;
  color: var(--faint);
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 860px) {
  .wrap { padding: 0 20px; }
  .masthead { padding: 64px 0 44px; margin-bottom: 40px; }
  .masthead__mark { display: none; }
  .grid { column-gap: 16px; row-gap: 40px; }
  .modal { padding: 0; }
  .modal__panel {
    grid-template-columns: 1fr;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
    border: 0;
  }
  .modal__stage { min-height: 0; }
  .modal__stage video { max-height: 56vh; }
  .modal__side { padding: 26px 20px 40px; border-left: 0; border-top: 1px solid var(--line); }
  .footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .card__client { font-size: 19px; }
}

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