/* ZeroType 使用手冊專用 CSS */

:root {
  --sidebar-w: 260px;
}

/* 手冊整體佈局 */
.manual-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  width: min(var(--max), calc(100% - 36px));
  margin: calc(var(--header) + 40px) auto 96px;
}

/* 側邊導覽欄 */
.manual-sidebar {
  position: sticky;
  top: calc(var(--header) + 24px);
  max-height: calc(100vh - var(--header) - 48px);
  overflow-y: auto;
  padding: 24px;
  background: rgba(17, 24, 24, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 滾動條美化 (側欄) */
.manual-sidebar::-webkit-scrollbar {
  width: 4px;
}
.manual-sidebar::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 900;
  color: var(--teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.sidebar-link {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 180ms ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-link:hover {
  color: var(--ink);
  background: rgba(247, 243, 232, 0.05);
}

.sidebar-link.active {
  color: #031210;
  background: var(--teal);
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(39, 220, 195, 0.25);
}

/* 側欄 OS 快捷切換 */
.sidebar-os-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-os-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(247, 243, 232, 0.02);
  transition: all 200ms ease;
}

.sidebar-os-btn:hover {
  border-color: var(--teal);
  color: var(--ink);
  background: rgba(39, 220, 195, 0.05);
}

.sidebar-os-btn.active {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(39, 220, 195, 0.08);
}

.sidebar-os-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* 主內容區 */
.manual-content {
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.manual-section {
  scroll-margin-top: calc(var(--header) + 40px);
}

.manual-content h1 {
  font-size: clamp(32px, 4.5vw, 52px);
  font-family: "Noto Serif TC", serif;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 16px;
  background: linear-gradient(135deg, var(--ink) 40%, rgba(247, 243, 232, 0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.manual-content .lead {
  font-size: clamp(17px, 1.8vw, 21px);
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.manual-content h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-family: "Noto Serif TC", serif;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--ink);
  border-left: 3px solid var(--teal);
  padding-left: 16px;
}

.manual-content h3 {
  font-size: clamp(18px, 2.2vw, 22px);
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--ink);
}

.manual-content p {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.75;
  margin: 0 0 16px;
}

/* 頂部導引 (Breadcrumbs / Back link) */
.manual-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.back-link {
  font-size: 13px;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  transition: transform 180ms ease;
}

.back-link:hover {
  transform: translateX(-4px);
}

/* OS 選擇大卡片 (Home manual 專用) */
.os-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 32px 0;
}

.os-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px 32px;
  background: linear-gradient(180deg, rgba(247, 243, 232, 0.05), rgba(247, 243, 232, 0.01)), var(--panel);
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
  transition: all 260ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.os-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(39, 220, 195, 0.12), transparent 45%);
  opacity: 0;
  transition: opacity 260ms ease;
  pointer-events: none;
}

.os-card--macos::before {
  background: radial-gradient(circle at top left, rgba(229, 173, 99, 0.12), transparent 45%);
}

.os-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.os-card--win:hover {
  border-color: rgba(39, 220, 195, 0.5);
}

.os-card--macos:hover {
  border-color: rgba(229, 173, 99, 0.5);
}

.os-card:hover::before {
  opacity: 1;
}

.os-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(247, 243, 232, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 260ms ease;
}

.os-card--win .os-card__icon {
  color: var(--teal);
}

.os-card--macos .os-card__icon {
  color: var(--warm);
}

.os-card:hover .os-card__icon {
  transform: scale(1.08);
}

.os-card h3 {
  font-size: 24px;
  font-family: "Noto Serif TC", serif;
  margin: 0;
  color: var(--ink);
}

.os-card p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  min-height: 48px;
}

.os-card .button {
  width: auto;
  align-self: stretch;
}

/* 仿系統視窗之代碼框 */
.code-window {
  background: #090e0e;
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 24px 0;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.code-window__header {
  background: rgba(247, 243, 232, 0.03);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.code-window__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-window__dot--red { background: #ff5f56; }
.code-window__dot--yellow { background: #ffbd2e; }
.code-window__dot--green { background: #27c93f; }

.code-window__title {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-left: 12px;
  letter-spacing: 0.05em;
}

.code-window__content {
  padding: 20px;
  margin: 0;
  overflow-x: auto;
}

.code-window__content pre {
  margin: 0;
}

.code-window__content code {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(247, 243, 232, 0.9);
}

/* 行內快捷鍵樣式 */
.kbd-key {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  background: linear-gradient(180deg, rgba(247, 243, 232, 0.14), rgba(247, 243, 232, 0.04));
  border: 1px solid rgba(247, 243, 232, 0.22);
  border-bottom: 2px solid rgba(247, 243, 232, 0.35);
  border-radius: 6px;
  padding: 2px 8px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
  font-size: 0.88em;
  color: var(--warm);
  font-weight: 600;
  white-space: nowrap;
}

/* 提示訊息框 */
.info-box {
  border-radius: 18px;
  padding: 22px 24px;
  margin: 24px 0;
  background: rgba(247, 243, 232, 0.02);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.info-box__icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.info-box__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-box__body h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.info-box__body p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
}

.info-box--tip {
  background: rgba(39, 220, 195, 0.03);
  border-color: rgba(39, 220, 195, 0.15);
  border-left: 4px solid var(--teal);
}
.info-box--tip .info-box__body h4 {
  color: var(--teal);
}

.info-box--warning {
  background: rgba(229, 173, 99, 0.03);
  border-color: rgba(229, 173, 99, 0.15);
  border-left: 4px solid var(--warm);
}
.info-box--warning .info-box__body h4 {
  color: var(--warm);
}

/* 截圖預留位置 (Screenshot Placeholder) */
.screenshot-wrapper {
  margin: 28px 0;
  border-radius: 16px;
  overflow: hidden;
}

.screenshot-placeholder {
  border: 2px dashed rgba(247, 243, 232, 0.12);
  background: rgba(17, 24, 24, 0.3);
  padding: 48px 24px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  transition: all 220ms ease;
  cursor: pointer;
  min-height: 280px;
}

.screenshot-placeholder:hover {
  background: rgba(17, 24, 24, 0.5);
  border-color: var(--teal);
  box-shadow: inset 0 0 24px rgba(39, 220, 195, 0.04);
}

.placeholder-icon {
  font-size: 32px;
  transition: transform 220ms ease;
}

.screenshot-placeholder:hover .placeholder-icon {
  transform: scale(1.15) rotate(-3deg);
}

.placeholder-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  max-width: 440px;
  line-height: 1.5;
}

.placeholder-size {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  background: rgba(247, 243, 232, 0.06);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
}

/* 步驟清單 */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}

.guide-step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 18px;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(247, 243, 232, 0.015);
  transition: all 180ms ease;
}

.guide-step:hover {
  border-color: rgba(247, 243, 232, 0.2);
  background: rgba(247, 243, 232, 0.03);
}

.guide-step__num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--warm);
  background: var(--deep);
  transition: all 180ms ease;
}

.guide-step:hover .guide-step__num {
  border-color: var(--warm);
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(229, 173, 99, 0.2);
}

.guide-step__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-step__content h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  padding-top: 8px;
}

.guide-step__content p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* 快捷鍵速查網格 */
.hotkey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.hotkey-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  background: rgba(247, 243, 232, 0.01);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: all 180ms ease;
}

.hotkey-card:hover {
  border-color: rgba(247, 243, 232, 0.16);
  background: rgba(247, 243, 232, 0.03);
}

.hotkey-card__desc {
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
}

/* 表格樣式 */
.manual-table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.manual-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14.5px;
}

.manual-table th,
.manual-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.manual-table th {
  background: rgba(247, 243, 232, 0.04);
  font-weight: 700;
  color: var(--teal);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.manual-table tr:last-child td {
  border-bottom: 0;
}

.manual-table tr:hover td {
  background: rgba(247, 243, 232, 0.01);
}

/* 進階卡片網格 */
.advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 24px 0;
}

.advanced-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  background: rgba(17, 24, 24, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.advanced-card h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--teal);
}

.advanced-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

/* 自適應 */
@media (max-width: 980px) {
  .advanced-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .manual-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .manual-sidebar {
    position: static;
    max-height: none;
    background: transparent;
    border: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 24px;
    border-radius: 0;
  }

  .sidebar-group {
    display: none; /* 窄螢幕隱藏側欄的詳細目錄 */
  }

  .sidebar-os-selector {
    border-bottom: 0;
    padding-bottom: 0;
    grid-template-columns: repeat(2, 1fr);
  }

  .os-selection-grid {
    grid-template-columns: 1fr;
  }
}
