/* Sweet 门户页 · 极简排版风 */
:root {
  --paper: #FBFAF7;
  --ink: #1C1B19;
  --ink-soft: #6B6862;
  --ink-faint: #A8A49C;
  --rule: #E6E3DC;
  --rule-strong: #DCD8CE;
  --accent: #B5854F;
  --gutter: clamp(24px, 7vw, 72px);
  --display: Georgia, "Times New Roman", "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ── 页面骨架 ── */
.portal-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.portal-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(72px, 15vh, 148px) var(--gutter) 40px;
}

/* ── Hero ── */
.portal-hero {
  margin-bottom: clamp(40px, 8vh, 72px);
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.portal-title {
  font-family: var(--display);
  font-size: clamp(46px, 14vw, 78px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.02;
  margin: 0 0 18px;
}

.portal-tagline {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
}

.portal-quote {
  margin: 30px 0 0;
  max-width: 26em;
  font-family: var(--display);
  font-size: 15px;
  font-style: italic;
  line-height: 1.75;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.portal-quote.visible { opacity: 1; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 模块索引 ── */
.portal-index {
  border-top: 1px solid var(--rule);
}

.portal-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: baseline;
  column-gap: 16px;
  padding: 26px 2px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: padding-left 0.28s ease, border-color 0.28s ease;
}

.portal-card:nth-child(1) { animation-delay: 0.10s; }
.portal-card:nth-child(2) { animation-delay: 0.16s; }
.portal-card:nth-child(3) { animation-delay: 0.22s; }
.portal-card:nth-child(4) { animation-delay: 0.28s; }

.portal-card__no {
  grid-area: 1 / 1;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  transition: color 0.28s ease;
}

.portal-card__title {
  grid-area: 1 / 2;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.portal-card__arrow {
  grid-area: 1 / 3;
  font-size: 16px;
  color: var(--ink-faint);
  transition: transform 0.28s ease, color 0.28s ease;
}

.portal-card__desc {
  grid-area: 2 / 2;
  margin-top: 5px;
  font-size: 13px;
  color: var(--ink-soft);
}

.portal-card:hover {
  padding-left: 10px;
  border-color: var(--rule-strong);
}

.portal-card:hover .portal-card__no,
.portal-card:hover .portal-card__arrow {
  color: var(--accent);
}

.portal-card:hover .portal-card__arrow {
  transform: translateX(4px);
}

.portal-card:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ── 页脚 ── */
.portal-footer {
  margin-top: auto;
  padding-top: clamp(48px, 10vh, 96px);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

/* ══════════════════════════════════════
   文心一言屏保浮层（由 portal.js 注入）
   ══════════════════════════════════════ */
#wenxin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--paper);
  animation: wenxinFadeIn 0.6s ease;
}

#wenxin-overlay iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@keyframes wenxinFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── 响应式 ── */
@media (max-width: 480px) {
  .portal-card {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 22px 2px;
  }
  .portal-card__title { font-size: 17px; }
  .portal-card__desc { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-hero,
  .portal-card { animation: none; }
  .portal-card { transition: none; }
  .portal-quote { opacity: 1; transition: none; }
}

/* ── 应用展示设置 ── */
.portal-gear {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

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

.portal-prefs { position: fixed; inset: 0; z-index: 200; }

.portal-prefs.hidden { display: none; }

.portal-prefs__mask {
  position: absolute;
  inset: 0;
  background: rgba(28, 27, 25, 0.32);
}

.portal-prefs__panel {
  position: relative;
  width: min(360px, calc(100vw - 32px));
  margin: 12vh auto 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 20px 20px 16px;
  box-shadow: 0 18px 48px rgba(28, 27, 25, 0.14);
}

.portal-prefs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.portal-prefs__title {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.04em;
}

.portal-prefs__close {
  border: none;
  background: none;
  color: var(--ink-faint);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.portal-prefs__close:hover,
.portal-prefs__close:focus-visible { color: var(--ink); outline: none; }

.portal-prefs__hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ink-faint);
}

.portal-prefs__list { display: flex; flex-direction: column; }

.portal-prefs__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 2px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.portal-prefs__item:last-child { border-bottom: 1px solid var(--rule); }

.portal-prefs__item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.portal-prefs__item input[type="checkbox"]:disabled { cursor: default; }

.portal-prefs__note {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-faint);
}

.portal-prefs__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.portal-prefs__reset {
  border: 1px solid var(--rule);
  background: none;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .portal-gear { transition: none; }
}
