/* ============================================================
   yunxstudio — 全站共用样式
   ============================================================ */

/* ---------- 字体 ---------- */
@font-face {
  font-family: "MiSans";
  src: url("../MiSansVF.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f7f7f7;
  --ink: #111111;
  --ink-soft: #6f6f6d;
  --line: #e3e3e1;
  --nav-bg: rgba(247, 247, 247, .82);
  --hover: rgba(0, 0, 0, .06);
  --frame-bg: #ececec;
  --danger: #c0392b;
  --nav-h: 58px;
  --pad: 26px;
}

html[data-theme="dark"] {
  --bg: #0d0d0d;
  --ink: #f2f2f1;
  --ink-soft: #8b8b88;
  --line: #242423;
  --nav-bg: rgba(13, 13, 13, .82);
  --hover: rgba(255, 255, 255, .10);
  --frame-bg: #191919;
  --danger: #e06a5c;
}

* { box-sizing: border-box; }

/* display 会覆盖 hidden 属性的默认行为，这里强制一次 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: "MiSans", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  transition: background-color .35s ease, color .35s ease;
  animation: page-in .7s ease both;
}

@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

img { -webkit-user-drag: none; }

/* ============================================================
   导航栏
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--nav-h);
  padding: 0 var(--pad);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  font-size: 12.5px;
  letter-spacing: .01em;
  user-select: none;
  transition: background-color .35s ease;
}

.brand {
  justify-self: start;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: opacity .2s ease;
}
.brand:hover { opacity: .55; }

.clock {
  justify-self: center;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--ink);
  white-space: nowrap;
}
.clock__zone {
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: .04em;
}

.nav__links {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav__link {
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 4px 0;
  transition: color .18s ease;
}
.nav__link:hover { color: var(--ink); }

.nav__link.is-active {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- 深浅色切换 ---------- */
.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s ease;
}
.theme-toggle:hover { background: var(--hover); }
.theme-toggle:focus-visible {
  outline: 1px solid var(--ink-soft);
  outline-offset: 2px;
}

.theme-toggle img {
  /* 两个图标叠在同一个网格格里，靠 place-items 居中；
     不要用 absolute，否则会脱离居中布局、贴到左上 */
  grid-area: 1 / 1;
  width: 15px;
  height: 15px;
  object-fit: contain;
  transition: opacity .25s ease, transform .35s cubic-bezier(.4, 0, .2, 1);
}

.theme-toggle__to-light {
  opacity: 0;
  transform: rotate(-90deg) scale(.6);
}
html[data-theme="dark"] .theme-toggle img { filter: invert(1); }
html[data-theme="dark"] .theme-toggle__to-dark {
  opacity: 0;
  transform: rotate(90deg) scale(.6);
}
html[data-theme="dark"] .theme-toggle__to-light {
  opacity: 1;
  transform: none;
}

/* ============================================================
   主页 — 两列画框
   ============================================================ */
.stage {
  min-height: calc(100vh - var(--nav-h));
  padding: var(--pad);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 20px;
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.card__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--frame-bg);
  transition: background-color .35s ease;
}

.card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .65s cubic-bezier(.22, .61, .36, 1);
}

.card:hover .card__frame img { transform: scale(1.035); }
.card:active .card__frame img { transform: scale(1.01); }

.card__meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 1px 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  letter-spacing: .02em;
}

.card__idx {
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
}

.card__title {
  color: var(--ink);
  transition: opacity .2s ease;
}
.card:hover .card__title { opacity: .6; }

.card__right {
  margin-left: auto;
  white-space: nowrap;
}

/* 空状态 */
.empty {
  margin: 0;
  padding: 26vh 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ============================================================
   作品详情页
   ============================================================ */
.detail {
  padding: var(--pad);
  padding-bottom: 90px;
  max-width: 1400px;
  margin: 0 auto;
}

.back {
  display: inline-block;
  margin-bottom: 24px;
  padding: 3px 0;
  font-size: 13.5px;
  letter-spacing: .02em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .2s ease, opacity .2s ease;
}
.back:hover { color: var(--ink); }

.detail__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.detail__title {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.detail__meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.detail__gallery {
  display: grid;
  gap: 14px;
}

/* 图片按自身像素显示：大图缩到容器宽，小图保持原尺寸不放大（放大一定会糊） */
.detail__gallery img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
  background: var(--frame-bg);
}

.detail__desc {
  max-width: 62ch;
  margin: 26px 0 0;
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

/* ============================================================
   页脚 — 备案信息
   ============================================================ */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 18px;
  padding: 14px var(--pad) 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .05em;
  color: var(--ink-soft);
  text-align: center;
  transition: border-color .35s ease;
}

.footer a {
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.footer a:hover { color: var(--ink); }

/* ============================================================
   通用表单控件（后台 / 口令门共用）
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: opacity .2s ease, background-color .2s ease, color .2s ease;
}
.btn:hover { opacity: .78; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover {
  opacity: 1;
  border-color: var(--ink);
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn--danger:hover { opacity: 1; text-decoration: underline; }

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 0;
  outline: none;
  transition: border-color .2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus,
.textarea:focus,
.select:focus { border-color: var(--ink); }

.textarea {
  min-height: 96px;
  resize: vertical;
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  :root { --pad: 16px; --nav-h: 54px; }

  /* 窄屏放不下时钟，先收起来，避免导航溢出把整页撑宽 */
  .clock { display: none; }
  .nav {
    grid-template-columns: auto 1fr;
    font-size: 12px;
  }
  .nav__links { gap: 14px; }
  .brand { font-size: 12px; }

  .grid { grid-template-columns: 1fr; gap: 28px; }
  .card__meta { font-size: 11px; }
}

@media (max-width: 420px) {
  .nav__links { gap: 11px; }
}
