/* ============================================================
   OEDIPHATIA — 衬线排版系统
   字标与拉丁标题：Trajanus Roman
   中文与正文：明朝汇文体（Huiwen Mincho）
   结构：一条栅格、一套细线、大片留白；玻璃只出现在顶栏与手机菜单
   ============================================================ */

@font-face {
  font-family: "Trajanus Roman";
  src: url("fonts/trajanus-roman.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Huiwen Mincho";
  src: url("fonts/huiwen-mincho.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #111;
  --ink-2: #3a3a3a;
  --ink-3: #6f6f6f;
  --paper: #fff;
  --rule: #1a1a1a;
  --hair: #d9d9d9;
  --glass: rgba(255, 255, 255, 0.82);

  --latin: "Trajanus Roman", "Huiwen Mincho", "Times New Roman", serif;
  --serif: "Huiwen Mincho", "Noto Serif SC", "Source Han Serif SC",
    "Songti SC", STSong, "Times New Roman", serif;

  --page: 1180px;
  --edge: clamp(22px, 7vw, 130px);
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1 0 auto; }

::selection { background: var(--ink); color: #fff; }

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.wrap {
  width: 100%;
  max-width: calc(var(--page) + var(--edge) * 2);
  margin: 0 auto;
  padding-inline: var(--edge);
}

/* 链接下划线：从左向右长出来 */
.link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size 0.4s var(--ease);
  padding-bottom: 2px;
}

.link:hover,
.link:focus-visible { background-size: 100% 1px; }

/* ---------- 顶栏 ---------- */

.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 28px var(--edge);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), padding 0.4s var(--ease),
    border-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}

.masthead.is-stuck {
  padding-block: 15px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.brand {
  font-family: var(--latin);
  font-size: clamp(15px, 1.85vw, 27px);
  letter-spacing: 0.2em;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  font-size: clamp(13px, 1.25vw, 18px);
  letter-spacing: 0.1em;
}

.nav a {
  position: relative;
  z-index: 1;
  padding: 4px 0;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size 0.4s var(--ease);
}

.nav a:hover { background-size: 100% 1px; }

.nav__sep {
  display: block;
  width: 1px;
  height: 0.85em;
  margin: 0 20px;
  background: rgba(0, 0, 0, 0.38);
}

.nav a[aria-current="page"] { background-size: 100% 1px; }

.menu-toggle {
  display: none;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
}

/* ---------- 手机菜单 ---------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 96px var(--edge);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  animation: veil 0.32s var(--ease);
}

.menu[hidden] { display: none; }

.menu nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 30px;
  font-size: 30px;
  letter-spacing: 0.06em;
}

.menu nav a {
  opacity: 0;
  animation: slide-in 0.5s var(--ease) forwards;
}

.menu nav a:nth-child(1) { animation-delay: 0.06s; }
.menu nav a:nth-child(2) { animation-delay: 0.12s; }
.menu nav a:nth-child(3) { animation-delay: 0.18s; }
.menu nav a:nth-child(4) { animation-delay: 0.24s; }

body.is-locked { overflow: hidden; }

@keyframes veil { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 首页 ---------- */

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(210px, 26%, 360px);
  grid-template-rows: auto auto;
  column-gap: clamp(36px, 6vw, 96px);
  padding-block: clamp(150px, 16vh, 214px) 110px;
}

.home__text { grid-column: 1; grid-row: 1; }

.display {
  margin: 0;
  font-family: var(--latin);
  font-size: clamp(50px, 6.3vw, 96px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: 0.015em;
  white-space: nowrap;
  text-transform: uppercase;
}

.tagline {
  margin: 32px 0 0;
  font-family: var(--latin);
  font-size: clamp(13px, 1.68vw, 24px);
  letter-spacing: 0.05em;
  line-height: 1.65;
  color: var(--ink-2);
}

@media (min-width: 1200px) {
  .tagline { white-space: nowrap; }
}

.figure {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
  margin: 10px 0 0;
}

.figure img {
  position: sticky;
  top: 112px;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 0.42;
  object-fit: cover;
  object-position: 50% 45%;
  opacity: 0;
  animation: reveal 1.1s var(--ease) 0.1s forwards;
}

@keyframes reveal { to { opacity: 1; } }

.home__list {
  grid-column: 1;
  grid-row: 2;
  margin-top: clamp(38px, 5vw, 62px);
}

/* ---------- 最近更新 ---------- */

.section-label {
  margin: 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: clamp(15px, 1.45vw, 20px);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.rows { margin-top: 26px; }

.row {
  display: grid;
  grid-template-columns: clamp(84px, 8.6vw, 122px) minmax(0, 1fr);
  gap: clamp(18px, 2.4vw, 30px);
  padding: clamp(24px, 3vw, 34px) 0 clamp(26px, 3.2vw, 38px);
}

.rows > .row:first-child { border-top: 1px solid var(--rule); }

.row + .row { border-top: 1px solid var(--rule); }

.row__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 0.71;
  overflow: hidden;
  background: #f2f0eb;
  transform: perspective(760px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.28s ease-out, box-shadow 0.5s var(--ease);
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}

.row:hover .row__media {
  box-shadow:
    0 26px 48px -30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.row__glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  background:
    radial-gradient(
      64px circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 0.55),
      rgba(255, 255, 255, 0) 74%
    ),
    linear-gradient(
      118deg,
      rgba(255, 255, 255, 0) 34%,
      rgba(255, 255, 255, 0.3) 50%,
      rgba(255, 255, 255, 0) 66%
    );
}

.row:hover .row__glare { opacity: 1; }

.row__swatch {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--cover, #ddd8cc);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
  transition: transform 0.6s var(--ease);
}

.row:hover .row__swatch { transform: scale(1.02); }

.row__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.row:hover .row__img { transform: scale(1.03); }

.row__body { min-width: 0; }

.row__title {
  margin: 0;
  font-size: clamp(18px, 1.75vw, 26px);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

.row__title a {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size 0.45s var(--ease);
  padding-bottom: 2px;
}

.row:hover .row__title a,
.row__title a:hover { background-size: 100% 1px; }

.row__sub {
  margin: 9px 0 0;
  font-size: clamp(14px, 1.4vw, 20px);
  line-height: 1.75;
  color: var(--ink-2);
}

.row__date {
  margin: 14px 0 0;
  font-size: clamp(13px, 1.3vw, 19px);
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.more {
  margin: 44px 0 0;
  font-size: 15px;
  letter-spacing: 0.04em;
}

/* ---------- 栏目页 ---------- */

.index { padding-block: clamp(120px, 12vh, 176px) 130px; }

.index__title {
  margin: 16px 0 0;
  font-family: var(--latin);
  font-size: clamp(38px, 4.4vw, 62px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.index__desc {
  margin: 16px 0 0;
  font-size: clamp(14px, 1.35vw, 18px);
  color: var(--ink-2);
}

.index__list { margin-top: clamp(44px, 5vw, 72px); }

/* ---------- 文章 ---------- */

.post {
  max-width: calc(880px + var(--edge) * 2);
  padding-block: clamp(120px, 12vh, 176px) 120px;
}

/* ---------- 关于：正文 + 右侧照片 ---------- */

.about {
  max-width: calc(920px + var(--edge) * 2);
  padding-block: clamp(120px, 12vh, 176px) 120px;
}

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 30%, 360px);
  column-gap: clamp(40px, 6vw, 88px);
  align-items: start;
  margin-top: 50px;
}

.about__grid .prose { margin-top: 0; }

.about__photo {
  margin: 0;
  position: sticky;
  top: 120px;
}

.about__photo img {
  display: block;
  width: 100%;
  height: auto;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--ink-3);
}

.post__title {
  margin: 20px 0 0;
  font-size: clamp(28px, 3.1vw, 40px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.post__sub {
  margin: 12px 0 0;
  font-size: 18px;
  color: var(--ink-2);
}

.post__meta {
  margin: 18px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.prose {
  margin-top: 50px;
  font-size: 17px;
  line-height: 1.95;
}

.prose p { margin: 0 0 26px; }

.prose h2 {
  margin: 60px 0 18px;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.55;
}

.prose h3 {
  margin: 42px 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.prose ul,
.prose ol { margin: 0 0 26px; padding-left: 22px; }

.prose li { margin: 8px 0; }

.prose blockquote {
  margin: 32px 0;
  padding: 2px 0 2px 24px;
  border-left: 1px solid var(--rule);
  color: var(--ink-2);
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  margin: 54px 0;
  border: 0;
  border-top: 1px solid var(--hair);
}

.prose img { max-width: 100%; height: auto; display: block; margin: 34px 0; }

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #f2f2f2;
  padding: 2px 5px;
}

.prose pre {
  margin: 30px 0;
  padding: 22px;
  background: var(--ink);
  color: #f5f5f5;
  overflow-x: auto;
  line-height: 1.7;
}

.prose pre code { background: none; padding: 0; font-size: 13.5px; }

.prose a.link { padding-bottom: 1px; }

.back {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 34px;
  margin-top: 68px;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.empty { color: var(--ink-3); font-size: 15px; }

/* ---------- 页脚 ---------- */

.foot {
  border-top: 1px solid var(--hair);
  padding-block: 26px 48px;
}

.foot__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

.foot__copy { margin: 0; font-family: var(--latin); }

.foot__nav { display: flex; gap: 24px; }

.foot__nav a { transition: color 0.3s var(--ease); }

.foot__nav a:hover { color: var(--ink); }

/* ---------- 跳转链接 ---------- */

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
}

.skip:focus { top: 16px; }

/* ---------- 跟随指针的圆形玻璃 ---------- */

.lens {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 59px;
  height: 59px;
  margin: -29.5px 0 0 -29.5px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 46%),
    rgba(255, 255, 255, 0.015);
  -webkit-backdrop-filter: blur(3px) saturate(1.15) contrast(1.12);
  backdrop-filter: blur(3px) saturate(1.15) contrast(1.12);
  box-shadow:
    0 12px 24px -16px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -7px 13px -10px rgba(0, 0, 0, 0.14);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: none;
  transform: translate3d(-200px, -200px, 0);
}

.lens.is-on { opacity: 1; }

@media (hover: none), (prefers-reduced-motion: reduce) {
  .lens { display: none; }
}

/* ---------- 页面切换：柔和的淡入过渡 ---------- */

@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: vt-out 0.3s var(--ease) both;
}

::view-transition-new(root) {
  animation: vt-in 0.42s var(--ease) both;
}

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 不支持 View Transitions 的浏览器退回整页淡入 */
@supports not (view-transition-name: none) {
  main { animation: vt-in 0.5s var(--ease) both; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  .display { white-space: nowrap; font-size: clamp(44px, 7.6vw, 92px); }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .menu-toggle { display: block; }

  .home {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding-block: 118px 84px;
  }

  .home__text { grid-row: 1; }

  .figure {
    grid-column: 1;
    grid-row: 2;
    margin-top: 44px;
  }

  .figure img {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
  }

  .home__list {
    grid-row: 3;
    margin-top: 56px;
  }

  .post { padding-block: 118px 92px; }

  .index { padding-block: 118px 92px; }

  .about { padding-block: 118px 92px; }

  .about__grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 44px;
    margin-top: 40px;
  }

  .about__photo {
    position: static;
    order: -1;
    max-width: 300px;
  }

  .foot__inner { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 560px) {
  .display { font-size: 9.9vw; letter-spacing: 0.01em; }
  .tagline { font-size: 11.5px; letter-spacing: 0.16em; margin-top: 24px; }
  .row { grid-template-columns: 88px minmax(0, 1fr); gap: 18px; }
  .post__title { font-size: 26px; }
  .prose { font-size: 16px; line-height: 1.95; }
  .prose pre { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .masthead, .menu, .foot__nav, .skip { display: none; }
  body { font-size: 12pt; }
  .post { padding-block: 0; max-width: none; }
}
