/* Free TIFF tools: the tool first, then short content. Same palette as the viewer. */
:root {
  --fg: #16232b; --muted: #53636d; --faint: #82919a; --line: #dfe5e9; --bg: #ffffff; --soft: #f3f6f7;
  --accent: #0b6e79; --accent-hover: #095b64; --accent-soft: #e2f1f2; --danger: #b42318; --ok: #1d7a46;
  --ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 10px 30px rgba(16, 35, 45, .10), 0 1px 3px rgba(16, 35, 45, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--ui); color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { width: min(1080px, 100% - 32px); margin: 0 auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; flex: none; }

/* header and footer */
.site-head { border-bottom: 1px solid var(--line); background: #fff; }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; padding: 8px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--fg); text-decoration: none; margin-right: auto; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-head nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; }
.site-head nav a:hover { background: var(--soft); color: var(--fg); }
.site-head nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.site-foot { margin-top: 72px; border-top: 1px solid var(--line); background: var(--soft); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0; }
.site-foot a { color: var(--muted); }
.foot-private { display: flex; align-items: center; color: var(--fg); margin: 0; }
.foot-note { color: var(--faint); margin: 0; }

/* hero + tool */
.hero { background: linear-gradient(180deg, #eef6f7, #fff 70%); padding: 40px 0 28px; }
.hero h1 { margin: 0; font-size: clamp(30px, 4.4vw, 44px); line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; }
.hero .lead { margin: 12px 0 24px; font-size: 18px; color: var(--muted); max-width: 760px; text-wrap: pretty; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--fg); font: inherit; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.large { height: 48px; padding: 0 22px; font-size: 16px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.tool { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; }
.t-drop {
  display: grid; justify-items: center; gap: 10px; padding: 36px 20px 28px; text-align: center;
  border: 2px dashed #c6d3d8; border-radius: 14px; background: var(--soft);
}
.tool.dragging .t-drop { border-color: var(--accent); background: var(--accent-soft); }
.t-drop.compact { padding: 14px; grid-template-columns: auto 1fr auto; text-align: left; justify-items: start; align-items: center; }
.t-drop.compact .drop-icon { width: 30px; height: 30px; }
.t-drop.compact .t-drop-title { font-size: 16px; }
.t-drop.compact .t-choose { display: none; }
.t-drop.compact .t-drop-note { grid-column: 3; }
.coarse { display: none; }
@media (pointer: coarse) { .fine { display: none; } .coarse { display: inline; } }
.drop-icon { width: 46px; height: 46px; color: var(--accent); }
.t-drop-title { margin: 0; font-size: 21px; font-weight: 650; }
.t-drop-note { margin: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; flex-wrap: wrap; gap: 0 6px; }
.t-drop-note .i { color: var(--accent); }
.t-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding: 10px 36px 10px 10px; border: 1px solid var(--line); border-radius: 12px; }
.card.bad { border-color: #f1c4bf; background: #fff6f5; }
.card.bad .sub { color: var(--danger); }
.thumb { width: 56px; height: 72px; display: grid; place-items: center; background: var(--soft); border-radius: 4px; overflow: hidden; }
.thumb canvas { max-width: 100%; max-height: 100%; box-shadow: 0 0 0 1px var(--line); opacity: 0; transition: opacity .2s; }
.thumb.ready canvas { opacity: 1; }
.meta { min-width: 0; display: grid; }
.meta .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; }
.meta .sub { color: var(--muted); font-size: 13px; }
.remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer; }
.remove:hover { background: var(--soft); color: var(--fg); }
.t-options { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; color: var(--muted); font-size: 15px; }
.t-options label { display: inline-flex; align-items: center; gap: 8px; }
.t-options select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: inherit; color: var(--fg); background: #fff; }
.t-options .check input { width: 18px; height: 18px; accent-color: var(--accent); }
.t-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.t-summary { color: var(--muted); font-size: 15px; }
.t-progress { display: grid; gap: 6px; }
.track { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.status { font-size: 14px; color: var(--muted); }
.t-done { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 14px; border-radius: 12px; background: #eaf6ee; color: var(--ok); }
.t-done p { margin: 0; font-weight: 600; }

/* viewer page */
.hero.wide .wrap { width: min(1280px, 100% - 24px); }
.viewer-box { display: grid; gap: 10px; }
.viewer-frame { width: 100%; height: min(78vh, 820px); min-height: 520px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); background: #e6eaed; }

/* content */
.content h2, .article h2 { font-size: 26px; line-height: 1.25; margin: 48px 0 14px; letter-spacing: -.005em; }
.article h3 { font-size: 19px; margin: 26px 0 6px; }
.how ol { padding-left: 22px; margin: 0; display: grid; gap: 8px; max-width: 780px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.feat { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; }
.feat h3 { margin: 0 0 6px; font-size: 17px; }
.feat p { margin: 0; color: var(--muted); font-size: 15px; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; max-width: 820px; }
.faq summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 17px; list-style-position: outside; }
.faq details p { margin: 0 0 14px; color: var(--muted); }
.rel { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--fg); }
.rel:hover { border-color: var(--accent); background: var(--accent-soft); }
.rel span { color: var(--muted); font-size: 14px; }
.cta { margin-top: 48px; display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; padding: 24px 28px; border-radius: 18px; background: #0f3d44; color: #fff; }
.cta h2 { margin: 0 0 6px !important; font-size: 22px !important; }
.cta p { margin: 0; color: #cfe7ea; max-width: 640px; }
.article { max-width: 820px; }
.article h1 { font-size: clamp(30px, 4.4vw, 42px); line-height: 1.15; margin: 40px 0 10px; }
.article .lead { font-size: 18px; color: var(--muted); }
.article li { margin: 6px 0; }
.toc { background: var(--soft); border-radius: 12px; padding: 14px 20px; margin: 22px 0 8px; }
.toc ol { margin: 6px 0 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.compare { width: 100%; border-collapse: collapse; font-size: 15px; margin: 6px 0 14px; display: block; overflow-x: auto; }
.compare th, .compare td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.compare thead th { background: var(--soft); }
.tools-box { margin-top: 44px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 18px; background: #f8fbfb; }
.tools-box h2 { margin-top: 0 !important; }

@media (max-width: 720px) {
  .site-head nav a { padding: 4px 8px; font-size: 14px; }
  .hero { padding-top: 24px; }
  .t-drop { padding: 26px 14px 20px; }
  .t-drop.compact { grid-template-columns: auto 1fr; }
  .t-drop.compact .t-drop-note { grid-column: 1 / -1; justify-content: flex-start; }
  .toc ol { columns: 1; }
  .viewer-frame { height: 72vh; min-height: 420px; }
}
@media (prefers-reduced-motion: reduce) { .fill, .thumb canvas { transition: none; } }
