/* ===== styles/navigation.css (公共 Header/Footer,复制自 web-shared-components) ===== */
:root {
  --shared-shell: 1120px;
  --shared-line: #d8d1c4;
  --shared-paper: #f6f3ec;
  --shared-ink: #17201e;
  --shared-accent: #a8402e;
}

.shared-site-header__rail {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 76px;
  pointer-events: none;
}

.shared-site-header {
  display: flex;
  width: min(var(--shared-shell), calc(100% - 32px));
  min-height: 76px;
  padding-block: 12px;
  margin: auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--shared-line);
  pointer-events: auto;
  transition: width 180ms ease, min-height 180ms ease, padding 180ms ease,
    transform 180ms ease, border-color 180ms ease, border-radius 180ms ease,
    background-color 180ms ease, box-shadow 180ms ease;
}

.shared-site-header--scrolled {
  width: min(calc(100% - 48px), 880px);
  min-height: 60px;
  padding: 7px 14px;
  transform: translateY(10px);
  border: 1px solid var(--shared-line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--shared-paper) 88%, transparent);
  box-shadow: 0 10px 30px rgb(23 32 30 / 10%);
  backdrop-filter: blur(16px);
}

.shared-site-header__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--shared-ink);
  font-weight: 750;
  text-decoration: none;
}

.shared-site-header__nav {
  display: flex;
  gap: 18px;
}

.shared-site-header__nav a {
  color: var(--shared-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.shared-site-header__nav a[aria-current="page"] {
  color: var(--shared-accent);
}


.shared-site-footer {
  width: min(var(--shared-shell), calc(100% - 32px));
  margin: auto;
  padding: 30px 0;
  color: #65706c;
  font-size: 13px;
}

.shared-site-footer__columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.shared-site-footer__legal {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--shared-line);
  font-size: 12px;
}

@media (max-width: 560px) {
  .shared-site-header__rail {
    position: relative;
    height: 64px;
  }

  .shared-site-header,
  .shared-site-header--scrolled {
    width: min(100% - 32px, var(--shared-shell));
    min-height: 64px;
    padding: 9px 0;
    transform: none;
    border: 0;
    border-bottom: 1px solid var(--shared-line);
    border-radius: 0;
    background: var(--shared-paper);
    box-shadow: none;
    backdrop-filter: none;
  }

  .shared-site-header__nav {
    gap: 12px;
  }

  .shared-site-footer__columns {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shared-site-header {
    transition: none;
  }
}

.footer-badges {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  margin-left: 14px;
  vertical-align: middle;
}

.footer-badges img {
  display: block;
  height: 40px;
  width: auto;
}


/* ===== styles/content.css (公共 FAQ/StepList/LinkCardGrid) ===== */
.faq-list {
  border-top: 1px solid var(--shared-line);
}

.faq-list__item {
  border-bottom: 1px solid var(--shared-line);
}

.faq-list__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--shared-space-4);
  min-height: 60px;
  padding: var(--shared-space-3) 0;
  cursor: pointer;
  list-style: none;
  color: var(--shared-ink);
  font-weight: 650;
}

.faq-list__summary::-webkit-details-marker {
  display: none;
}

.faq-list__summary::after {
  flex: 0 0 auto;
  color: var(--shared-muted);
  content: '+';
  font-size: 1.35rem;
  font-weight: 400;
}

.faq-list__item[open] .faq-list__summary::after {
  content: '−';
}

.faq-list__question {
  min-width: 0;
}

.faq-list__number {
  flex: 0 0 auto;
  order: 2;
  color: var(--shared-accent);
  font: 0.8rem/1 var(--shared-mono);
  letter-spacing: 0.08em;
}

.faq-list__answer {
  max-width: 760px;
  padding: 0 var(--shared-space-8) var(--shared-space-4) 0;
  color: var(--shared-muted);
}

.faq-list__answer p {
  margin: 0;
}

.shared-step-list { display: grid; gap: var(--shared-space-4); padding: 0; margin: 0; list-style: none; }
.shared-step-list__item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--shared-space-4); padding: var(--shared-space-4) 0; border-top: 1px solid var(--shared-line); }
.shared-step-list__number { color: var(--shared-accent); font: 700 .875rem/1.5 var(--shared-mono); }
.shared-step-list__content { min-width: 0; }
.shared-step-list__content h3 { margin: 0; color: var(--shared-ink); }
.shared-step-list__body { color: var(--shared-muted); }
.shared-step-list__body p { margin: 0; }
.shared-step-list__body a { overflow-wrap: anywhere; }
@media (min-width: 700px) { .shared-step-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }


/* LinkCardGrid: related-content / tool cards (plain <a>) */
.shared-link-card-grid {
  display: grid;
  gap: 12px;
}

.shared-link-card {
  display: grid;
  min-height: 164px;
  padding: 20px;
  border: 1px solid var(--shared-line);
  border-radius: 12px;
  background: var(--shared-surface);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.shared-link-card:hover {
  border-color: var(--shared-accent);
  background: var(--shared-surface-raised);
}

.shared-link-card:focus-visible {
  outline: 2px solid var(--shared-accent);
  outline-offset: 2px;
}

.shared-link-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.shared-link-card p {
  margin: 0;
  color: var(--shared-muted);
  line-height: 1.6;
}

/* ===== app/globals.css ===== */
/* 映射公共组件 --shared-* 变量到本站 Token(唯一覆盖入口;变量名以公共样式为准,色值以本站 Token 为准) */
:root {
  --shared-shell: 1080px;
  --shared-ink: var(--ink);
  --shared-line: var(--line);
  --shared-paper: var(--bg);
  --shared-surface: var(--card);
  --shared-surface-raised: var(--card);
  --shared-accent: var(--brand);
  --shared-muted: var(--muted);
  --shared-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --shared-space-3: 12px;
  --shared-space-4: 16px;
  --shared-space-8: 32px;
}

:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #5b6474;
  --line: #e3e7ee;
  --brand: #2f6fed;
  --brand-ink: #ffffff;
  --brand-soft: #eaf1fe;
  --ok: #1a7f4e;
  --ok-bg: #e9f7f0;
  --warn: #925e0b;
  --warn-bg: #fdf3e0;
  --err: #b3261e;
  --err-bg: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(26, 34, 51, 0.06), 0 4px 16px rgba(26, 34, 51, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
  padding: 24px 16px 48px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
}

a {
  color: var(--brand);
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}


/* ---------- header / footer(公共 SiteHeader/SiteFooter 的项目侧适配) ---------- */

/* 模板覆盖:三个较长的导航链接在手机宽度放不下一行——让导航换行到品牌下方并横向滚动,避免页面横向溢出 */
@media (max-width: 560px) {
  .shared-site-header__rail { height: auto; }
  .shared-site-header { flex-wrap: wrap; row-gap: 4px; padding-block: 10px; }
  .shared-site-header__nav {
    flex: 1 1 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .shared-site-header__nav::-webkit-scrollbar { display: none; }
}

.shared-site-header__nav a { white-space: nowrap; }

.shared-site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 8px;
}

.shared-site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.shared-site-footer p {
  margin: 0;
  max-width: 640px;
}

/* ---------- page hero & content ---------- */

.page-hero {
  margin: 8px 0 20px;
}

.page-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.25;
}

.page-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.content-section {
  margin: 40px 0;
}

.content-section h2 {
  font-size: 1.35rem;
  margin: 0 0 12px;
}

.content-section h3 {
  font-size: 1.05rem;
  margin: 22px 0 6px;
}

.content-section p,
.content-section li {
  color: #2c3547;
}

.content-section ul,
.content-section ol {
  padding-left: 22px;
  margin: 8px 0;
}

.content-section li {
  margin: 4px 0;
}


/* ---------- tool panel ---------- */

.tool-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.tool-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.tool-toolbar:last-child {
  margin-bottom: 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  padding: 9px 16px;
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn-primary:hover:not(:disabled) {
  background: #275fd0;
  color: var(--brand-ink);
}

.char-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

.char-count.over {
  color: var(--err);
  font-weight: 600;
}

/* ---------- editor / preview panes ---------- */

.pane-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 860px) {
  .pane-grid {
    grid-template-columns: 1fr;
  }
}

.pane {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  min-width: 0;
}

.pane-label {
  display: block;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: #f2f4f8;
  border-bottom: 1px solid var(--line);
}

.mono-input {
  display: block;
  width: 100%;
  height: 380px;
  padding: 12px;
  border: 0;
  resize: vertical;
  font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--ink);
  background: var(--card);
}

.mono-input:focus {
  outline: none;
}

.pane:focus-within {
  border-color: var(--brand);
}

.preview-body {
  height: 380px;
  overflow: auto;
  padding: 4px 14px;
}

.preview-empty {
  color: var(--muted);
}

.md-img-off {
  display: inline-block;
  background: #eef1f6;
  border: 1px dashed #c4cddc;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.85em;
  color: var(--muted);
}


/* ---------- rendered markdown (previews) ---------- */

.md-render h1,
.md-render h2 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25em;
}

.md-render h1 { font-size: 1.5rem; }
.md-render h2 { font-size: 1.25rem; }
.md-render h3 { font-size: 1.1rem; }

.md-render pre {
  background: #f2f4f8;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}

.md-render code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: #f2f4f8;
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

.md-render pre code {
  background: none;
  padding: 0;
}

.md-render blockquote {
  margin: 0.8em 0;
  padding: 0.1em 1em;
  border-left: 4px solid #c9d4e8;
  color: #45506a;
}

.md-render table {
  border-collapse: collapse;
  margin: 0.8em 0;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.md-render th,
.md-render td {
  border: 1px solid #d7dde8;
  padding: 5px 10px;
  text-align: left;
}

.md-render th {
  background: #f2f4f8;
}

.md-render img {
  max-width: 100%;
}

.md-render input[type="checkbox"] {
  margin-right: 6px;
}

/* ---------- status / warnings ---------- */

.status {
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  min-height: 0;
}

.status:empty {
  display: none;
}

.status-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-info {
  background: var(--brand-soft);
  color: #275fd0;
}

.status-error {
  background: var(--err-bg);
  color: var(--err);
}

.warning-list {
  margin: 0 0 12px;
  padding: 12px 14px 12px 34px;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 10px;
  font-size: 0.92rem;
}

.warning-list li {
  margin: 3px 0;
}

.hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}


/* ---------- CSV tool ---------- */

.csv-input-area .csv-paste {
  height: 180px;
}

.csv-controls {
  gap: 10px 16px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  padding: 8px 0;
  min-height: 44px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.search-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.search-label input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  min-height: 44px;
  font: inherit;
  width: 200px;
  max-width: 60vw;
}

.csv-summary {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

.csv-table-wrap {
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.csv-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

.csv-table th,
.csv-table td {
  border: 1px solid var(--line);
  padding: 6px 12px;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 60px;
}

.csv-table thead th {
  position: sticky;
  top: 0;
  background: #f2f4f8;
  z-index: 1;
}

.csv-table .row-num {
  color: var(--muted);
  background: #fafbfd;
  min-width: 44px;
  text-align: right;
  user-select: none;
}


/* ---------- Markdown table generator ---------- */

.delimiter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.delimiter-label select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  min-height: 44px;
  font: inherit;
  background: #ffffff;
}

.table-gen-table th,
.table-gen-table td {
  padding: 3px 6px;
  min-width: 96px;
}

.table-gen-col {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-gen-col input {
  flex: 1;
  min-width: 40px;
}

.table-gen-col-label {
  flex: 1;
  color: var(--muted);
}

.table-gen-cell {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  padding: 5px 8px;
  min-height: 34px;
}

.table-gen-cell:focus {
  border-color: var(--brand);
  background: #ffffff;
  outline: none;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 1rem;
  line-height: 1.2;
  min-height: 34px;
  min-width: 34px;
}

.icon-btn:hover:not(:disabled) {
  color: var(--warn);
  background: #f2f4f8;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.row-actions {
  text-align: center;
}

.table-gen-output {
  height: 220px;
  white-space: pre;
  overflow-x: auto;
}

/* ---------- paste zone ---------- */

.paste-zone {
  border: 2px dashed #b9c6dd;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 56px 20px;
  text-align: center;
  cursor: text;
}

.paste-zone:focus {
  border-color: var(--brand);
  outline: none;
  background: var(--brand-soft);
}

.paste-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 600;
}

.paste-help {
  margin: 0 auto;
  color: var(--muted);
  max-width: 520px;
  font-size: 0.95rem;
}

/* ---------- 404 ---------- */

.not-found {
  padding: 60px 0;
  text-align: center;
}

.not-found h1 {
  font-size: 1.6rem;
}

.not-found p {
  color: var(--muted);
}



/* ---------- grouped tool navigation (Markdown tools vs CSV data tools) ---------- */
.shared-site-header__rail { height: auto; }

.shared-site-header__nav {
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;
  row-gap: 6px;
}

.shared-site-header__navgroup {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shared-site-header__navlabel {
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.shared-site-header__navlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.shared-site-footer__toolgroups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 40px;
}

.shared-site-footer__toolgroup-title {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
