/* =========================================================
   iouu.cc · 个人导航站
   方案 C：浅色极简杂志风 / 深色模式 / 响应式
   纯 CSS，无外部依赖
   ========================================================= */

/* ---------- 设计令牌 ---------- */
:root {
  color-scheme: light;
  --accent: #2f6bff;
  --accent-soft: #eef3ff;

  --bg: #f4f6fb;
  --bg-elev: #ffffff;
  --bg-sub: #e7ecf5;

  --ink: #1b2233;
  --ink-2: #4a5468;
  --muted: #7b849b;
  --faint: #a7afc1;

  --line: #e2e7f0;
  --shadow-sm: 0 4px 14px rgba(27, 34, 51, .05);
  --shadow: 0 12px 32px rgba(27, 34, 51, .09);
  --shadow-lg: 0 18px 48px rgba(27, 34, 51, .14);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.22, .8, .3, 1);
  --wrap: 1240px;
}

/* ---------- 深色主题 ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --accent: #6ea8ff;
  --accent-soft: #17233f;

  --bg: #0d1117;
  --bg-elev: #161c27;
  --bg-sub: #1d2432;

  --ink: #e7ecf7;
  --ink-2: #c2cad9;
  --muted: #8792ab;
  --faint: #5b6480;

  --line: #262f40;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .3);
  --shadow: 0 12px 32px rgba(0, 0, 0, .42);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 92% -8%, var(--bg-sub), transparent 62%),
    radial-gradient(700px 420px at -6% 104%, var(--bg-sub), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

button,
input { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  transition: top .2s var(--ease);
}
.skip-link:focus-visible { top: 16px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* =========================================================
   顶部导航
   ========================================================= */
.site-header {
  position: relative;
  z-index: 10;
  max-width: var(--wrap);
  width: 100%;
  margin: 0 auto;
  padding: 26px 40px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 20px;
  box-shadow: inset 0 -1px var(--line);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-login {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding-inline: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.site-login:hover { color: var(--accent); border-color: var(--accent); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  flex: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
  padding-bottom: 1px;
  box-shadow: var(--shadow-sm);
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-mark:has(img) { padding: 0; }

.brand-text {
  min-width: 0;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text strong { font-size: 19px; letter-spacing: -.01em; }
.brand-text small {
  font-size: 10.5px;
  letter-spacing: .18em;
  color: var(--muted);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px 24px;
}

.nav-link {
  position: relative;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink-2);
  padding: 4px 0;
  transition: color .2s var(--ease);
  cursor: pointer;
}
.nav-link:hover { color: var(--accent); }
.nav-link.is-active { color: var(--ink); }

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-link.is-disabled {
  color: var(--faint);
  cursor: not-allowed;
}

.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .25s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.theme-icon { grid-area: 1 / 1; font-size: 16px; transition: opacity .2s var(--ease), transform .3s var(--ease); }
[data-theme="light"] .theme-icon--sun { opacity: 0; transform: rotate(40deg); }
[data-theme="light"] .theme-icon--moon { opacity: 1; transform: rotate(0); }
[data-theme="dark"] .theme-icon--sun { opacity: 1; transform: rotate(0); }
[data-theme="dark"] .theme-icon--moon { opacity: 0; transform: rotate(-40deg); }

/* =========================================================
   主体两栏
   ========================================================= */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 46px 40px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px;
  align-items: start;
}

/* ---------- 标题区 ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--muted);
}

.eyebrow-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #0f9d6e;
  box-shadow: 0 0 0 3px rgba(15, 157, 110, .16);
}

.hero-title {
  margin: 0;
  font-size: clamp(44px, 5.4vw, 64px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}
.hero-title .line { display: block; }
.hero-title .line--accent { color: var(--accent); }

.hero-desc {
  margin: 20px 0 30px;
  font-size: 16px;
  line-height: 1.85;
  color: var(--muted);
  max-width: 46ch;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.hero-desc[hidden] + .search { margin-top: 24px; }

/* ---------- 搜索框 ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin-bottom: 34px;
  padding: 0 14px;
  height: 48px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

.search-icon {
  display: inline-flex;
  color: var(--faint);
  transition: color .2s var(--ease);
}
.search:focus-within .search-icon { color: var(--accent); }

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 14.5px;
  outline: none;
}
.search input::placeholder { color: var(--faint); }

/* 隐藏浏览器自带的搜索清除按钮，保持界面统一 */
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-kbd {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* =========================================================
   卡片网格
   ========================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  padding: 24px 22px 20px;
  background: var(--bg-elev);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease),
    border-color .28s var(--ease), opacity .2s var(--ease);
}

a.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 50px; height: 50px;
  border-radius: 15px;
  font-size: 24px;
  line-height: 1;
  background: var(--icon-bg, var(--accent-soft));
  transition: transform .28s var(--ease);
}
a.card:hover .card-icon { transform: scale(1.06) rotate(-3deg); }

.card-title {
  margin: 4px 0 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.card-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.card-arrow {
  position: absolute;
  right: 22px;
  bottom: 18px;
  font-size: 17px;
  line-height: 1;
  color: var(--card-accent, var(--accent));
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
a.card:hover .card-arrow,
a.card:focus-visible .card-arrow { opacity: 1; transform: translate(0, 0); }

/* 没有链接的卡片：显示「待建设」角标，不可点击 */
.card.is-empty {
  cursor: default;
  border-color: var(--line);
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.card.is-empty .card-icon { filter: saturate(.35); opacity: .8; }

.card-tag {
  position: absolute;
  top: 18px; right: 18px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  background: var(--bg-sub);
}

/* 搜索时被过滤掉的卡片 */
.card.is-hidden { display: none; }

mark {
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
}

.empty-state {
  margin: 28px 0 0;
  padding: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

/* =========================================================
   右栏：最近更新
   ========================================================= */
.sidebar { position: sticky; top: 28px; }

.sidebar-card {
  padding: 24px 24px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.sidebar-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.sidebar-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

.recent-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.recent-item:last-child { border-bottom: 0; }

.recent-date {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
}

.recent-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-tag {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent);
  background: var(--accent-soft);
}

.recent-item.is-empty .recent-title,
.recent-item.is-empty .recent-date { color: var(--faint); }

.sidebar-note {
  margin: 16px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--faint);
}
.sidebar-note code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-sub);
}

/* =========================================================
   站点链接列表（LINKS 为空时整块隐藏）
   ========================================================= */
.links {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.link-group-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.link-item > a,
.link-item.is-empty {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  font-size: 14px;
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}

.link-item > a:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.link-item.is-empty { color: var(--faint); background: transparent; }

.link-name { font-weight: 600; }
.link-desc {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.link-arrow { margin-left: auto; color: var(--accent); font-size: 13px; }
.link-item.is-empty .link-arrow { color: var(--faint); }

/* 右侧「最近更新」里的链接 */
.recent-item > a {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  transition: color .2s var(--ease);
}
.recent-item > a:hover .recent-title { color: var(--accent); }

/* =========================================================
   页脚
   ========================================================= */
.site-footer {
  max-width: var(--wrap);
  width: 100%;
  margin: 0 auto;
  padding: 22px 40px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.site-footer p { margin: 0; }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1100px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }
  .sidebar { position: static; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .site-header { padding: 18px 20px 14px; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; }
  .header-actions { grid-area: 1 / 2; }
  .main-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 22px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-link { white-space: nowrap; }

  .page { padding: 34px 20px 12px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .card { min-height: 150px; padding: 20px 18px 18px; }
  .card-icon { width: 44px; height: 44px; font-size: 21px; border-radius: 13px; }
  .card-title { font-size: 17px; }

  .site-footer { padding: 18px 20px 28px; }
}

@media (max-width: 520px) {
  .hero-title { font-size: clamp(38px, 11vw, 48px); }
  .hero-desc { margin: 16px 0 24px; }
  .search { max-width: none; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .card { min-height: 132px; flex-direction: row; align-items: center; gap: 16px; }
  .card-text { display: flex; flex-direction: column; gap: 2px; }
  .card-title { margin: 0; }
  .card-arrow { display: none; }
  .site-footer { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* =========================================================
   动效降级
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
