:root {
  --navy: #102a43;
  --slate: #486581;
  --muted: #71869a;
  --cyan: #0e7490;
  --cyan-dark: #0b5f75;
  --cyan-soft: #e8f5f8;
  --paper: #ffffff;
  --canvas: #f4f8fb;
  --line: #d8e4ec;
  --line-strong: #b9ccd9;
  --shadow: 0 18px 45px rgba(16, 42, 67, .09);
  --font: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--navy); font-family: var(--font); }
a { color: inherit; }

.portal-page {
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(14, 116, 144, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 116, 144, .035) 1px, transparent 1px),
    var(--canvas);
  background-size: 28px 28px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 18px clamp(22px, 5vw, 76px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
}

.portal-brand { display: flex; align-items: center; gap: 18px; text-decoration: none; }
.portal-brand strong { font-size: clamp(25px, 2.3vw, 36px); letter-spacing: .02em; }
.broach-mark { width: 48px; height: 48px; color: var(--navy); }
.broach-mark svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; transform: translateY(-1px); }

.portal-main { width: min(1360px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 34px; }
.portal-intro { position: relative; display: flex; justify-content: space-between; min-height: 120px; overflow: hidden; }
.portal-intro h1 { margin: 0 0 14px; font-size: clamp(30px, 3vw, 48px); line-height: 1.15; }
.portal-intro p { max-width: 620px; margin: 0; color: var(--slate); font-size: 16px; line-height: 1.8; }
.broach-drawing { position: absolute; top: -34px; right: 2%; width: min(39vw, 500px); color: rgba(14, 116, 144, .2); stroke-width: 1; }

.workflow { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; padding-top: 26px; }
.workflow-line { position: absolute; top: 48px; left: 8%; right: 7%; height: 2px; background: var(--cyan); }
.workflow-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  padding: 50px 28px 26px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.workflow-card:hover { z-index: 2; transform: translateY(-7px); border-color: var(--cyan); box-shadow: var(--shadow); }
.workflow-card:focus-visible { outline: 3px solid rgba(14,116,144,.3); outline-offset: 4px; }
.workflow-number { position: absolute; top: -25px; left: 28px; display: grid; width: 50px; height: 50px; place-items: center; border: 4px solid var(--canvas); border-radius: 50%; color: #fff; background: var(--cyan); font-size: 18px; font-weight: 800; }
.workflow-icon { display: grid; width: 118px; height: 118px; place-items: center; margin: 4px auto 28px; border: 1px solid #cfe6ec; border-radius: 50%; color: var(--cyan); background: var(--cyan-soft); }
.workflow-icon svg { width: 66px; height: 66px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workflow-copy { flex: 1; }
.workflow-category { display: block; color: var(--navy); font-size: 17px; font-weight: 750; }
.workflow-copy h2 { margin: 11px 0 12px; color: var(--cyan); font-size: 23px; line-height: 1.3; }
.workflow-copy p { margin: 0; color: var(--slate); font-size: 14px; line-height: 1.75; }
.workflow-arrow { display: inline-flex; align-items: center; margin-top: 24px; color: var(--cyan); font-size: 34px; line-height: 1; transition: transform .2s ease; }
.workflow-card:hover .workflow-arrow { transform: translateX(8px); }
.portal-footer { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 72px; padding: 20px; border-top: 1px solid var(--line); color: var(--slate); background: rgba(255,255,255,.9); font-size: 14px; }
.portal-footer svg { width: 22px; height: 22px; fill: none; stroke: var(--cyan); stroke-width: 1.7; stroke-linecap: round; }

/* Shared chrome for the four functional entry pages. */
.global-nav { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 10px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); background: #fff; }
.global-nav__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); font-size: 16px; font-weight: 800; text-decoration: none; }
.global-nav__brand::before { content: ""; width: 25px; height: 25px; border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 7px currentColor; }
.global-nav__home { display: inline-flex; align-items: center; gap: 7px; color: var(--cyan); font-size: 13px; font-weight: 700; text-decoration: none; }
.global-nav__home::before { content: "←"; font-size: 18px; }
.global-nav__home:hover { color: var(--cyan-dark); }

@media (max-width: 980px) {
  .portal-header { min-height: 78px; }
  .portal-intro { min-height: 110px; }
  .workflow { grid-template-columns: repeat(2, 1fr); gap: 38px 16px; }
  .workflow-line { display: none; }
  .workflow-card { min-height: 340px; margin-top: 0; border-width: 1px; }
}

@media (max-width: 620px) {
  .portal-header { padding: 14px 16px; }
  .portal-brand { gap: 11px; }
  .portal-brand strong { font-size: 23px; }
  .broach-mark { width: 38px; height: 38px; }
  .portal-main { width: min(100% - 28px, 520px); padding-top: 28px; }
  .portal-intro { display: none; }
  .workflow { grid-template-columns: 1fr; gap: 36px; }
  .workflow-card { min-height: 0; padding: 36px 20px 22px; }
  .workflow-icon { width: 86px; height: 86px; margin: 0 0 20px; }
  .workflow-icon svg { width: 48px; height: 48px; }
  .workflow-copy h2 { font-size: 21px; }
  .global-nav { min-height: 52px; padding: 9px 14px; }
  .global-nav__brand { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .workflow-card, .workflow-arrow { transition: none; }
}
/* ============================================================
   圆类拉刀设计 — 移动端适配补充样式
   使用方法：把本文件全部内容追加到 shared/design-system.css 末尾
   ============================================================ */

/* ---------- 全局基础 ---------- */
@media only screen and (max-width: 768px) {

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

  body {
    font-size: 15px;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
  }

  /* 所有可点击元素最小触摸区域 44px */
  a, button, input[type="button"], input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* ---------- 头部 ---------- */
  .portal-header {
    padding: 0.75rem 1rem;
  }

  .portal-brand strong {
    font-size: 1.05rem;
  }

  .broach-mark svg {
    width: 32px;
    height: 32px;
  }

  /* ---------- 主内容区 ---------- */
  .portal-main {
    padding: 1rem;
    max-width: 100%;
  }

  /* ---------- 首页 SVG 图纸 ---------- */
  .portal-intro {
    margin-bottom: 1.25rem;
  }

  .broach-drawing {
    max-width: 100%;
    height: auto;
    display: block;
  }

  /* ---------- 工作流卡片：横向改单列 ---------- */
  .workflow {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
  }

  /* 隐藏 PC 端的连接线 */
  .workflow-line {
    display: none !important;
  }

  .workflow-card {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    /* 增大点击反馈 */
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .workflow-card:active {
    transform: scale(0.98);
  }

  .workflow-number {
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .workflow-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .workflow-icon svg {
    width: 100%;
    height: 100%;
  }

  .workflow-copy {
    flex: 1;
    min-width: 0;
  }

  .workflow-category {
    font-size: 0.72rem;
    display: block;
    margin-bottom: 2px;
  }

  .workflow-copy h2 {
    font-size: 1rem;
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workflow-copy p {
    font-size: 0.78rem;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .workflow-arrow {
    flex-shrink: 0;
    font-size: 1.1rem;
  }

  /* ---------- 页脚 ---------- */
  .portal-footer {
    padding: 1rem;
    font-size: 0.78rem;
    text-align: center;
    gap: 6px;
  }

  .portal-footer svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
}

/* ============================================================
   子页面通用适配（花键计算 / 精度查询 / 拉削力 / 长度计算）
   如果子页面有自己的 class，以下规则会覆盖常见表单布局
   ============================================================ */
@media only screen and (max-width: 768px) {

  /* 表单容器 */
  form, .form-container, .calc-form, .input-group {
    width: 100%;
    box-sizing: border-box;
  }

  /* 输入框：全宽 + 足够触摸高度 */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px; /* 防止 iOS 聚焦时自动放大 */
    border-radius: 8px;
  }

  textarea {
    min-height: 80px;
  }

  /* 标签 */
  label {
    font-size: 0.88rem;
    display: block;
    margin-bottom: 4px;
  }

  /* 按钮：全宽或足够大 */
  button,
  input[type="button"],
  input[type="submit"],
  .btn, .button {
    min-height: 48px;
    padding: 12px 20px;
    font-size: 0.95rem;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  /* 结果展示区 */
  .result, .result-panel, .output, .calc-result {
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    margin-top: 14px;
    border-radius: 10px;
  }

  /* 表格：横向滚动容器 */
  .table-wrapper, .result-table-wrapper,
  div:has(> table), section:has(> table) {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 100%;
    font-size: 0.82rem;
    border-collapse: collapse;
  }

  th, td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* 两列/多列布局改单列 */
  .grid, .grid-2, .grid-3, .form-grid,
  .row, .two-col, .three-col {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .grid > *, .grid-2 > *, .grid-3 > *,
  .form-grid > *, .row > *, .two-col > *, .three-col > * {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* 子页面内的 SVG 图纸 */
  svg:not(.broach-mark svg):not(.workflow-icon svg) {
    max-width: 100%;
    height: auto;
  }

  /* 子页面返回/导航按钮 */
  .back-link, .nav-back, .breadcrumb {
    font-size: 0.85rem;
    padding: 8px 0;
  }
}

/* ============================================================
   超小屏适配（iPhone SE / 小屏安卓，宽度 ≤ 380px）
   ============================================================ */
@media only screen and (max-width: 380px) {

  .portal-main {
    padding: 0.75rem;
  }

  .workflow-card {
    padding: 14px;
    gap: 10px;
  }

  .workflow-copy h2 {
    font-size: 0.95rem;
  }

  .workflow-copy p {
    font-size: 0.75rem;
  }

  .workflow-icon {
    width: 36px;
    height: 36px;
  }

  input[type="text"],
  input[type="number"],
  select,
  textarea {
    font-size: 15px;
  }
}

/* ============================================================
   横屏适配（手机横屏时恢复部分双列）
   ============================================================ */
@media only screen and (max-width: 900px) and (orientation: landscape) {

  .workflow {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .workflow-card {
    width: calc(50% - 7px);
  }
}

