/* =========================================================
   摄影学习 · 全站外壳
   作用域：只写 .site-* 和新增的 .course-note / .table-wrap.wide
   不改各页原有排版、字号、按钮和测验样式
   ========================================================= */

:root {
  --site-bg: #fafaf9;
  --site-panel: #ffffff;
  --site-ink: #1c1917;
  --site-muted: #78716c;
  --site-line: #e7e5e4;
  --site-accent: #ea580c;
  --site-accent-soft: #fff7ed;
  --site-blue: #2563eb;
  --site-max: 920px;
  --site-header-h: 56px;
  --site-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* 跳到正文（键盘/读屏） */
.site-skip {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 999;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--site-ink);
  color: #fff;
  font: 600 14px/1 var(--site-font);
  text-decoration: none;
  transition: top .18s ease;
}
.site-skip:focus { top: 12px; }

/* ---------- 顶部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(250, 250, 249, .9);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--site-line);
}
.site-header .inner {
  max-width: var(--site-max);
  margin: 0 auto;
  height: var(--site-header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.site-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--site-ink);
  font: 800 17px/1 var(--site-font);
  letter-spacing: .02em;
  text-decoration: none;
  white-space: nowrap;
}
.site-brand b { color: var(--site-accent); font-weight: 800; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: #57534e;
  font: 500 13.5px/1 var(--site-font);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { background: #f5f5f4; color: var(--site-ink); }
.site-nav a[aria-current="page"] {
  background: var(--site-accent-soft);
  color: #c2410c;
  font-weight: 700;
}

.site-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  margin-left: auto;
  border: 1px solid var(--site-line);
  border-radius: 10px;
  background: #fff;
  color: var(--site-ink);
  font: 600 13px/1 var(--site-font);
  cursor: pointer;
}
.site-menu-btn:hover { background: #fafaf9; }

/* ---------- 手机底部标签栏 ---------- */
.site-tabbar { display: none; }

/* ---------- 手机弹出菜单（课程列表） ---------- */
.site-sheet,
.site-scrim { display: none; }

/* ---------- 课程配图（正文用，不影响其他排版） ---------- */
.course-figure { max-width: 660px; margin: 24px auto; }
.course-figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 520px;
  margin: 0 auto;
  border: 1px solid var(--site-line);
  border-radius: 12px;
  background: #f5f5f4;
}
.course-figure figcaption {
  margin-top: 9px;
  color: var(--site-muted);
  font: 400 12.5px/1.7 var(--site-font);
}
.course-figure figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 820px) {
  .course-figure img { max-height: 62vh; }
}

/* ---------- 表格横向滑动（仅宽表） ---------- */
.table-wrap.wide table { min-width: 620px; }
.table-scroll-hint {
  margin: 6px 0 0;
  color: #a8a29e;
  font: 400 12px/1.5 var(--site-font);
  text-align: center;
}

/* ---------- 课程页通用提示块 ---------- */
.course-note {
  margin: 20px 0;
  padding: 15px 17px;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  background: #fffbeb;
  color: #78350f;
  font-size: 14.5px;
  line-height: 1.75;
}
.course-note strong { color: #92400e; }
.course-note a { color: #b45309; text-decoration: underline; text-underline-offset: 2px; }

/* =========================================================
   手机
   ========================================================= */
@media (max-width: 820px) {
  body.site-ready {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }
  body.site-ready .topbar { display: none !important; }

  .site-header .inner {
    height: 52px;
    padding: 0 14px;
    gap: 10px;
  }
  .site-nav { display: none; }
  .site-brand { font-size: 16px; }

  .site-menu-btn { display: inline-flex; }

  .site-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--site-line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .site-tabbar a,
  .site-tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 58px;
    padding: 6px 2px;
    border: 0;
    background: none;
    color: #78716c;
    font: 500 11px/1.2 var(--site-font);
    text-decoration: none;
    cursor: pointer;
  }
  .site-tabbar .ico { font-size: 18px; line-height: 1; }
  .site-tabbar a[aria-current="page"],
  .site-tabbar button[data-active="true"],
  .site-tabbar button[aria-expanded="true"] { color: var(--site-accent); }

  .site-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 94;
    background: rgba(28, 25, 23, .38);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .site-scrim.open { opacity: 1; pointer-events: auto; }

  .site-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    max-height: 78vh;
    overflow-y: auto;
    padding: 8px 18px calc(22px + env(safe-area-inset-bottom));
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 44px rgba(28, 25, 23, .16);
    transform: translateY(104%);
    transition: transform .24s cubic-bezier(.22, .8, .3, 1);
  }
  .site-sheet.open { transform: none; }
  .site-sheet .grab {
    width: 40px;
    height: 4px;
    margin: 6px auto 10px;
    border-radius: 4px;
    background: #e7e5e4;
  }
  .site-sheet h2 {
    margin: 4px 0 6px;
    font: 800 15px/1.4 var(--site-font);
    color: var(--site-ink);
  }
  .site-sheet a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 50px;
    padding: 10px 2px;
    border-bottom: 1px solid #f5f5f4;
    color: var(--site-ink);
    font: 600 15px/1.4 var(--site-font);
    text-decoration: none;
  }
  .site-sheet a span.meta {
    color: var(--site-muted);
    font-size: 12px;
    font-weight: 400;
  }
  .site-sheet a[aria-current="page"] { color: var(--site-accent); }
  .site-sheet .all {
    display: inline-flex;
    margin-top: 14px;
    color: var(--site-blue);
    border: 0;
    font-size: 14px;
  }

  /* 4 列以上的宽表：手机上变成卡片，不再左右滑 */
  .table-wrap.wide { overflow: visible; border: 0; background: none; }
  .table-wrap.wide table { display: block; min-width: 0; }
  .table-wrap.wide thead { display: none; }
  .table-wrap.wide tbody { display: grid; gap: 10px; }
  .table-wrap.wide tr {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 2px 10px;
    padding: 13px 14px;
    border: 1px solid var(--site-line);
    border-radius: 12px;
    background: #fff;
  }
  .table-wrap.wide td { display: block; border: 0; padding: 0; font-size: 13.5px; }
  .table-wrap.wide td:nth-child(1) {
    grid-column: 1 / -1;
    grid-row: 1;
    color: var(--site-accent);
    font-weight: 800;
    font-size: 14px;
  }
  .table-wrap.wide td:nth-child(n+2) {
    grid-column: 1 / -1;
    margin-top: 5px;
    padding-top: 7px;
    border-top: 1px dashed #f0efed;
  }
  .table-wrap.wide tr.num-row td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .table-wrap.wide tr.num-row td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    font-weight: 700;
  }
  .table-wrap.wide td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: #a8a29e;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
  }
}

/* 键盘焦点：统一成品牌色，不用浏览器默认蓝框 */
.site-header a:focus-visible,
.site-tabbar a:focus-visible,
.site-tabbar button:focus-visible,
.site-menu-btn:focus-visible,
.site-sheet a:focus-visible {
  outline: 2px solid var(--site-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* 有全站顶栏时，隐藏各页原来的旧顶栏（桌面 + 手机） */
body.site-ready .topbar { display: none !important; }

/* 深色应用（色感实验室）里只加一个入口链接 */
.site-lab-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  color: inherit;
  font: 600 13px/1 var(--site-font);
  text-decoration: none;
  opacity: .85;
}
.site-lab-link:hover { opacity: 1; }

@media print {
  .site-header, .site-tabbar, .site-sheet, .site-scrim, .site-skip { display: none !important; }
  body.site-ready { padding-bottom: 0; }
}
