/* ==========================================================================
   慢日子 · Slow Days — base.css
   设计变量 / 重置 / 页头页脚 / 通用组件
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  color-scheme: light;

  /* 纸与墨 */
  --paper:      #FAF6EF;
  --paper-2:    #FFFDF9;
  --paper-3:    #F3ECE0;
  --paper-rgb:  250, 246, 239;
  --ink:        #2E2A25;
  --ink-2:      #574F45;
  --ink-3:      #6F685D;
  --line:       #E8DECE;
  --line-2:     #F1E9DC;

  /* 点缀色 */
  --sage:       #7E9B82;
  --sage-soft:  #E6EEE4;
  --clay:       #C4785A;
  --clay-soft:  #F7E5DA;
  --gold:       #D9A441;
  --gold-soft:  #F8EBD2;
  --sky:        #9DB6CC;
  --sky-soft:   #E5EDF4;

  /* 点缀色当「文字」用时换成这几个加深版：
     原来的 --clay/--sage/--gold 做色块没问题，
     当文字只有 1.9–3.3:1，读起来吃力。 */
  --sage-ink:   #4F6B54;
  --clay-ink:   #9A5539;
  --gold-ink:   #8A6320;

  /* 质感 */
  --shadow-1: 0 1px 2px rgba(74, 58, 42, .05), 0 6px 18px rgba(74, 58, 42, .06);
  --shadow-2: 0 2px 6px rgba(74, 58, 42, .06), 0 18px 46px rgba(74, 58, 42, .10);
  --focus:    0 0 0 3px rgba(196, 120, 90, .22);

  /* 尺寸 */
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --r-full: 999px;
  --maxw: 1120px;
  --gap: clamp(20px, 4vw, 40px);

  /* 字体 */
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong",
           "SimSun", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
           "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --latin-serif: Georgia, "Times New Roman", "Songti SC", serif;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);

  /* 纸张颗粒：给整块页面一点手感 */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

/* 暗色：尊重系统设置，也可以手动切换 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:     #1C1A17;
    --paper-2:   #242220;
    --paper-3:   #2C2926;
    --paper-rgb: 28, 26, 23;
    --ink:       #EDE6DA;
    --ink-2:     #BFB6A8;
    --ink-3:     #9C9386;
    --line:      #38332D;
    --line-2:    #302B26;
    --sage:      #8FAE92;
    --sage-soft: #2B332C;
    --clay:      #D68F70;
    --clay-soft: #3A2A23;
    --gold:      #E0B15C;
    --gold-soft: #382F20;
    --sky:       #93AEC6;
    --sky-soft:  #262E36;
    --sage-ink:  #8FAE92;
    --clay-ink:  #D68F70;
    --gold-ink:  #E0B15C;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .22);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .34), 0 18px 46px rgba(0, 0, 0, .34);
    --focus:    0 0 0 3px rgba(214, 143, 112, .28);
    --grain: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:     #1C1A17;
  --paper-2:   #242220;
  --paper-3:   #2C2926;
  --paper-rgb: 28, 26, 23;
  --ink:       #EDE6DA;
  --ink-2:     #BFB6A8;
  --ink-3:     #9C9386;
  --line:      #38332D;
  --line-2:    #302B26;
  --sage:      #8FAE92;
  --sage-soft: #2B332C;
  --clay:      #D68F70;
  --clay-soft: #3A2A23;
  --gold:      #E0B15C;
  --gold-soft: #382F20;
  --sky:       #93AEC6;
  --sky-soft:  #262E36;
  --sage-ink:  #8FAE92;
  --clay-ink:  #D68F70;
  --gold-ink:  #E0B15C;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .22);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .34), 0 18px 46px rgba(0, 0, 0, .34);
  --focus:    0 0 0 3px rgba(214, 143, 112, .28);
  --grain: none;
}

/* ---------- 1.5 各语言的字体 ----------
   中日韩共用汉字，但字形不一样：用中文字体排日文，日本人一眼能看出别扭。
   切到哪种语言，就换哪一套字体。 */
:root[data-lang="ja"] {
  --serif: "Noto Serif JP", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN",
           "MS PMincho", "Songti SC", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic",
           "Meiryo", "Noto Sans JP", "Segoe UI", sans-serif;
}
:root[data-lang="ko"] {
  --serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", "Apple SD Gothic Neo",
           "Songti SC", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo",
           "Noto Sans KR", "Segoe UI", sans-serif;
}
:root[data-lang="ru"] {
  --serif: "PT Serif", "Noto Serif", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PT Sans",
           Arial, sans-serif;
}
:root[data-lang="de"],
:root[data-lang="es"],
:root[data-lang="pt"],
:root[data-lang="en"] {
  --serif: "Noto Serif", Georgia, "Times New Roman", "Songti SC", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
           "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 语言应用之前先不画首屏：HTML 里写的是中文原文，
   不挡一下，英文用户每次刷新都会闪过一屏中文。
   加这个 class 的是 <head> 里那段内联脚本，它自带 2 秒兜底。 */
html.i18n-wait body { visibility: hidden; }

/* ---------- 2. 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-2);
  background-color: var(--paper);
  background-image: var(--grain);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }

/* [hidden] 一定要能盖住组件自己的 display */
[hidden] { display: none !important; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--clay-soft); color: var(--ink); }

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

/* 细滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 3px solid var(--paper);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ---------- 3. 排版与容器 ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(18px, 5vw, 40px);
}

.serif { font-family: var(--serif); }

.section { padding-block: clamp(64px, 9vw, 110px); position: relative; }
.section--tight { padding-block: clamp(48px, 6vw, 76px); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink);
  line-height: 1.35;
}

.section-sub {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
  max-width: 52ch;
}

.section-index {
  font-family: var(--latin-serif);
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  padding-bottom: 6px;
}

/* ---------- 4. 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(var(--paper-rgb), .78);
  -webkit-backdrop-filter: saturate(1.25) blur(14px);
  backdrop-filter: saturate(1.25) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s var(--ease-soft), background .4s var(--ease-soft);
}
.site-header.is-stuck {
  border-bottom-color: var(--line-2);
  background: rgba(var(--paper-rgb), .92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  overflow: hidden;
  flex: none;
  box-shadow: var(--shadow-1);
  transition: transform .5s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
.brand-text {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .18em;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.brand-en {
  font-family: var(--latin-serif);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
  position: relative;
  padding: 8px 15px;
  border-radius: var(--r-full);
  font-size: 14.5px;
  letter-spacing: .08em;
  color: var(--ink-2);
  transition: color .3s var(--ease), background .3s var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--paper-3); }
.nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  border-radius: 2px;
  background: var(--clay);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-full);
  color: var(--ink-2);
  transition: background .3s var(--ease), color .3s var(--ease), transform .5s var(--ease);
}
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .icon-moon { display: none; }

/* ---------- 4.5 语言切换 ---------- */
.lang { position: relative; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 9px 0 11px;
  border-radius: var(--r-full);
  color: var(--ink-2);
  transition: background .3s var(--ease), color .3s var(--ease);
}
.lang-btn:hover,
.lang-btn.is-open { background: var(--paper-3); color: var(--ink); }

.lang-globe { width: 17px; height: 17px; flex: none; }
.lang-current {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  min-width: 1.5em;
  text-align: center;
}
.lang-caret {
  width: 12px;
  height: 12px;
  flex: none;
  opacity: .5;
  transition: transform .35s var(--ease);
}
.lang-btn.is-open .lang-caret { transform: rotate(180deg); }

.lang-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  min-width: 178px;
  padding: 7px;
  border-radius: 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: panelIn .22s var(--ease) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 14px;
  letter-spacing: .02em;
  color: var(--ink-2);
  text-align: left;
  transition: background .22s var(--ease), color .22s var(--ease);
}
.lang-option:hover { background: var(--paper-3); color: var(--ink); }
.lang-option.is-active { background: var(--clay-soft); color: var(--ink); }
.lang-name { font-weight: 500; }

.lang-tick {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--clay-ink);
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.lang-tick svg { width: 100%; height: 100%; }
.lang-option.is-active .lang-tick { opacity: 1; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
}

/* ---------- 5. 通用小件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 26px;
  border-radius: var(--r-full);
  font-size: 15px;
  letter-spacing: .08em;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease),
              background .35s var(--ease), border-color .35s var(--ease), opacity .3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--clay-soft); }
.btn:active { transform: translateY(0) scale(.985); }

.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: transparent;
}
.btn--primary:hover { background: var(--clay); }

.btn--ghost { background: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--paper-3); box-shadow: none; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .4;
  pointer-events: none;
  box-shadow: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ink-2);
  background: var(--paper-3);
  border: 1px solid transparent;
}
.chip--gold { background: var(--gold-soft); color: var(--gold-ink); }

/* 淡入上浮 */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-in { opacity: 1; transform: none; }

.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;
}

/* ---------- 6. 页脚 ---------- */
.site-footer {
  margin-top: clamp(40px, 6vw, 80px);
  padding-block: 48px 40px;
  border-top: 1px solid var(--line-2);
  background: var(--paper);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.footer-word {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .16em;
  color: var(--ink);
}
.footer-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.footer-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: right;
  line-height: 2;
}
.footer-meta a { border-bottom: 1px solid var(--line); transition: color .3s, border-color .3s; }
.footer-meta a:hover { color: var(--clay-ink); border-color: var(--clay-ink); }

/* ---------- 7. 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

@media (max-width: 700px) {
  /* 窄屏只留语言代码，收起地球和箭头，给导航让位 */
  .lang-globe, .lang-caret { display: none; }
  .lang-btn { padding: 0 10px; }
  .brand-text { font-size: 16px; letter-spacing: .12em; }
  .nav { gap: 1px; }
  .nav-link { padding: 7px 9px; font-size: 13.5px; }
}

@media (max-width: 640px) {
  .header-inner { height: 60px; }
  .brand-en { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-meta { text-align: left; }
}
