/* Shared components. Colors come from base.css tokens only. */

.site-header {
  position: relative;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 64px;
}

.site-header__logo {
  color: var(--c-text);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-header__logo span {
  color: var(--c-primary);
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.site-header__nav a {
  color: var(--c-text-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
}

.site-header__nav a:hover,
.site-header__nav a[aria-current="page"] {
  color: var(--c-primary-text);
}

.site-header__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
}

.site-header__toggle svg {
  width: 20px;
  height: 20px;
}

.site-footer {
  margin-top: var(--sp-12);
  padding-block: var(--sp-6);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-subtle);
  font-size: var(--fs-tiny);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.site-footer a {
  color: var(--c-text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--c-primary-text);
}

.breadcrumb {
  margin-bottom: var(--sp-4);
  color: var(--c-text-subtle);
  font-size: var(--fs-tiny);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: var(--sp-2);
  color: var(--c-text-subtle);
}

.breadcrumb a {
  color: var(--c-text-muted);
  text-decoration: none;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4);
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  text-align: center;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
}

.dropzone__icon {
  width: 40px;
  height: 40px;
  color: var(--c-primary);
}

.dropzone__title {
  margin: 0;
  font-weight: 700;
}

.dropzone__hint,
.dropzone__paste {
  margin: 0;
  color: var(--c-text-subtle);
  font-size: var(--fs-small);
}

.dropzone__error {
  margin: 0;
  color: var(--c-danger);
  font-size: var(--fs-small);
}

.previews {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: var(--sp-4) 0 0;
  padding: 0;
  list-style: none;
}

.file-preview {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
}

.file-preview__thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--c-surface-alt);
}

.file-preview__name {
  font-weight: 600;
  word-break: break-word;
}

.file-preview__meta {
  color: var(--c-text-subtle);
  font-size: var(--fs-tiny);
}

.file-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.lang-select {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  color: var(--c-text-muted);
  font-size: var(--fs-small);
}

.lang-select__note {
  color: var(--c-text-subtle);
  font-size: var(--fs-tiny);
}

.progress {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.progress__bar {
  height: 8px;
  overflow: hidden;
  border-radius: var(--r-full);
  background: var(--c-surface-alt);
}

.progress__bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c-primary);
}

.progress__stage {
  margin: var(--sp-2) 0 0;
  color: var(--c-text-muted);
  font-size: var(--fs-small);
}

.progress__cancel {
  margin-top: var(--sp-3);
}

.table-editor {
  margin-top: var(--sp-4);
}

.table-editor__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.table-editor table {
  min-width: 640px;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

.table-editor th,
.table-editor td {
  min-width: 96px;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}

.table-editor th {
  background: var(--c-surface-alt);
  font-size: var(--fs-tiny);
  color: var(--c-text-muted);
}

.table-editor td:first-child,
.table-editor th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 44px;
  background: var(--c-surface);
  box-shadow: 1px 0 0 var(--c-border);
}

.table-editor th:first-child {
  z-index: 2;
  background: var(--c-surface-alt);
}

.table-editor td[contenteditable="true"] {
  cursor: text;
}

.table-editor td.cell--low,
.table-editor td.cell--low:first-child {
  background: var(--c-warn-bg);
  color: var(--c-warn);
}

.confidence-legend {
  margin-top: var(--sp-3);
  color: var(--c-warn);
  font-size: var(--fs-small);
}

.confidence-legend::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: var(--sp-2);
  vertical-align: -1px;
  border-radius: 2px;
  background: var(--c-warn-bg);
  box-shadow: inset 0 0 0 1px var(--c-warn);
}

.export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.export-bar__name {
  flex-basis: 100%;
  margin: 0;
  color: var(--c-text-subtle);
  font-size: var(--fs-tiny);
}

.how-it-works {
  display: grid;
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.how-it-works li {
  padding: var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
}

.how-it-works li::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: var(--sp-2);
  border-radius: var(--r-full);
  background: var(--c-primary);
  color: var(--c-surface);
  font-size: var(--fs-small);
  font-weight: 700;
}

.example-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
}

.example-card img {
  border-radius: var(--r-sm);
  background: var(--c-surface-alt);
}

.example-card figcaption {
  color: var(--c-text-muted);
  font-size: var(--fs-small);
}

.faq-item {
  border-bottom: 1px solid var(--c-border);
}

.faq-item summary {
  padding: var(--sp-4) 0;
  font-weight: 600;
  cursor: pointer;
}

.faq-item p {
  margin: 0 0 var(--sp-4);
  color: var(--c-text-muted);
}

.cta-banner {
  margin-top: var(--sp-8);
  padding: var(--sp-6);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-primary-soft);
}

.cta-banner p {
  color: var(--c-text-muted);
}

/* Ad placeholder. Takes NO space while no ad code is loaded — an empty
   visibility:hidden box reserved 250px on desktop and pushed the tool below
   the fold (homepage layout bug Jason reported, 2026-10-12).
   When AdSense actually ships: replace this rule with the real slot sizing
   (min-height per format) and keep the <aside class="ad-slot"> hooks. */
.ad-slot {
  display: none;
}

/* ---- Original vs result pane (ui/compare.js) -----------------------------
   Two panes while reviewing: the uploaded image (or PDF page) on the left, the
   editable grid on the right, with a box drawn around the region the hovered
   cell was read from. Collapsed, it is a single full-width column exactly like
   the pre-T15 layout. The stage padding MUST stay 12px — compare.js maps cell
   coordinates with the same constant (STAGE_PAD). */
.review {
  margin-top: var(--sp-4);
}

.review__bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--sp-2);
}

.compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}

.compare__source {
  min-width: 0;
  padding: var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface-alt);
}

.compare.is-collapsed .compare__source {
  display: none;
}

.compare__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.compare__title {
  font-size: var(--fs-tiny);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-text-subtle);
}

.compare__tools,
.compare__pager {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.compare__page {
  min-width: 6.5em;
  text-align: center;
  color: var(--c-text-muted);
  font-size: var(--fs-tiny);
}

.compare__stage {
  position: relative;
  overflow: auto;
  max-height: 68vh;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--c-surface);
  /* Reserved gutter keeps clientWidth stable, so "fit width" cannot oscillate
     between a scrollbar and no scrollbar. */
  scrollbar-gutter: stable;
}

.compare__pane {
  position: relative;
  margin-inline: auto;
}

.compare__pane img,
.compare__pane canvas {
  display: block;
  border-radius: 2px;
  box-shadow: var(--shadow-sm);
}

.compare__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.compare__overlay i {
  position: absolute;
  border: 2px solid var(--c-focus);
  border-radius: 3px;
  background: rgba(37, 99, 235, .16);
}

.compare__empty {
  margin: 0;
  padding: var(--sp-6) var(--sp-3);
  text-align: center;
  color: var(--c-text-subtle);
  font-size: var(--fs-small);
}

.compare__foot {
  margin-top: var(--sp-2);
}

.compare__pager {
  justify-content: center;
}

.compare__hint {
  margin: var(--sp-2) 0 0;
  text-align: center;
  color: var(--c-text-subtle);
  font-size: var(--fs-tiny);
}

/* The grid must not push the split wider than the tool card. */
.compare .table-editor {
  min-width: 0;
  margin-top: 0;
}

.table-editor td.cell--active {
  outline: 2px solid var(--c-focus);
  outline-offset: -2px;
}

/* The default tool card (900px) cannot hold a split view plus the grid, so the
   card goes wide only while the original pane is actually showing. */
@media (min-width: 1040px) {
  #converter.is-wide {
    max-width: 1240px;
  }

  #converter.is-wide .tool {
    max-width: none;
  }

  .compare:not(.is-collapsed) {
    grid-template-columns: minmax(300px, 40%) minmax(0, 1fr);
  }

  .compare:not(.is-collapsed) .compare__source {
    position: sticky;
    top: var(--sp-4);
  }
}

@media (max-width: 639px) {
  .compare__stage {
    max-height: 46vh;
  }
}

.tool__unsupported {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--c-warn-bg);
  color: var(--c-warn);
}

@media (max-width: 639px) {
  .site-header__toggle {
    display: inline-flex;
  }

  .site-header__nav {
    display: none;
    position: absolute;
    z-index: 3;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--sp-2) var(--sp-4) var(--sp-4);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-md);
  }

  .site-header.is-open .site-header__nav {
    display: flex;
  }

  .site-header__nav a {
    padding: var(--sp-3) 0;
  }
}

/* --- 站点级页脚内链矩阵（2026-10-15）---------------------------------------
   把全部 12 个内容页在页脚互相连起来，每页内链由 13–23 条提到 30 条左右，
   改善爬取路径与站内权重分配。依据：自家竞品拆解把「补内链矩阵」列为唯一
   零成本可立刻复制的结构性杠杆（竞品实测每页 45–71 条内链）。
   用在 <div class="container site-footer__links"> 内，位于既有页脚行之上。 */
.site-footer__links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
  text-align: left;
}

.site-footer__links-title {
  margin: 0 0 var(--sp-2);
  font-weight: 700;
  color: var(--c-text-muted);
}

.site-footer__links a,
.site-footer__links-self {
  display: block;
  padding-block: 2px;
}

.site-footer__links a {
  color: var(--c-text-muted);
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--c-primary-text);
  text-decoration: underline;
}

/* 当前页自身：只显示文本，不做自链（与站内既有约定一致） */
.site-footer__links-self {
  color: var(--c-text-subtle);
}

/* --- 目录站徽章条（2026-10-20，T21）-----------------------------------------
   twelve.tools 与 startupfa.me 的免费档都要求"首页/页脚挂其 badge"才给
   dofollow 回链（startupfa.me 由 verification bot 校验）。放在版权行之上，
   与内链矩阵同处页脚区，不占正文视觉重量。
   注：外链 rel 不加 nofollow —— 对方要的就是 dofollow，这点不能自行降级。 */
.site-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding-block: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-top: 1px solid var(--c-border);
}

.site-badges__label {
  margin: 0;
  font-size: var(--fs-tiny);
  color: var(--c-text-subtle);
  letter-spacing: 0.02em;
}

.site-badges a {
  display: inline-flex;
  align-items: center;
  opacity: 0.9;
  transition: opacity 0.15s ease;
}

.site-badges a:hover {
  opacity: 1;
}

.site-badges img {
  display: block;
  height: 32px;
  width: auto;
}

.site-badges__chip {
  height: 32px;
  padding-inline: 10px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: var(--fs-tiny);
  color: var(--c-text-muted);
  text-decoration: none;
  background: var(--c-surface);
}

.site-badges__chip:hover {
  color: var(--c-primary-text);
  border-color: var(--c-primary-text);
}
