/* SizeMyDoc shared styles */
:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #1c2430;
  --muted: #5d6673;
  --line: #d9d3c5;
  --accent: #0b5d4e;
  --accent-ink: #ffffff;
  --accent-soft: #e4f0ec;
  --ok: #0b6b3a;
  --ok-bg: #e3f3e8;
  --bad: #9b2c1f;
  --bad-bg: #fbe7e3;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* Site header and navigation */
.site-head { border-bottom: 1px solid var(--line); background: var(--card); }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: 8px;
  color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--paper); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 640px) {
  .site-head .wrap { flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .nav { margin-left: -10px; width: calc(100% + 20px); padding-bottom: 6px; }
}

/* Page intro */
.crumbs { font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.crumbs a { color: var(--muted); }
.top { padding-bottom: 8px; }
h1 { font-size: clamp(24px, 5vw, 34px); line-height: 1.15; letter-spacing: -0.02em; margin: 12px 0 6px; text-wrap: balance; }
.lede { color: var(--muted); margin: 0 0 14px; max-width: 62ch; }
.privacy {
  display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; margin-bottom: 18px;
}

/* Tool layout */
.tool { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
select, input[type="number"] {
  width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
select:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.field { margin-bottom: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.seg button { min-height: 44px; border: 0; background: #fff; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 110px; padding: 16px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; margin-bottom: 12px;
}
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop.over { border-color: var(--accent); background: #eef6f3; }
.drop strong { font-size: 16px; }
.drop small { color: var(--muted); font-weight: 400; }
.linkbtn { background: none; border: 0; padding: 6px 0; margin: 0 0 10px; font: inherit; font-size: 14px; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 32px; }
.note { font-size: 12.5px; color: var(--muted); margin: 0; }
.stage {
  background: repeating-conic-gradient(#ece7db 0% 25%, #f8f5ee 0% 50%) 50% / 16px 16px;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  display: flex; align-items: center; justify-content: center; min-height: 220px;
}
canvas.preview { max-width: 100%; max-height: 340px; height: auto; width: auto; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); touch-action: none; cursor: grab; }
canvas.preview.dragging { cursor: grabbing; }
.empty { color: var(--muted); font-size: 14px; text-align: center; }
.zoom { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.zoom label { margin: 0; white-space: nowrap; }
.zoom input { flex: 1; min-height: 44px; accent-color: var(--accent); }
.result { border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; background: #f1ede3; overflow-wrap: anywhere; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.result b { font-variant-numeric: tabular-nums; }
.btn {
  display: block; width: 100%; min-height: 48px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; font-size: 16px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.savebox p { margin: 12px 0 6px; }
.savebox img { max-width: 100%; max-height: 220px; border: 1px solid var(--line); }
.filelist { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14px; }
.filelist li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.filelist li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist button { min-width: 36px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font: inherit; }

/* Home page tool grid */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 8px 0 8px; }
.tile {
  display: block; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); text-decoration: none;
}
.tile:hover { border-color: var(--accent); }
.tile strong { display: block; font-size: 17px; margin-bottom: 4px; color: var(--accent); }
.tile span { font-size: 14px; color: var(--muted); }
.home-section h2 { font-size: 20px; margin: 28px 0 8px; }

/* Article content */
.content { margin: 36px auto; max-width: 70ch; }
.content h2 { font-size: 22px; letter-spacing: -0.01em; margin: 30px 0 8px; }
.content h3 { font-size: 16px; margin: 18px 0 4px; }
.content p, .content li { color: #333c48; }
.content ol, .content ul { padding-left: 22px; }
.content table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 14.5px; }
.content th, .content td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.content th { font-size: 13px; color: var(--muted); font-weight: 700; }
.content td { font-variant-numeric: tabular-nums; }
.related { margin: 36px 0 0; }
.related h2 { font-size: 18px; margin: 0 0 10px; }

/* Ad slots: height is reserved so the page doesn't jump when an ad loads. */
.ad { margin: 48px auto 8px; max-width: 728px; }
.ad-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 4px; }
.ad-box {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 280px; border: 1px dashed #b9b1a0; border-radius: 6px; background: #efeadf;
  color: #8a8272; font-size: 13px; padding: 8px;
}
.ad-box.live { border: 0; background: none; padding: 0; display: block; }
@media (min-width: 760px) { .ad-box.wide { min-height: 90px; } }
.content .ad { margin: 28px auto; }
/* 900px must match fixed.minWidth for the top ad in build.mjs. */
.ad-top { display: none; }
@media (min-width: 900px) {
  .top.has-ad { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; padding-bottom: 36px; }
  .ad-top { display: block; width: 300px; margin: 12px 0 0; }
  .ad-top .ad-box { min-height: 250px; height: 250px; }
}

/* Footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0 32px; color: var(--muted); font-size: 13.5px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 10px; }
.site-foot nav a { color: var(--muted); }
.site-foot p { margin: 4px 0; }
