/* 竞之景哲 — Galleries index (covers) + album drill-down */
:root {
  --mat: #eeeeee;
  --frame-pad: 10px; /* Alex: border 10px solid #eee */
  --text: #ececec;
  --text-soft: #dddddd;
  --text-muted: #b8b8b8;
  --accent: #e7ad00;
  --lightbox: #111111;
  /*
   * 照片尺寸你已满意：内容区宽度基本不动。
   * 间距单独加大（尤其画册页），略增 max-width 补偿 gap，避免图变小。
   */
  /* 再缩小一档（在 1370 基础上约 0.9） */
  --gap: 44px;
  --album-gap: 56px;
  --side-pad: clamp(22px, 3.2vw, 36px);
  --content-max: min(1230px, calc(100vw - 2 * var(--side-pad)));
  --font-size: 15px;
  /* versioned bg — break CDN/browser 14d cache */
  --site-bg: url("../assets/bg-v53.jpg");
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

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

/* Fixed background: 沙漠之翼 (versioned filename) */
body {
  font-family: system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial,
    "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: var(--font-size);
  line-height: 1.6;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-color: #0a0a0a;
  background-image: var(--site-bg);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -10;
  background: #0a0a0a var(--site-bg) center center / cover no-repeat;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -9;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0.14) 45%,
    rgba(0, 0, 0, 0.32) 100%
  );
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* Header */
.site-header {
  padding: 40px 24px 20px;
  text-align: center;
}

/*
 * International wordmark (portfolio standard):
 *   JINGZHE          ← Latin primary
 *   ────────         ← thin gold rule
 *   竞之景哲         ← Chinese secondary
 * Clean, bilingual, no decorative mountain.
 */
.logo-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-decoration: none;
  color: #f3f1ec;
  transition: opacity 160ms ease, color 160ms ease;
}

.logo-link:hover {
  color: #ffffff;
  opacity: 0.95;
}

.logo-link:hover .logo-rule {
  background: #f0c14d;
}

.logo-en {
  display: block;
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", system-ui, sans-serif;
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 300;
  font-style: normal;
  letter-spacing: 0.55em;
  line-height: 1.15;
  padding-left: 0.55em; /* optical center for tracking */
  text-transform: uppercase;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.4);
}

.logo-rule {
  display: block;
  width: 2.75rem;
  height: 1px;
  margin: 12px auto 10px;
  background: var(--accent);
  opacity: 0.85;
}

.logo-zh {
  display: block;
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  font-size: clamp(13px, 1.7vw, 15px);
  font-weight: 400;
  letter-spacing: 0.55em;
  line-height: 1.3;
  padding-left: 0.55em;
  color: rgba(243, 241, 236, 0.78);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.logo-link:hover .logo-zh {
  color: rgba(255, 255, 255, 0.9);
}

.tagline {
  margin-top: 14px;
  font-size: 10px;
  letter-spacing: 0.42em;
  color: var(--accent);
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 36px;
  margin-top: 28px;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.header-nav a.active,
.header-nav a:hover,
.header-nav a:focus-visible {
  color: var(--accent);
}

.header-nav a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 6px;
}

.page-divider {
  max-width: 120px;
  height: 1px;
  margin: 28px auto 0;
  background: rgba(238, 238, 238, 0.28);
}

.page-title {
  text-align: center;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--text-soft);
  margin: 28px 0 2rem;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
}

/* 整页视图切换：主页 / 画册互斥，不叠在下方 */
.page-view[hidden] {
  display: none !important;
}

.page-view--album {
  min-height: 50vh;
}

/* —— Home covers only —— */
.covers-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--side-pad) 3.5rem;
  box-sizing: border-box;
}

.cover-card {
  text-align: center;
  cursor: pointer;
  outline: none;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  width: 100%;
  min-width: 0;
}

.cover-frame {
  /* Alex: 10px solid #eee mat — no heavy shadow that shrinks visual weight */
  background: var(--mat);
  padding: var(--frame-pad);
  line-height: 0;
  box-shadow: none;
  transition: opacity 180ms ease;
}

.cover-frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #1a1a1a;
}

.cover-card:hover .cover-frame {
  opacity: 0.96;
}

.cover-card:focus-visible .cover-frame {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.cover-label {
  margin-top: 22px; /* 图与画名上下间距略加大 */
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.cover-count {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #999;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

/* —— Album full page —— */
.page-view--album {
  max-width: none;
  margin: 0;
  padding: 0;
}

.album-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin: 4px auto 0;
  max-width: var(--content-max);
  padding: 0 var(--side-pad);
}

.album-page-title {
  margin-top: 1rem;
  margin-bottom: 1.75rem;
}

.back-btn {
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(238, 238, 238, 0.35);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}

.back-btn:hover,
.back-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  /* 左右间距不变；上下保留原先「标题」占位，只藏字不缩距 */
  column-gap: var(--album-gap);
  row-gap: calc(var(--album-gap) + 42px);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--side-pad) 3.5rem;
  box-sizing: border-box;
}

.photo-card {
  text-align: center;
  cursor: pointer;
  outline: none;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  width: 100%;
  min-width: 0;
}

.photo-frame {
  position: relative;
  background: var(--mat);
  padding: var(--frame-pad);
  line-height: 0;
  box-shadow: none;
  transition: opacity 180ms ease;
}

.photo-chat-badge {
  position: absolute;
  right: calc(var(--frame-pad) + 8px);
  bottom: calc(var(--frame-pad) + 8px);
  padding: 4px 7px;
  background: rgba(10, 10, 10, 0.76);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1;
}

.photo-frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #1a1a1a;
}

/* 竖构图照片：完整显示不裁切，两侧留白与卡纸融为一体（视觉上等于更宽的装裱） */
.photo-card.is-portrait .photo-frame img {
  object-fit: contain;
  background: var(--mat);
}

.photo-card:hover .photo-frame {
  opacity: 0.96;
}

.photo-card:focus-visible .photo-frame {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* 进入画册后不显示照片标题 */
.photo-title {
  display: none;
}

/* About */
.about-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 28px 4rem;
  text-align: center;
  scroll-margin-top: 24px;
}

.about-section h2 {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.14em;
  margin-bottom: 1.25rem;
  color: var(--text-soft);
}

.about-section p {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.85;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.about-section .contact {
  margin-top: 1.5rem;
}

.about-section .contact a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Footer */
.site-footer {
  padding: 1rem 24px 3.5rem;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #aaa;
}

.site-footer em {
  font-style: italic;
}

/* Lightbox */
.lightbox {
  border: none;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  background: var(--lightbox);
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lightbox::backdrop {
  background: rgba(17, 17, 17, 0.98);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  z-index: 70;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #ddd;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms;
}

.lightbox-close {
  top: 18px;
  right: 20px;
  width: 48px;
  height: 48px;
  font-size: 30px;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 26px;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox.has-conversation .lightbox-next {
  right: calc(min(390px, 38vw) + 20px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
  outline: none;
}

.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  outline: 1px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.lightbox-layout {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 5%;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 1;
  transition: opacity 160ms ease;
}

.lightbox-stage img.is-loading {
  opacity: 0.35;
}

.lightbox-stage figcaption {
  display: none;
}

.photo-conversation {
  flex: 0 0 min(390px, 38vw);
  width: min(390px, 38vw);
  height: 100%;
  overflow-y: auto;
  padding: 74px 28px 26px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  background: #161616;
}

.photo-conversation[hidden] {
  display: none;
}

.photo-details-kicker {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.photo-details h2 {
  color: #f2f2f2;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.photo-story {
  margin-top: 14px;
  color: #bdbdbd;
  font-size: 14px;
  line-height: 1.75;
}

.photo-exif {
  display: grid;
  grid-template-columns: minmax(58px, auto) 1fr;
  gap: 7px 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.photo-exif dt {
  color: #7f7f7f;
}

.photo-exif dd {
  color: #d5d5d5;
}

.photo-map {
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #101010;
}

.photo-map[hidden] {
  display: none;
}

.photo-map iframe {
  display: block;
  width: 100%;
  height: 190px;
  border: 0;
  filter: grayscale(0.75) brightness(0.82);
}

.photo-map p {
  padding: 7px 9px;
  color: #858585;
  font-size: 10px;
  letter-spacing: 0.06em;
}

.photo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.photo-links a {
  padding: 7px 10px;
  border: 1px solid rgba(231, 173, 0, 0.45);
  color: var(--accent);
  font-size: 12px;
}

.photo-chat {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.photo-chat-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.photo-chat-heading h3 {
  color: #ededed;
  font-size: 16px;
  font-weight: 500;
}

.photo-chat-heading span {
  color: #707070;
  font-size: 10px;
}

.photo-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 250px;
  margin-top: 14px;
  overflow-y: auto;
}

.chat-message {
  max-width: 92%;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.55;
}

.chat-message--assistant {
  align-self: flex-start;
  background: #222;
  color: #cfcfcf;
}

.chat-message--user {
  align-self: flex-end;
  background: #3a301a;
  color: #f2d889;
}

.photo-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.photo-chat-suggestions button {
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #aaa;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.photo-chat-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.photo-chat-form {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.photo-chat-form input {
  min-width: 0;
  flex: 1;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0;
  outline: none;
  background: #101010;
  color: #e5e5e5;
  font: inherit;
  font-size: 12px;
}

.photo-chat-form input:focus {
  border-color: var(--accent);
}

.photo-chat-form button {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

html.lightbox-open {
  overflow: hidden;
}

.gallery-hint {
  max-width: var(--content-max);
  margin: 1rem auto;
  padding: 12px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--accent);
  border: 1px solid rgba(231, 173, 0, 0.35);
  background: rgba(0, 0, 0, 0.35);
}

/* Responsive — keep images large; do NOT cap grid to 420px */
@media (max-width: 1100px) {
  :root {
    --gap: 44px;
    --album-gap: 56px;
  }
}

@media (max-width: 900px) {
  :root {
    --gap: 36px;
    --album-gap: 44px;
  }
  .covers-grid,
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lightbox.has-conversation {
    overflow-y: auto;
  }
  .lightbox.has-conversation .lightbox-layout {
    flex-direction: column;
    height: auto;
    min-height: 100%;
  }
  .lightbox.has-conversation .lightbox-stage {
    flex: none;
    height: 58vh;
    min-height: 360px;
    padding: 54px 40px 22px;
  }
  .lightbox.has-conversation .lightbox-stage img {
    max-height: calc(58vh - 76px);
  }
  .photo-conversation {
    flex: none;
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 28px 22px 36px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-left: none;
  }
  .lightbox.has-conversation .lightbox-next {
    right: 8px;
  }
}

@media (max-width: 768px) {
  :root {
    --frame-pad: 5px;
    --gap: 28px;
    --album-gap: 32px;
    --side-pad: 16px;
  }
  body { background-attachment: scroll; }
  .cover-label,
  .photo-title { font-size: 15px; } /* Alex mobile title */
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

@media (max-width: 560px) {
  :root {
    --gap: 22px;
    --album-gap: 26px;
    --side-pad: 14px;
    --frame-pad: 4px;
  }
  .covers-grid,
  .photo-grid {
    grid-template-columns: 1fr;
    /* full width of viewport minus side pad — no tiny 420px cap */
    max-width: none;
    padding-bottom: 2.75rem;
  }
  /* Keep 3/2 but slightly taller crop feel via object-fit; reduce visual fatigue */
  .cover-frame img {
    aspect-ratio: 3 / 2;
  }
  .cover-label {
    margin-top: 14px;
    font-size: 16px;
  }
  .cover-count {
    margin-top: 2px;
    font-size: 11px;
  }
  .site-header { padding: 36px 16px 16px; }
  .page-title {
    margin-bottom: 1.35rem;
  }
  .logo-en {
    letter-spacing: 0.4em;
    padding-left: 0.4em;
    font-size: clamp(22px, 6.5vw, 28px);
  }
  .logo-zh {
    letter-spacing: 0.4em;
    padding-left: 0.4em;
  }
}
