/* =========================================================================
   戎糖小记 · toolbox.css — 工具箱页面
   图片压缩 / 转格式 + PDF 转图片 + 直达链接
   浅粉底 + 白卡片 + 细线，公共样式都在 base.css
   ========================================================================= */

/* ------------------------------------------------------------- 首图：整屏 + 掀开盖子
   这张插画本身就是「桌面俯拍」：左边是人和猫，右边一大片留白，
   所以字放在右边，不跟插画打架。
   开场不用遮片也不用光圈——直接「掀开箱子盖」：一整块粉色盖子以底边为
   铰链向后倒下去，画从上面先露出来，导航也最先恢复。一层、只用 rotateX。
   ------------------------------------------------------------- */
.tool-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  /* 盖子要有透视才像真的在倒，不然只是被压扁 */
  perspective: 1600px;
  perspective-origin: 50% 50%;
  /* 文案整体往上提一点，别落在插画里的文件夹上 */
  padding-bottom: 9vh;
  overflow: hidden;
  isolation: isolate;
  background: #221a1d;
}

/* 插画：整幅 cover，右边留白给文字 */
.tool-hero_img { position: absolute; inset: 0; z-index: -2; }
.tool-hero_img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 46%;
}
/* 蒙版：和首页 / 小记 / 相册用同一套 —— 整张压暗，字反过来用白的。
   右下角再补一团暗（文字那一侧），字压在插画留白上也稳；
   顶部一条 150px 的暗边，给白色导航一个落脚点。 */
.tool-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(105% 92% at 100% 58%,
      rgba(20, 13, 16, .66) 0%,
      rgba(20, 13, 16, .24) 46%,
      rgba(20, 13, 16, 0) 74%),
    linear-gradient(180deg,
      rgba(24, 15, 18, .58) 0%,
      rgba(24, 15, 18, .14) 34%,
      rgba(24, 15, 18, .30) 62%,
      rgba(24, 15, 18, .80) 100%);
  pointer-events: none;
}
.tool-hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 150px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(24, 16, 20, .5), rgba(24, 16, 20, 0));
  pointer-events: none;
}

/* 文字：靠右，垂直居中。跳出 .shell 的 1160 上限，整块贴到视口右边，
   不再压住插画里的便签 / 花 / 文件夹 */
.tool-hero_body {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: none;
  padding-inline: clamp(20px, 4vw, 72px);
}
.tool-hero_inner {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: none;
}
.tool-hero_text { width: min(38%, 430px); }
.tool-hero .eyebrow { color: var(--pink-soft); margin-bottom: clamp(10px, 1.4vw, 16px); text-shadow: 0 1px 12px rgba(18, 10, 13, .45); }
.tool-hero .eyebrow::after { background: linear-gradient(90deg, #fff, var(--pink)); }
.tool-hero_title {
  font-size: clamp(28px, 3.6vw, 50px);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .28);
  margin-bottom: clamp(10px, 1.4vw, 16px);
}
.tool-hero_lede {
  font-size: clamp(13px, 1.15vw, 15.5px);
  line-height: 1.95;
  color: rgba(255, 255, 255, .86);
  max-width: 26em;
}
.tool-hero_meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: clamp(18px, 2.4vw, 26px) 0 0;
  /* 做成一张小标签：压在插画的花纹上也干净 */
  padding: 8px 16px 8px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .30);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.tool-hero_num {
  font-family: var(--font-round);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 700;
  line-height: 1;
  color: #ffd3de;
  font-variant-numeric: tabular-nums;
}
.tool-hero_label { font-size: 11px; letter-spacing: .2em; color: rgba(255, 255, 255, .78); }

/* ---- 盖子 ----
   一整块粉，盖住整屏；以底边为铰链向后倒 96°，画从上方先露出来。
   前缘一道白亮边 + 一层向上投的软影，才有「抬起来」的立体感。 */
.tool-lid {
  position: absolute;
  inset: 0;
  z-index: 5;
  background:
    radial-gradient(130% 80% at 50% 0%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #fdf5f7 0%, #fbe4ea 46%, #f6ccd6 100%);
  transform-origin: 50% 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
  will-change: transform;
}
/* 前缘：一道白亮边 + 抬起来时压在画上的软影 */
.tool-lid i {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .98) 50%,
    rgba(255, 255, 255, 0) 100%);
  box-shadow:
    0 0 24px 3px rgba(255, 255, 255, .7),
    0 -30px 46px 6px rgba(146, 82, 100, .16);
}
/* 底沿压一道细影，像盖在桌面上 */
.tool-lid::after {
  content: '';
  position: absolute;
  inset: auto 0 -1px;
  height: 1px;
  background: rgba(214, 69, 95, .16);
}

/* ---- 开场 ---- */
html.js body[data-page="toolbox"]:not(.is-ready) .tool-hero_text > * { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  html.js body[data-page="toolbox"]:not(.is-ready) .tool-lid {
    transform: rotateX(0deg);
  }
  html.js body[data-page="toolbox"].is-ready .tool-lid {
    animation: lidOpen 1.05s cubic-bezier(.52, .06, .28, 1) .06s both;
  }
  html.js body[data-page="toolbox"].is-ready .tool-hero_img img {
    animation: lidZoom 2.2s cubic-bezier(.22, .61, .36, 1) both;
  }
  html.js body[data-page="toolbox"].is-ready .tool-hero_text > * {
    animation: toolTextUp .8s var(--ease-soft) both;
  }
  html.js body[data-page="toolbox"].is-ready .tool-hero_text > *:nth-child(1) { animation-delay: .62s; }
  html.js body[data-page="toolbox"].is-ready .tool-hero_text > *:nth-child(2) { animation-delay: .70s; }
  html.js body[data-page="toolbox"].is-ready .tool-hero_text > *:nth-child(3) { animation-delay: .82s; }
  html.js body[data-page="toolbox"].is-ready .tool-hero_text > *:nth-child(4) { animation-delay: .94s; }

  /* 兜底：3.2 秒还没 ready，盖子直接撤掉，别挡着看 */
  html.js body[data-page="toolbox"]:not(.is-ready) .tool-lid {
    animation: lidGiveUp .5s 3.2s forwards;
  }
  html.js body[data-page="toolbox"]:not(.is-ready) .tool-hero_text > * {
    animation: toolTextUp .7s 3.2s both;
  }
}
@keyframes lidOpen {
  0%   { transform: rotateX(0deg); opacity: 1; }
  62%  { opacity: 1; }
  100% { transform: rotateX(-97deg); opacity: 0; }
}
@keyframes lidGiveUp { to { opacity: 0; visibility: hidden; } }
@keyframes lidZoom {
  from { transform: scale(1.045); }
  to   { transform: scale(1); }
}
@keyframes toolTextUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* 没有 JS / 关了动效：不要盖子 */
html:not(.js) .tool-lid { display: none; }
@media (prefers-reduced-motion: reduce) {
  .tool-lid { display: none; }
  html.js body[data-page="toolbox"] .tool-hero_text > * { opacity: 1; }
}

/* 窄屏：不再硬撑满屏 —— 插画按 5:4 完整露出（人、猫、工具箱都在），
   文案接在下面，一头一尾，比把字压在猫身上干净 */
/* 窄屏：首图铺满整屏。竖屏之后只能看到插画中间偏左的一条，
   所以 object-position 往左推到人物 + 猫身上；文字压在下半部的浅色渐变上 */
@media (max-width: 899px) {
  .tool-hero {
    display: flex;
    align-items: flex-end;
    min-height: 100svh;
    padding-top: calc(var(--header-h) + 16px);
    padding-bottom: clamp(26px, 5.5vh, 44px);
  }
  .tool-hero_img {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    overflow: hidden;
    isolation: isolate;
  }
  .tool-hero_img img { object-position: 30% 44%; }
  /* 手机：字压在底部，所以暗部往下压，上面留一点让插画露出来 */
  .tool-hero::after {
    background:
      radial-gradient(120% 66% at 14% 102%,
        rgba(20, 13, 16, .76) 0%,
        rgba(20, 13, 16, .30) 48%,
        rgba(20, 13, 16, 0) 76%),
      linear-gradient(180deg,
        rgba(24, 15, 18, .68) 0%,
        rgba(24, 15, 18, .30) 8%,
        rgba(24, 15, 18, .10) 26%,
        rgba(24, 15, 18, .18) 52%,
        rgba(24, 15, 18, .72) 82%,
        rgba(24, 15, 18, .88) 100%);
  }
  .tool-hero::before { height: 132px; }
  .tool-hero_body {
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
    /* 手机上也留出页边距，别让字贴着屏幕边 */
    padding: 0 var(--gutter);
  }
  .tool-hero_inner { justify-content: flex-start; }
  .tool-hero_text { width: 100%; }
  .tool-hero_title { font-size: clamp(27px, 7.6vw, 35px); margin-bottom: 10px; }
  .tool-hero_lede { font-size: 13.5px; max-width: none; line-height: 1.9; }
  .tool-hero_meta { margin-top: 14px; }
}

/* =========================================================================
   工具入口 / 处理面板 / 收尾
   （2026-11 换整屏首图时这段被误删，按设计稿恢复；
     变量换成站点实际有的 --line-2 / --rose-ink）
   ========================================================================= */
/* 首图下面第一段不必再撑那么高的上边距 */
.page-toolbox .section { padding-top: clamp(30px, 6vw, 58px); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: clamp(18px, 2.2vw, 26px);
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
}
.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--pink-soft);
}
.tool-card.is-soon { opacity: .76; }
.tool-card_icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--rose-ink);
  background: var(--pink-mist);
}
.tool-card_icon svg { width: 24px; height: 24px; }
.tool-card_body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tool-card_name { font-size: 16.5px; font-weight: 700; color: var(--ink); }
.tool-card_desc { font-size: 13.5px; line-height: 1.7; color: var(--ink-3); }
.tool-card_tag {
  margin-left: auto;
  flex: none;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--rose-ink);
  background: var(--pink-mist);
  border: 1px solid rgba(255, 188, 197, .5);
}
.tool-card--link .tool-card_tag { color: var(--ink-3); background: var(--pink-mist-2); }

/* ---- 处理面板 ---- */
.tool-panel {
  max-width: 880px;
  margin-inline: auto;
  padding: clamp(18px, 2.6vw, 32px);
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.tool-drop {
  display: block;
  padding: clamp(22px, 3vw, 36px);
  border: 1.5px dashed var(--pink);
  border-radius: var(--radius);
  background: var(--pink-mist-2);
  text-align: center;
  cursor: pointer;
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.tool-drop:hover,
.tool-drop.is-over { background: var(--pink-mist); border-color: var(--coral); }
.tool-drop_text { display: flex; flex-direction: column; gap: 6px; }
.tool-drop_text b { font-size: 15.5px; color: var(--ink); }
.tool-drop_text em { font-style: normal; font-size: 12.5px; color: var(--ink-3); }

.tool-opts {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: clamp(12px, 1.6vw, 18px);
  margin-top: clamp(16px, 2vw, 22px);
}
.tool-opt { display: flex; flex-direction: column; gap: 6px; min-width: 132px; }
.tool-opt > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tool-opt > span b { color: var(--rose-ink); font-weight: 700; }
.tool-select,
.tool-input {
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
}
.tool-range { width: 100%; accent-color: var(--coral); }
.tool-opts .btn { margin-left: auto; }

.tool-note { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.tool-note.is-bad { color: var(--rose-ink); }

.tool-results { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.tool-results--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

/* 图片工具：一行一张 */
.tool-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--pink-mist-2);
}
.tool-row_thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line-2);
}
.tool-row_main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tool-row_name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-row_meta { font-size: 12px; color: var(--ink-3); }
.tool-row_meta b { color: var(--rose-ink); }
.tool-row_meta s { color: var(--ink-4); }
.tool-row_dl {
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rose-ink);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 188, 197, .55);
  background: #fff;
}
.tool-row_dl:hover { background: var(--pink-mist); }

/* PDF 工具：一页一张卡 */
.tool-shot {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
.tool-shot img { width: 100%; height: auto; display: block; }
.tool-shot_bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line-2);
}
.tool-shot_bar span { font-size: 12px; color: var(--ink-3); }
.tool-shot_dl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rose-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--pink);
}
.tool-shot_dl:hover { color: var(--coral); }

.tool-progress {
  margin-top: 16px;
  height: 8px;
  border-radius: 999px;
  background: var(--pink-mist);
  overflow: hidden;
}
.tool-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rose), var(--coral));
  transition: width .3s var(--ease);
}

/* ---- 收尾 ---- */
.tool-foot-card {
  max-width: 720px;
  margin-inline: auto;
  padding: clamp(26px, 4vw, 44px);
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.tool-foot_title {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 12px;
}
.tool-foot_lede {
  font-size: clamp(13.5px, 1.2vw, 15px);
  line-height: 1.9;
  color: var(--ink-2);
  max-width: 30em;
  margin: 0 auto 20px;
}

@media (max-width: 560px) {
  .tool-opts { flex-direction: column; align-items: stretch; }
  .tool-opts .btn { margin-left: 0; justify-content: center; }
  .tool-opt { min-width: 0; }
  .tool-row_thumb { width: 44px; height: 44px; }
  .tool-row { flex-wrap: wrap; }
  .tool-row_dl { margin-left: auto; }
}
