/* ==========================================================================
   多多28主站 · 共享样式表 /assets/site.css
   骨架：技术蓝图侧轨 + 奶油纸白连续画布
   ========================================================================== */

/* 1. Reset ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, ul, ol, dl, dd {
  margin: 0;
}

ul, ol { list-style: none; padding: 0; }

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

button, input, select, textarea { font: inherit; color: inherit; }

button { background: none; border: 0; padding: 0; }

table { border-collapse: collapse; width: 100%; }

[hidden] { display: none !important; }

/* 2. Tokens --------------------------------------------------------------- */
:root {
  --paper: #FAF7F2;
  --mist: #F2F5F7;
  --ink: #16202B;
  --brown: #2E2A26;
  --blue: #1E90FF;
  --blue-soft: #A9D6FF;
  --mint: #2EE6A8;
  --mint-soft: #CFF7E8;
  --orange: #FF8C42;
  --green-ink: #0F5D45;
  --brick: #C8452F;

  --line: #E4E7EA;
  --line-strong: #C9D3DB;

  --rail-w: 160px;
  --maxw: 1240px;
  --measure: 36em;
  --header-h: 62px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow-low: 0 1px 2px rgba(22, 32, 43, .05), 0 10px 28px -22px rgba(22, 32, 43, .45);

  --font-sans: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* 3. Base typography ------------------------------------------------------ */
body {
  font-family: var(--font-sans);
  font-size: clamp(16px, .34vw + 15px, 17.5px);
  font-weight: 400;
  line-height: 1.8;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 1.2rem + 3.6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 1.1rem + 1.7vw, 2.125rem); }
h3 { font-size: clamp(1.2rem, 1.02rem + .7vw, 1.5rem); }
h4 { font-size: clamp(1.05rem, .98rem + .35vw, 1.2rem); }

p { max-width: var(--measure); }

strong, b { font-weight: 700; }

a { color: inherit; text-decoration: none; }

.link {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  transition: color .16s var(--ease);
}
.link:hover { color: var(--green-ink); }

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

.site-footer :focus-visible { outline-color: var(--mint); }

/* 4. Skip link ------------------------------------------------------------ */
.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

/* 5. Buttons -------------------------------------------------------------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--btn-bd);
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .01em;
  text-align: center;
  cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease),
    background-color .16s var(--ease), border-color .16s var(--ease),
    color .16s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  --btn-bg: var(--orange);
  --btn-fg: #231207;
  --btn-bd: transparent;
  box-shadow: 0 12px 24px -16px rgba(255, 140, 66, .95);
}
.btn-primary:hover { --btn-bg: #ff7c26; }

.btn-mint {
  --btn-bg: var(--mint);
  --btn-fg: #06301F;
  --btn-bd: transparent;
}
.btn-mint:hover { --btn-bg: #1ed698; }

.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line-strong); }
.btn-ghost:hover { --btn-fg: var(--blue); --btn-bd: var(--blue); background: var(--mist); }

.btn-block { width: 100%; }

/* 6. Header shell --------------------------------------------------------- */
.site-header { position: relative; z-index: 80; }

.progress-rail {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: rgba(22, 32, 43, .07);
  z-index: 120;
  pointer-events: none;
}
.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--mint));
  transition: width .12s linear;
}

/* 6.1 侧边轨道 */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px 20px 24px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rail::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(22, 32, 43, .055) 0 1px,
    transparent 1px 44px
  );
  pointer-events: none;
}
.rail > * { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.rail .brand { flex-direction: column; align-items: flex-start; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.04em;
  box-shadow: 0 10px 20px -14px rgba(30, 144, 255, .95);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-size: 14px; font-weight: 900; letter-spacing: -.01em; }
.brand-tagline { font-size: 11px; color: var(--brown); opacity: .72; }

.rail-coord {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--brown);
  opacity: .7;
  max-width: none;
}

.rail-nav { display: block; }
.rail-list { display: flex; flex-direction: column; gap: 2px; }

.rail-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 9px 9px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--brown);
  transition: background-color .16s var(--ease), color .16s var(--ease),
    border-color .16s var(--ease);
}
.rail-link:hover { background: var(--mist); color: var(--blue); }
.rail-link[aria-current="page"] {
  background: var(--mint-soft);
  border-left-color: var(--blue);
  color: var(--green-ink);
  font-weight: 700;
}

.rail-idx {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  opacity: .5;
}
.rail-link:hover .rail-idx { opacity: 1; color: var(--blue); }
.rail-link[aria-current="page"] .rail-idx { opacity: 1; color: var(--green-ink); }

.rail-label { white-space: nowrap; }

.rail-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rail-actions .btn { padding: 10px 12px; font-size: 13px; }

.rail-version {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.65;
  letter-spacing: .05em;
  color: var(--brown);
  opacity: .62;
  max-width: none;
}

.rail-quick {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  transition: background-color .16s var(--ease);
}
.rail-quick:hover { background: #0b4c38; }

/* 6.2 遮罩 */
.rail-scrim {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(22, 32, 43, .44);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s var(--ease), visibility .2s linear;
}
.site-header[data-open="true"] .rail-scrim {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 6.3 移动顶栏 */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-h);
  padding: 0 16px;
}

.topbar-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.topbar-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.topbar-name { font-size: 15px; font-weight: 900; letter-spacing: -.01em; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.nav-toggle:hover { border-color: var(--blue); color: var(--blue); }

.nav-toggle-bars { display: inline-flex; flex-direction: column; gap: 4px; width: 16px; }
.nav-toggle-bars span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: currentColor;
  transition: transform .18s var(--ease);
}
.site-header[data-open="true"] .nav-toggle-bars span:first-child {
  transform: translateY(3px) rotate(45deg);
}
.site-header[data-open="true"] .nav-toggle-bars span:last-child {
  transform: translateY(-3px) rotate(-45deg);
}
.nav-toggle-text { white-space: nowrap; }

/* 7. Footer --------------------------------------------------------------- */
.site-footer {
  position: relative;
  overflow: hidden;
  background: var(--green-ink);
  color: var(--paper);
}
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(250, 247, 242, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(250, 247, 242, .055) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}
.site-footer > .container { position: relative; z-index: 1; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr .8fr .8fr .8fr;
  gap: 34px;
  padding: 58px 0 42px;
}

.footer-brand { display: flex; flex-direction: column; align-items: flex-start; }

.footer-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--mint);
  color: #06301F;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.04em;
}

.footer-name {
  margin-top: 16px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--paper);
}

.footer-line {
  margin-top: 8px;
  max-width: 26em;
  font-size: 13.5px;
  line-height: 1.8;
  color: rgba(250, 247, 242, .72);
}

.footer-contact { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

.footer-contact-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 13px;
  line-height: 1.75;
}

.footer-label {
  padding-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--mint);
}

.footer-value { color: rgba(250, 247, 242, .82); }

.copy-btn {
  padding: 0 0 2px;
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  word-break: break-all;
  border-bottom: 1px dashed rgba(250, 247, 242, .4);
  cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.copy-btn:hover { color: var(--mint); border-bottom-color: var(--mint); }
.copy-btn[data-copied="true"] { color: var(--mint); border-bottom-color: var(--mint); }

.footer-col { display: flex; flex-direction: column; gap: 12px; }

.footer-col-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--mint);
  max-width: none;
}

.footer-links { display: flex; flex-direction: column; gap: 9px; }

.footer-link {
  display: inline-block;
  font-size: 14px;
  color: rgba(250, 247, 242, .82);
  padding: 2px 0;
  transition: color .16s var(--ease), transform .16s var(--ease);
}
.footer-link:hover { color: var(--mint); transform: translateX(3px); }
.footer-link[aria-current="page"] { color: var(--mint); font-weight: 700; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding: 18px 0 28px;
  border-top: 1px solid rgba(250, 247, 242, .16);
}
.footer-legal,
.footer-meta {
  max-width: none;
  font-size: 12px;
  color: rgba(250, 247, 242, .68);
}
.footer-legal { font-family: var(--font-mono); letter-spacing: .06em; }

/* 8. Layout helpers ------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

.section { padding: clamp(56px, 8vw, 96px) 0; }
.section--mist { background-color: var(--mist); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 22px;
  margin-bottom: clamp(24px, 3vw, 40px);
}
.section-head h2 { flex: 1 1 20ch; }

.section-index {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--blue);
  max-width: none;
}

.prose { max-width: 44em; }
.prose p + p { margin-top: .9em; }

.grid { display: grid; gap: clamp(18px, 2.4vw, 28px); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 9. Bits & pieces -------------------------------------------------------- */
.media-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background-color: var(--mist);
  background-image: linear-gradient(135deg, #E8F3FF 0%, #E6FBF2 58%, #FAF7F2 100%);
  aspect-ratio: 16 / 10;
}
.media-frame > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-frame[data-ratio="1:1"] { aspect-ratio: 1 / 1; }
.media-frame[data-ratio="4:3"] { aspect-ratio: 4 / 3; }
.media-frame[data-ratio="3:4"] { aspect-ratio: 3 / 4; }
.media-frame[data-ratio="21:9"] { aspect-ratio: 21 / 9; }

.index-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(15, 93, 69, .16);
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--green-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
}

.tag {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--brown);
  font-size: 12px;
  letter-spacing: .02em;
}

.coord {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brown);
  opacity: .72;
  max-width: none;
}

.rot-note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--brown);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-width: none;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .42s var(--ease), transform .42s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  box-shadow: var(--shadow-low);
  transition: opacity .2s var(--ease), visibility .2s linear,
    transform .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; }
.to-top:hover { transform: translateY(-2px); border-color: var(--blue); color: var(--blue); }

/* 10. Responsive ---------------------------------------------------------- */
@media (min-width: 1024px) {
  body { padding-left: var(--rail-w); }

  .topbar { display: none; }
  .rail-scrim { display: none; }

  .site-footer {
    margin-left: calc(-1 * var(--rail-w));
    padding-left: var(--rail-w);
  }
}

@media (max-width: 1023px) {
  .site-header {
    position: sticky;
    top: 0;
    padding-top: 3px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  .topbar { display: flex; }

  .rail {
    width: min(304px, 86vw);
    padding: 26px 20px 28px;
    transform: translateX(-103%);
    transition: transform .22s var(--ease), box-shadow .22s var(--ease);
    z-index: 96;
  }
  .site-header[data-open="true"] .rail {
    transform: translateX(0);
    box-shadow: 24px 0 56px -34px rgba(22, 32, 43, .7);
  }

  .rail::before { opacity: .5; }
  .rail-coord { display: none; }
  .rail-actions { margin-top: 22px; }
  .rail-quick { display: flex; margin-top: auto; }
  .rail-version { margin-top: 14px; }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
}

@media (max-width: 620px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); padding: 44px 0 32px; }
  .footer-base { justify-content: flex-start; }
  .rail-quick { margin-top: 20px; }
}

/* 11. Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .reveal { opacity: 1; transform: none; }
}
