/* ============================================================
   PDF Studio — editorial / print design system
   PDF-red ink · warm paper · hairline rules · serif display.
   Deliberately not the generic SaaS look.
   ============================================================ */
:root {
    --paper: #f6f3ec;          /* page background (warm paper) */
    --sheet: #ffffff;          /* surfaces = sheets of paper */
    --ink: #1a1712;            /* near-black warm ink */
    --ink-2: #5c554c;          /* secondary text */
    --muted: #8c8377;          /* tertiary */
    --rule: #e4ddd994;         /* hairline */
    --rule-1: #ddd5c7;         /* solid hairline */
    --rule-2: #c8bfae;         /* stronger rule */
    --red: #d6231f;            /* PDF red (primary) */
    --red-ink: #b1140f;        /* red hover/active */
    --red-wash: #fdeceb;       /* red tint bg */
    --red-line: #f1b9b6;       /* red border */
    --ok: #1f7a3d;
    --ok-wash: #e8f4ec;
    --r: 6px;                  /* tight, not pill */
    --r-lg: 10px;
    --shadow: 0 1px 0 var(--rule-1), 0 18px 40px -28px rgba(26,23,18,.5);
    --shadow-pop: 0 30px 60px -24px rgba(26,23,18,.45);
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --sans: -apple-system, "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    --fast: .16s cubic-bezier(.2,.6,.2,1);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0; min-height: 100%;
    background: var(--paper); color: var(--ink);
    font-family: var(--sans); font-size: 16px;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
svg.ic { display: block; flex: none; }
::selection { background: var(--red); color: #fff; }
.mono { font-family: var(--mono); font-size: .82em; letter-spacing: -.02em; }

/* ---- brand mark (logo lockup: icon + wordmark, all in one SVG) ---- */
.brand-mark { display: block; height: 38px; width: auto; flex: none; }
.brand { display: inline-flex; align-items: center;
    color: var(--ink); text-decoration: none; }
.topbar .brand-mark { height: 30px; }
.foot-brand .brand-mark { height: 44px; }

/* ---- buttons ---- */
.btn {
    --bg: var(--sheet); --bd: var(--rule-2); --fg: var(--ink);
    appearance: none; border: 1.5px solid var(--bd); background: var(--bg);
    color: var(--fg); font: 600 14px/1 var(--sans); padding: 11px 18px;
    border-radius: var(--r); cursor: pointer; display: inline-flex;
    align-items: center; gap: 9px; transition: transform var(--fast),
    background var(--fast), border-color var(--fast), color var(--fast);
    white-space: nowrap;
}
.btn:hover { background: #efeadf; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--red-line); outline-offset: 2px; }
.btn.primary { --bg: var(--red); --bd: var(--red); --fg: #fff; }
.btn.primary:hover { --bg: var(--red-ink); --bd: var(--red-ink); }
.btn.ghost { --bg: transparent; --bd: transparent; --fg: var(--ink-2); padding: 9px 10px; }
.btn.ghost:hover { background: transparent; color: var(--red); }
.btn.danger { --bg: var(--red-wash); --bd: var(--red-line); --fg: var(--red-ink); }
.btn.danger:hover { background: #fbdedc; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.sm { padding: 8px 12px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 15.5px; }

.kbd { font: 600 12px/1 var(--mono); background: var(--sheet);
    border: 1px solid var(--rule-2); border-bottom-width: 2px;
    border-radius: 4px; padding: 3px 6px; color: var(--ink-2); }

/* ============================================================
   Master layout: header / main / footer
   ============================================================ */
.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--paper); border-bottom: 1px solid var(--rule-1);
}
.site-nav {
    max-width: 1180px; margin: 0 auto; padding: 16px 28px;
    display: flex; align-items: center; gap: 28px;
}
.site-nav .brand { margin-right: auto; }
.nav-links { display: flex; gap: 4px; }
.nav-link {
    font: 600 14.5px/1 var(--sans); color: var(--ink-2); padding: 9px 14px;
    border-radius: var(--r); position: relative; transition: color var(--fast);
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--red); }
.nav-link.active::after {
    content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px;
    height: 2px; background: var(--red);
}
.nav-cta { margin-left: 4px; }

/* language picker (footer dropdown) */
.lang-picker { position: relative; }
.lang-picker > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 12px; border: 1px solid var(--rule-1);
    border-radius: 999px; background: var(--sheet);
    font: 600 13px/1 var(--sans); color: var(--ink);
    transition: background var(--fast), border-color var(--fast);
}
.lang-picker > summary::-webkit-details-marker,
.lang-picker > summary::marker { display: none; content: ''; }
.lang-picker > summary:hover { background: var(--paper); border-color: var(--rule-2); }
.lang-picker > summary .ic { color: var(--red); }
.lang-picker > summary .chev { color: var(--muted); margin-left: 2px;
    transition: transform var(--fast); font-size: 11px; }
.lang-picker[open] > summary .chev { transform: rotate(180deg); }

.lang-menu {
    position: absolute; bottom: calc(100% + 8px); left: 0;
    min-width: 220px; background: var(--sheet);
    border: 1px solid var(--rule-1); border-radius: var(--r);
    box-shadow: var(--shadow-pop); padding: 6px; z-index: 50;
}
.lang-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px; border-radius: 5px;
    color: var(--ink); text-decoration: none;
    transition: background var(--fast);
}
.lang-menu a:hover { background: var(--paper); }
.lang-menu a.on { background: var(--red-wash); color: var(--red-ink); }
.lang-menu a .iso {
    font: 700 11px/1 var(--mono); color: var(--muted);
    width: 22px; letter-spacing: .04em;
}
.lang-menu a.on .iso { color: var(--red); }
.lang-menu a .name { font-size: 14px; font-weight: 500; }
.lang-menu a.on .name { font-weight: 700; }

.site-footer {
    margin-top: 80px; border-top: 2px solid var(--ink);
    background: var(--paper);
}
.foot-top {
    max-width: 1180px; margin: 0 auto; padding: 48px 28px 28px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 30px; flex-wrap: wrap;
}
.foot-top .foot-brand { flex: 1; min-width: 280px; max-width: 560px; }
.foot-cols {
    max-width: 1180px; margin: 0 auto; padding: 6px 28px 30px;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 30px;
    border-top: 1px solid var(--rule-1); padding-top: 28px;
}
.foot-lang { margin-top: 4px; flex: none; }
.foot-brand p { color: var(--ink-2); font-size: 14px; line-height: 1.65;
    max-width: 560px; margin: 14px 0 0; }
.foot-col h4 { font: 700 12px/1 var(--mono); letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.foot-col a { display: block; padding: 6px 0; color: var(--ink-2);
    font-size: 14.5px; transition: color var(--fast); }
.foot-col a:hover { color: var(--red); }
.foot-base {
    max-width: 1180px; margin: 0 auto; padding: 18px 28px 40px;
    border-top: 1px solid var(--rule-1); display: flex;
    justify-content: space-between; gap: 14px; flex-wrap: wrap;
    color: var(--muted); font-size: 13px;
}

/* ============================================================
   Landing (editorial)
   ============================================================ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.lp-hero { padding: 94px 0 78px; border-bottom: 1px solid var(--rule-1);
    text-align: center; max-width: 840px; margin: 0 auto; }
.lp-eyebrow { font: 700 12px/1 var(--mono); letter-spacing: .18em;
    text-transform: uppercase; color: var(--red); display: inline-flex;
    align-items: center; gap: 14px; margin-bottom: 30px; }
.lp-eyebrow::before, .lp-eyebrow::after { content: ""; width: 26px;
    height: 2px; background: var(--red); display: inline-block; }
.lp-hero h1 {
    font: 600 clamp(38px, 5.6vw, 70px)/1.06 var(--serif);
    letter-spacing: -.5px; margin: 0 0 22px; color: var(--ink);
}
.lp-hero h1 .red { color: var(--red); font-style: italic; }
.lp-hero p { font-size: 19px; line-height: 1.62; color: var(--ink-2);
    max-width: 560px; margin: 0 auto 32px; }
.lp-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.lp-note { color: var(--muted); font-size: 12.5px; letter-spacing: .04em;
    margin-top: 18px; }

/* feature rows — ruled, editorial, not glossy cards */
.lp-section { padding: 70px 0; border-bottom: 1px solid var(--rule-1); }
.lp-section h2 { font: 600 clamp(28px,3.4vw,40px)/1.1 var(--serif);
    letter-spacing: -.3px; margin: 0 0 8px; }
.lp-section .sub { color: var(--ink-2); font-size: 17px; margin: 0 0 40px; }
.feat-rows { display: grid; gap: 0; }
.feat {
    display: grid; grid-template-columns: 56px 220px 1fr; gap: 26px;
    align-items: baseline; padding: 26px 4px;
    border-top: 1px solid var(--rule-1);
}
.feat:last-child { border-bottom: 1px solid var(--rule-1); }
.feat .no { font: 700 14px/1 var(--mono); color: var(--red); }
.feat h3 { font: 600 21px/1.2 var(--serif); margin: 0; }
.feat p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.65; }
.feat:hover { background: #fbf9f3; }

.seo-copy { padding: 64px 0; max-width: 760px; }
.seo-copy h2 { font: 600 30px/1.15 var(--serif); margin: 36px 0 12px; }
.seo-copy p { color: var(--ink-2); line-height: 1.78; font-size: 16px; }
.steps { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 16px; align-items: flex-start;
    color: var(--ink-2); line-height: 1.6; }
.steps .num { flex: none; width: 28px; height: 28px; border: 1.5px solid var(--red);
    color: var(--red); font: 700 13px/1 var(--mono); border-radius: 50%;
    display: grid; place-items: center; }

/* legal pages */
.legal { max-width: 760px; margin: 0 auto; padding: 70px 0 30px;
    color: var(--ink-2); line-height: 1.75; font-size: 16px; }
.legal h1 { font: 600 clamp(32px,4.4vw,46px)/1.05 var(--serif);
    letter-spacing: -.4px; color: var(--ink); margin: 0 0 8px; }
.legal h2 { font: 600 21px/1.3 var(--serif); color: var(--ink);
    margin: 36px 0 10px; padding-top: 20px;
    border-top: 1px solid var(--rule-1); }
.legal p { margin: 0 0 14px; }
.legal a { color: var(--red); text-decoration: underline;
    text-underline-offset: 2px; }
.legal .updated { font: 600 12px/1 var(--mono); letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 28px; }
.legal .legal-links { margin-top: 36px; padding-top: 20px;
    border-top: 1px solid var(--rule-1); }

/* About page (editorial, not legal-looking) */
.about-hero { max-width: 720px; margin: 0 auto; padding: 56px 0 28px;
    text-align: center; }
.about-eyebrow { font: 700 11px/1 var(--mono); letter-spacing: .18em;
    text-transform: uppercase; color: var(--red); margin-bottom: 14px; }
.about-hero h1 { font: 600 clamp(36px,5vw,52px)/1.05 var(--serif);
    letter-spacing: -.5px; color: var(--ink); margin: 0 0 16px; }
.about-tagline { font-size: 18px; line-height: 1.55; color: var(--ink-2);
    margin: 0 auto; max-width: 580px; }

.about-author { max-width: 720px; margin: 32px auto 48px;
    display: flex; align-items: center; gap: 18px; padding: 20px 22px;
    background: var(--sheet); border: 1px solid var(--rule-1);
    border-left: 4px solid var(--red); border-radius: var(--r-lg);
    box-shadow: var(--shadow); }
.aa-avatar { flex: none; width: 56px; height: 56px; border-radius: 50%;
    background: var(--red-wash); color: var(--red);
    display: grid; place-items: center;
    font: 700 17px/1 var(--mono); letter-spacing: .04em;
    border: 1.5px solid var(--red-line); }
.aa-body { flex: 1; min-width: 0; }
.aa-label { font: 700 10.5px/1 var(--mono); letter-spacing: .14em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.aa-name { font: 700 18px/1.1 var(--serif); color: var(--ink); }
.aa-role { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.aa-links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 14px; }
.aa-links a { display: inline-flex; align-items: center; gap: 6px;
    font: 600 13px/1 var(--sans); color: var(--red);
    text-decoration: none; border-bottom: 1px solid transparent;
    padding-bottom: 1px; transition: border-color var(--fast); }
.aa-links a:hover { border-bottom-color: var(--red); }
.aa-links .ic { color: var(--red); }

.about-body { max-width: 720px; margin: 0 auto;
    color: var(--ink-2); line-height: 1.75; font-size: 16px; }
.about-body h2 { font: 600 22px/1.3 var(--serif); color: var(--ink);
    margin: 36px 0 12px; padding-top: 20px;
    border-top: 1px solid var(--rule-1); }
.about-body h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.about-body p { margin: 0 0 14px; }
.about-body em { color: var(--ink); font-style: italic; }
.about-body strong { color: var(--ink); font-weight: 700; }
.about-body a { color: var(--red); text-decoration: underline;
    text-underline-offset: 2px; font-weight: 600; }
.about-body a:hover { color: var(--red-ink); }

.about-more { max-width: 720px; margin: 48px auto 24px;
    padding: 20px 0 0; border-top: 1px solid var(--rule-1);
    display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; }
.about-more a { display: inline-flex; align-items: center; gap: 7px;
    color: var(--ink-2); font: 600 14px/1 var(--sans);
    text-decoration: none; transition: color var(--fast); }
.about-more a:hover { color: var(--red); }
.about-more .ic { color: var(--red); }

/* ============================================================
   Tools hub + related lists (ruled grid, not floaty cards)
   ============================================================ */
.hub-head { padding: 70px 0 40px; border-bottom: 1px solid var(--rule-1); }
.hub-head .ey { font: 700 12px/1 var(--mono); letter-spacing: .16em;
    text-transform: uppercase; color: var(--red); margin-bottom: 16px; }
.hub-head h1 { font: 600 clamp(34px,4.6vw,56px)/1.04 var(--serif);
    letter-spacing: -.4px; margin: 0 0 12px; }
.hub-head p { color: var(--ink-2); font-size: 17px; margin: 0; }

.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr);
    border-left: 1px solid var(--rule-1); border-top: 1px solid var(--rule-1);
    margin: 22px 0 0; }
.hub-section { margin: 40px 0 60px; }
.hub-section h2 { font: 600 22px/1.2 var(--serif); margin: 0;
    padding-bottom: 12px; border-bottom: 2px solid var(--ink);
    letter-spacing: -.2px; }
.hub-section .hub-grid { margin: 0; }

/* breadcrumb on hub / legal / about (sits above page heading) */
.bread { font: 600 11.5px/1 var(--mono); letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted);
    padding: 22px 0 4px; display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; }
.bread a { color: var(--ink-2); text-decoration: none;
    transition: color var(--fast); }
.bread a:hover { color: var(--red); }
.bread span { color: var(--rule-2); }
.bread .cur { color: var(--ink); }

/* breadcrumb folded into the tool-page eyebrow */
.t-eyebrow.t-crumb { display: inline-flex; align-items: center; gap: 8px; }
.t-eyebrow.t-crumb a { color: var(--ink-2); text-decoration: none;
    transition: color var(--fast); }
.t-eyebrow.t-crumb a:hover { color: var(--red); }
.t-eyebrow.t-crumb span { color: var(--rule-2); font-weight: 400; }
.hub-card {
    display: flex; gap: 16px; align-items: flex-start; padding: 26px 24px;
    border-right: 1px solid var(--rule-1); border-bottom: 1px solid var(--rule-1);
    color: var(--ink); position: relative; transition: background var(--fast);
}
.hub-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--red); transform: scaleY(0);
    transform-origin: top; transition: transform var(--fast); }
.hub-card:hover { background: var(--sheet); }
.hub-card:hover::before { transform: scaleY(1); }
.hub-card.flag { background: var(--red-wash); }
.hub-card .hc-ic { width: 40px; height: 40px; flex: none; color: var(--red);
    display: grid; place-items: center; border: 1.5px solid var(--red-line);
    border-radius: var(--r); background: var(--sheet); }
.hub-card h3 { margin: 0 0 5px; font: 600 17px/1.2 var(--serif); }
.hub-card p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }

/* ============================================================
   Tool page (ToolShell content)
   ============================================================ */
.tool-wrap { max-width: 720px; margin: 0 auto; padding: 56px 28px 30px; }
.tool-hero { text-align: center; padding: 8px 0 34px; margin-bottom: 36px;
    border-bottom: 1px solid var(--rule-1); display: flex;
    flex-direction: column; align-items: center; gap: 0; }
.tool-hero .t-ic { width: 60px; height: 60px; color: var(--red);
    border: 2px solid var(--red); border-radius: var(--r-lg);
    display: grid; place-items: center; background: var(--red-wash);
    margin-bottom: 22px; }
.tool-hero .t-eyebrow { font: 700 11px/1 var(--mono); letter-spacing: .18em;
    text-transform: uppercase; color: var(--red); margin-bottom: 14px; }
.tool-hero h1 { font: 600 clamp(32px,4.4vw,46px)/1.04 var(--serif);
    letter-spacing: -.4px; margin: 0 0 12px; }
.tool-hero p { margin: 0 auto; color: var(--ink-2); font-size: 17px;
    line-height: 1.55; max-width: 480px; }

.tool-card { background: var(--sheet); border: 1px solid var(--rule-1);
    border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 26px; }

.tool-drop {
    border: 2px dashed var(--rule-2); border-radius: var(--r);
    padding: 52px 24px; text-align: center; cursor: pointer;
    transition: border-color var(--fast), background var(--fast);
    background: #fcfaf5;
}
.tool-drop:hover, .tool-drop.drag {
    border-color: var(--red); background: var(--red-wash);
}
.tool-drop .blob { width: 64px; height: 64px; margin: 0 auto 16px;
    border: 2px solid var(--red); color: var(--red); border-radius: var(--r-lg);
    display: grid; place-items: center; background: var(--red-wash); }
.tool-drop h2 { font: 600 21px/1.2 var(--serif); margin: 0 0 4px; }
.tool-drop p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

.filelist { display: flex; flex-direction: column; }
.filerow { display: flex; align-items: center; gap: 12px; padding: 14px 4px;
    border-bottom: 1px solid var(--rule-1); }
.filerow:first-child { border-top: 1px solid var(--rule-1); }
.filerow .ic { color: var(--red); }
.filerow .fn { flex: 1; font-weight: 600; font-size: 14.5px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
.filerow .fsz { color: var(--muted); font: 500 12px/1 var(--mono); }
.filerow .x { border: none; background: none; color: var(--muted);
    cursor: pointer; padding: 5px; border-radius: 4px; display: grid; }
.filerow .x:hover { background: var(--red-wash); color: var(--red); }
.filelist-actions { display: flex; gap: 8px; margin-top: 14px; }

.tool-options { margin: 22px 0 0; padding-top: 22px;
    border-top: 1px dashed var(--rule-2); display: grid; gap: 16px; }
.tool-options .opt label { display: block; font: 700 11px/1 var(--mono);
    letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
    margin-bottom: 8px; }
.tool-options input[type=text], .tool-options input[type=number],
.tool-options select {
    width: 100%; background: var(--sheet); border: 1.5px solid var(--rule-2);
    color: var(--ink); border-radius: var(--r); padding: 10px 12px;
    font: 500 14.5px/1.2 var(--sans);
}
.tool-options input:focus, .tool-options select:focus {
    outline: none; border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-line); }
.tool-options .opt-row { display: flex; gap: 16px; flex-wrap: wrap; }
.tool-options .opt-row > .opt { flex: 1; min-width: 140px; }
.seg-pills { display: flex; flex-wrap: wrap; gap: 0;
    border: 1.5px solid var(--rule-2); border-radius: var(--r);
    overflow: hidden; width: fit-content; }
.seg-pills button { border: none; background: var(--sheet); color: var(--ink-2);
    padding: 10px 16px; cursor: pointer; font: 600 13.5px/1 var(--sans);
    border-right: 1.5px solid var(--rule-2); transition: all var(--fast); }
.seg-pills button:last-child { border-right: none; }
.seg-pills button:hover { background: #efeadf; }
.seg-pills button.on { background: var(--red); color: #fff; }

.tool-run { margin-top: 24px; display: flex; align-items: center; gap: 16px;
    flex-wrap: wrap; }
.hint-inline { color: var(--muted); font-size: 13px; }
.tool-msg { margin-top: 18px; padding: 13px 16px; border-radius: var(--r);
    font-size: 14px; font-weight: 600; display: flex; align-items: center;
    gap: 10px; border: 1px solid; }
.tool-msg.ok { background: var(--ok-wash); color: var(--ok);
    border-color: #bfe0c9; }
.tool-msg.ok .ic { color: var(--ok); }
.tool-msg.err { background: var(--red-wash); color: var(--red-ink);
    border-color: var(--red-line); }

.seo-block { margin-top: 56px; }
.seo-block h2 { font: 600 26px/1.15 var(--serif); margin: 0 0 18px;
    padding-bottom: 12px; border-bottom: 1px solid var(--rule-1); }
.howto, .faq { color: var(--ink-2); line-height: 1.75; font-size: 15.5px; }
.howto ol { padding-left: 22px; display: grid; gap: 11px; }
.howto li::marker { color: var(--red); font-weight: 700; }
.faq h3 { color: var(--ink); font: 600 17px/1.3 var(--serif); margin: 20px 0 5px; }

.related { display: grid; grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--rule-1); border-left: 1px solid var(--rule-1); }
.rel { display: flex; gap: 12px; align-items: center; padding: 16px;
    border-right: 1px solid var(--rule-1); border-bottom: 1px solid var(--rule-1);
    color: var(--ink); transition: background var(--fast);
    /* Grid items default to min-width:auto, so the nowrap tagline below would
       force the track wider than the viewport. Allow the cell to shrink so the
       ellipsis can kick in instead of overflowing. */
    min-width: 0; }
.rel:hover { background: var(--sheet); }
.rel .ic { color: var(--red); flex: none; }
.rel span { display: flex; flex-direction: column; min-width: 0; }
.rel b { font: 600 14.5px/1.3 var(--serif); }
.rel em { font-style: normal; color: var(--muted); font-size: 12px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Blazor's built-in error toast. Hidden by default; Blazor sets
   display:block when the SignalR circuit drops or a render throws. */
#blazor-error-ui {
    display: none;
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
    z-index: 9999; max-width: calc(100vw - 24px);
    background: var(--paper); border: 1px solid var(--red);
    border-left: 4px solid var(--red); border-radius: var(--r);
    box-shadow: 0 10px 30px rgba(20, 20, 20, .18);
    color: var(--ink); font: 500 14px/1.4 var(--sans);
    padding: 12px 44px 12px 16px;
    display: none;
}
#blazor-error-ui a { color: var(--red); font-weight: 600;
    text-decoration: underline; margin-left: 8px; cursor: pointer; }
#blazor-error-ui a:hover { color: var(--red-ink); }
#blazor-error-ui .dismiss { position: absolute; top: 6px; right: 10px;
    margin: 0; text-decoration: none; font-size: 16px; color: var(--muted);
    line-height: 1; padding: 4px; }
#blazor-error-ui .dismiss:hover { color: var(--red); }

/* CTA-only tool pages (sign-pdf, pdf-filler) */
.tool-cta { display: flex; flex-direction: column; align-items: center;
    gap: 18px; padding: 36px 24px; text-align: center; }
.tool-cta .cta-hint { margin: 0; max-width: 480px; color: var(--ink-2);
    font-size: 15.5px; line-height: 1.55; }

/* Paste textarea (markdown/html/redact) */
.paste-area { width: 100%; min-height: 220px; resize: vertical;
    background: #fcfaf5; border: 1.5px solid var(--rule-2);
    border-radius: var(--r); padding: 12px 14px; color: var(--ink);
    font: 500 13.5px/1.5 var(--mono); }
.paste-area:focus { outline: none; border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-line); background: var(--sheet); }

/* Smaller variant of the dropzone (used inside TextPasteTool) */
.tool-drop.sm { padding: 18px 16px; margin-bottom: 18px; }
.tool-drop.sm .blob { width: 44px; height: 44px; margin: 0 auto 8px;
    border-radius: var(--r); }
.tool-drop.sm p { font-size: 13.5px; }

/* 4-up grid for crop margins */
.opt.opt-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.opt.opt-grid-4 label.g { display: flex; flex-direction: column; gap: 6px;
    font: 700 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 0; }
.opt.opt-grid-4 input[type=number] { font-family: var(--mono); }

/* Password input (matches text input styling but slightly tighter) */
.tool-options input[type=password] {
    width: 100%; background: var(--sheet); border: 1.5px solid var(--rule-2);
    color: var(--ink); border-radius: var(--r); padding: 10px 12px;
    font: 500 14.5px/1.2 var(--mono); letter-spacing: .08em;
}
.tool-options input[type=password]:focus { outline: none; border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-line); }

/* Inline <code> inside hints */
.hint-inline code { font-family: var(--mono); background: #f1ede2;
    border: 1px solid var(--rule-1); padding: 1px 5px; border-radius: 3px;
    font-size: 12.5px; }

/* ============================================================
   Editor (full-screen app) — same ink/paper/red language
   ============================================================ */
.editor { display: flex; flex-direction: column; height: 100vh;
    overflow: hidden; background: var(--paper); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 18px;
    background: var(--paper); border-bottom: 1px solid var(--rule-1);
    flex: none; z-index: 20; }
.topbar .logo { display: flex; align-items: center; gap: 10px;
    text-decoration: none; }
.topbar .logo .mark { display: none; }
.topbar .brand-name { font: 700 17px/1 var(--serif); }
.topbar .sep { width: 1px; height: 26px; background: var(--rule-1); margin: 0 4px; }
.topbar .spacer { flex: 1; }
.file-chip { display: inline-flex; align-items: center; gap: 9px;
    max-width: 260px; border: 1px solid var(--rule-1); background: var(--sheet);
    padding: 7px 13px; border-radius: var(--r); color: var(--ink-2);
    font: 500 13px/1 var(--mono); }
.file-chip span { overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; }
.file-chip .ic { color: var(--red); }
.seg { display: inline-flex; align-items: center; border: 1.5px solid var(--rule-2);
    border-radius: var(--r); overflow: hidden; background: var(--sheet); }
.seg button { border: none; background: transparent; color: var(--ink-2);
    cursor: pointer; padding: 8px 10px; display: grid; place-items: center;
    transition: background var(--fast); }
.seg button:hover { background: #efeadf; color: var(--ink); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg .val { min-width: 52px; text-align: center; font: 600 13px/1 var(--mono);
    color: var(--ink); }
.seg .divline { width: 1px; align-self: stretch; background: var(--rule-1); }

.workspace { display: flex; flex: 1; min-height: 0; }
.toolrail { width: 86px; background: var(--paper);
    border-right: 1px solid var(--rule-1); display: flex; flex-direction: column;
    gap: 3px; padding: 14px 10px 24px; overflow-y: auto; flex: none; }
.rail-label { font: 700 10px/1 var(--mono); letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted); padding: 14px 6px 7px; }
.rail-label:first-child { padding-top: 0; }
.tool { position: relative; display: flex; flex-direction: column;
    align-items: center; gap: 6px; padding: 10px 4px; border-radius: var(--r);
    cursor: pointer; color: var(--ink-2); font: 600 10.5px/1.1 var(--sans);
    user-select: none; transition: all var(--fast); border: 1px solid transparent; }
.tool:hover { background: var(--sheet); color: var(--ink); }
.tool.active { background: var(--red-wash); color: var(--red-ink);
    border-color: var(--red-line); }
.tool.active::before { content: ""; position: absolute; left: -10px; top: 50%;
    transform: translateY(-50%); width: 3px; height: 22px;
    border-radius: 0 3px 3px 0; background: var(--red); }

.thumbs { width: 190px; background: var(--paper);
    border-right: 1px solid var(--rule-1); overflow-y: auto;
    padding: 16px 14px; flex: none; }
.thumbs .ttl { font: 700 10px/1 var(--mono); letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted); margin: 0 2px 14px; }
.thumb { position: relative; margin-bottom: 12px; cursor: pointer;
    border: 1px solid var(--rule-2); background: var(--sheet); overflow: hidden;
    transition: border-color var(--fast); }
.thumb:hover { border-color: var(--ink-2); }
.thumb canvas { width: 100%; display: block; }
.thumb.active { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-line); }
.thumb .n { position: absolute; bottom: 5px; right: 6px; font: 600 11px/1 var(--mono);
    background: var(--ink); color: #fff; padding: 2px 6px; border-radius: 3px; }
.thumb.deleted { opacity: .4; }
.thumb.deleted::after { content: "Removed"; position: absolute; inset: 0;
    display: grid; place-items: center; font: 700 12px/1 var(--mono);
    color: var(--red); background: rgba(255,255,255,.5); }
.thumb .pgtools { position: absolute; top: 5px; left: 5px; opacity: 0;
    transition: opacity var(--fast); }
.thumb:hover .pgtools { opacity: 1; }
.thumb .pgtools button { background: var(--ink); border: none; color: #fff;
    cursor: pointer; width: 26px; height: 26px; border-radius: 4px;
    display: grid; place-items: center; }
.thumb .pgtools button:hover { background: var(--red); }

.canvas-wrap { flex: 1; overflow: auto; background: #e9e5db;
    padding: 34px; min-width: 0; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.page-shell { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.page-tag { font: 600 11px/1 var(--mono); color: var(--ink-2);
    background: var(--paper); border: 1px solid var(--rule-1);
    padding: 4px 10px; border-radius: 3px; }
.page-host { position: relative; background: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 22px 50px -26px rgba(0,0,0,.55);
    outline: 1px solid rgba(0,0,0,.06); }
.page-host canvas.pdf { display: block; }
.page-host[data-tool]:not([data-tool="Select"]) { cursor: crosshair; }
.draw-preview { position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none; }

.el { position: absolute; box-sizing: border-box; }
.el.movable { cursor: move; }
.el.selected { outline: 1.5px solid var(--red);
    box-shadow: 0 0 0 4px var(--red-line); }
.el .content { width: 100%; height: 100%; overflow: hidden; }
.el-text { white-space: pre-wrap; word-break: break-word; line-height: 1.2; }
.el-form-text { background: var(--red-wash); border: 1px dashed var(--red);
    border-radius: 3px; color: var(--ink); display: flex; align-items: center;
    padding: 0 7px; font-size: 13px; }
.el-form-text .ph { color: #c98e8b; }
.el-form-check { background: var(--red-wash); border: 1.5px dashed var(--red);
    border-radius: 3px; display: flex; align-items: center;
    justify-content: center; color: var(--ok); font-weight: 800; }
.el-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.handle { position: absolute; width: 12px; height: 12px; background: #fff;
    border: 2px solid var(--red); border-radius: 50%; z-index: 5; }
.handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.handle.n { left: 50%; top: -7px; transform: translateX(-50%); cursor: ns-resize; }
.handle.s { left: 50%; bottom: -7px; transform: translateX(-50%); cursor: ns-resize; }
.handle.e { right: -7px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.handle.w { left: -7px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.inspector { width: 304px; background: var(--paper);
    border-left: 1px solid var(--rule-1); overflow-y: auto; flex: none; }
.insp-head { padding: 18px 20px; border-bottom: 1px solid var(--rule-1);
    position: sticky; top: 0; background: var(--paper); z-index: 2; }
.insp-head h4 { margin: 0; font: 600 16px/1.2 var(--serif); }
.insp-head .sub { color: var(--muted); font: 500 12px/1.3 var(--mono);
    margin-top: 4px; }
.insp-body { padding: 18px 20px; }
.empty-tips { color: var(--ink-2); font-size: 14px; line-height: 1.7; }
.empty-tips .ti { display: flex; gap: 11px; align-items: flex-start;
    margin: 14px 0; }
.empty-tips .ti .ic { color: var(--red); margin-top: 1px; }
.empty-tips b { color: var(--ink); }
.field { margin: 0 0 16px; }
.field > label { display: block; font: 700 11px/1 var(--mono);
    letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
    margin-bottom: 7px; }
.field input[type=text], .field textarea, .field select,
.field input[type=number] {
    width: 100%; background: var(--sheet); border: 1.5px solid var(--rule-2);
    color: var(--ink); border-radius: var(--r); padding: 9px 11px;
    font: 500 14px/1.4 var(--sans); }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-line); }
.field textarea { resize: vertical; min-height: 76px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.segmented { display: flex; border: 1.5px solid var(--rule-2);
    border-radius: var(--r); overflow: hidden; }
.segmented button { flex: 1; background: var(--sheet); border: none;
    color: var(--ink-2); padding: 9px 6px; cursor: pointer;
    display: grid; place-items: center; border-right: 1.5px solid var(--rule-2);
    transition: all var(--fast); }
.segmented button:last-child { border-right: none; }
.segmented button:hover { background: #efeadf; }
.segmented button.on { background: var(--red); color: #fff; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 4px; cursor: pointer;
    border: 1px solid rgba(0,0,0,.15); transition: transform var(--fast); }
.sw:hover { transform: scale(1.12); }
.sw.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--red); }
input[type=range] { -webkit-appearance: none; width: 100%; height: 4px;
    background: var(--rule-2); border-radius: 3px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none;
    width: 18px; height: 18px; border-radius: 50%; background: var(--red);
    cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--red); }
.divider { height: 1px; background: var(--rule-1); margin: 18px 0; }

/* dropzone (editor empty state) */
.dropzone { flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 14px; text-align: center; margin: 40px;
    border: 2px dashed var(--rule-2); border-radius: var(--r-lg);
    background: var(--sheet); transition: all var(--fast); }
.dropzone.drag { border-color: var(--red); background: var(--red-wash); }
.dropzone .blob { width: 88px; height: 88px; border: 2px solid var(--red);
    color: var(--red); border-radius: var(--r-lg); display: grid;
    place-items: center; background: var(--red-wash); }
.dropzone h1, .dropzone h2 { margin: 0; font: 600 27px/1.1 var(--serif); }
.dropzone p { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 460px; }
.dropzone .mini { color: var(--muted); font-size: 12.5px; display: flex;
    align-items: center; gap: 7px; margin-top: 10px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(26,23,18,.55);
    display: flex; align-items: center; justify-content: center; z-index: 100;
    animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; background: var(--sheet);
    border: 1px solid var(--rule-1); border-top: 4px solid var(--red);
    border-radius: var(--r-lg); width: min(640px, 94vw); max-height: 92vh;
    overflow: auto; padding: 26px; box-shadow: var(--shadow-pop);
    animation: rise .2s cubic-bezier(.2,.7,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.modal h3 { margin: 0 0 4px; font: 600 22px/1.15 var(--serif); }
.modal .msub { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }
.tabs { display: inline-flex; border: 1.5px solid var(--rule-2);
    border-radius: var(--r); overflow: hidden; margin-bottom: 18px; }
.tabs button { background: var(--sheet); border: none; color: var(--ink-2);
    padding: 9px 20px; cursor: pointer; font: 600 13.5px/1 var(--sans);
    border-right: 1.5px solid var(--rule-2); }
.tabs button:last-child { border-right: none; }
.tabs button.on { background: var(--red); color: #fff; }
.sigpad { width: 100%; height: 230px; background: #fff;
    border: 1.5px solid var(--rule-2); border-radius: var(--r);
    touch-action: none; cursor: crosshair; }
.sig-typed { width: 100%; height: 130px; background: #fff;
    border: 1.5px solid var(--rule-2); border-radius: var(--r); color: var(--ink);
    font-size: 50px; display: flex; align-items: center; padding: 0 22px;
    overflow: hidden; }
.sig-saved { display: flex; gap: 10px; flex-wrap: wrap; }
.sig-saved img { height: 50px; background: #fff; border: 1px solid var(--rule-2);
    border-radius: 5px; padding: 5px; cursor: pointer; }
.sig-saved img:hover { border-color: var(--red); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 22px; }
.check-line { display: flex; gap: 9px; align-items: center; margin-top: 16px;
    color: var(--ink-2); font-size: 14px; cursor: pointer; }

.toast { position: fixed; bottom: 26px; left: 50%;
    transform: translateX(-50%); background: var(--ink); color: #fff;
    padding: 14px 22px; border-radius: var(--r); z-index: 200;
    box-shadow: var(--shadow-pop); font: 600 14px/1.3 var(--sans);
    display: flex; align-items: center; gap: 10px;
    animation: rise .22s cubic-bezier(.2,.7,.3,1); }
.toast .ic { color: #74d99b; }
.toast.err { background: var(--red-ink); }
.toast.err .ic { color: #fff; }

.loading { position: absolute; inset: 0; background: rgba(246,243,236,.78);
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 14px; z-index: 50; color: var(--ink-2);
    font: 600 14px/1 var(--mono); }
.spinner { width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid var(--rule-2); border-top-color: var(--red);
    animation: spin .8s linear infinite; }
.spinner.sm { width: 17px; height: 17px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #cdc4b2; border-radius: 7px;
    border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b3a991; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Mobile-friendly baseline (applies everywhere)
   ============================================================ */

/* iOS Safari: prevent auto-zoom when focusing inputs (kicks in <16px). */
input, select, textarea { font-size: 16px; }

/* Honour the iPhone notch / Android navigation gesture area. */
.site { min-height: 100dvh; }
.editor { height: 100dvh; }
.site-footer { padding-bottom: env(safe-area-inset-bottom); }

/* The "Done" bar only exists for the mobile inspector sheet (see breakpoint). */
.insp-mobile-done { display: none; }

/* Touch behaviour on the editing surface: let the page scroll normally, but
   when actively manipulating an element or using a freehand tool, capture the
   gesture for drawing/dragging instead of scrolling. */
.el, .handle { touch-action: none; }
.pages[data-tool="FreeDraw"] .page-host,
.pages[data-tool="Highlight"] .page-host { touch-action: none; }

/* Bigger default tap targets on coarse pointers. Use flex so the text
   stays vertically centred inside the larger hit-area. */
@media (pointer: coarse) {
    .btn, .nav-link, .tool, .seg button, .seg-pills button,
    .filerow .x, .lang-picker > summary, .lang-menu a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================================
   Responsive breakpoints
   ============================================================ */

/* ---- TABLET / NARROW DESKTOP (<= 960px) ---- */
@media (max-width: 960px) {
    .wrap { padding: 0 22px; }
    .site-nav { padding: 14px 20px; gap: 18px; }
    .hub-grid { grid-template-columns: repeat(2, 1fr); }
    .feat { grid-template-columns: 40px 1fr; }
    .feat p { grid-column: 2; }
    .foot-cols { grid-template-columns: repeat(3, 1fr); }
    .thumbs { display: none; }
}

/* ---- MOBILE (<= 640px) ---- */
@media (max-width: 640px) {
    /* Header — keep brand + one nav link + CTA, hide redundant Editor link
       (CTA already opens the editor). */
    .site-nav { padding: 10px 14px; gap: 8px; }
    .nav-links { display: flex; gap: 0; align-items: stretch; }
    .nav-link { display: inline-flex; align-items: center; justify-content: center;
        padding: 10px 8px; font-size: 13px; min-height: 44px; }
    .nav-link.mobile-hide { display: none; }
    .nav-cta { padding: 10px 14px; font-size: 13.5px; min-height: 44px; }

    /* Layout containers */
    .wrap { padding: 0 18px; }
    .hub-grid, .related { grid-template-columns: 1fr; }

    /* Hero typography on tool/landing pages */
    .tool-wrap { padding: 28px 16px 24px; }
    .tool-hero { padding: 36px 0 22px; margin-bottom: 18px; }
    .tool-hero .t-ic { width: 48px; height: 48px; margin-bottom: 16px; }
    .tool-hero p { font-size: 15px; max-width: none; }

    /* Tool card / drop / options */
    .tool-card { padding: 18px; border-radius: var(--r); }
    .tool-drop { padding: 32px 16px; }
    .tool-drop .blob { width: 52px; height: 52px; margin-bottom: 12px; }
    .tool-drop h2 { font-size: 18px; }
    .tool-drop p { font-size: 13.5px; }
    .opt.opt-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .seg-pills { width: 100%; }
    .seg-pills button { flex: 1; padding: 12px 10px; min-height: 44px;
        font-size: 13.5px; }
    .filerow { padding: 12px 2px; gap: 9px; font-size: 13.5px; }
    .filerow .fn { font-size: 13.5px; }
    .filelist-actions { flex-wrap: wrap; }
    .tool-run { flex-direction: column; align-items: stretch; gap: 12px; }
    .tool-run .btn { width: 100%; justify-content: center; }
    .paste-area { min-height: 180px; }

    /* Buttons baseline */
    .btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }
    .btn.lg { padding: 14px 20px; font-size: 15px; }
    .btn.sm { padding: 10px 12px; font-size: 13px; min-height: 40px; }

    /* SEO blocks */
    .seo-block { margin-top: 40px; }
    .seo-block h2 { font-size: 22px; }
    .howto, .faq { font-size: 15px; line-height: 1.65; }
    .faq h3 { font-size: 16px; }

    /* Home landing */
    .lp-hero { padding: 30px 0 4px; }
    .lp-section { padding: 36px 0; }
    .lp-cta { gap: 10px; flex-direction: column; align-items: stretch; }
    .lp-cta .btn { width: 100%; justify-content: center; }
    .feat-rows .feat { padding: 14px 0; }
    .seo-copy { padding: 36px 0; }

    /* About */
    .about-hero { padding: 32px 0 18px; }
    .about-author { flex-direction: column; align-items: flex-start;
        padding: 18px; gap: 14px; }
    .aa-avatar { width: 48px; height: 48px; font-size: 16px; }
    .about-body h2 { font-size: 19px; margin: 28px 0 10px; }
    .about-more { gap: 14px 18px; padding-top: 18px; }

    /* Hub */
    .hub-head { padding: 36px 0 22px; }
    .hub-head h1 { font-size: clamp(28px, 7vw, 38px); }
    .hub-section h2 { font-size: 20px; }
    .hub-card { padding: 14px 12px; }

    /* Footer */
    .foot-cols { grid-template-columns: repeat(2, 1fr); gap: 22px;
        padding: 22px 18px 30px; }
    .foot-top { padding: 32px 18px 18px; gap: 18px; }
    .foot-col a { padding: 8px 0; min-height: 36px; display: flex;
        align-items: center; }
    .foot-base { padding: 16px 18px 28px; flex-direction: column; gap: 8px; }
    .lang-menu { left: auto; right: 0; min-width: 200px; }

    /* Bread crumbs */
    .bread { padding: 14px 0; font-size: 12.5px; }
    .legal { padding: 40px 0 24px; font-size: 15.5px; }

    /* Editor app: make the toolbar swipe-scrollable; shrink the rail. */
    .editor { background: var(--paper); }
    .topbar { padding: 8px 12px; gap: 8px;
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; flex-wrap: nowrap; }
    .topbar::-webkit-scrollbar { display: none; }
    .topbar > * { flex: none; }
    .topbar .sep { display: none; }
    .topbar .seg .val { min-width: 38px; font-size: 12px; }
    .topbar .brand-mark { height: 26px; }
    .topbar .btn.sm { padding: 8px 10px; font-size: 12.5px; min-height: 40px; }
    .file-chip { max-width: 130px; font-size: 11.5px; padding: 6px 9px; }
    .toolrail { width: 64px; padding: 10px 6px 18px; }
    .tool { padding: 8px 2px; font-size: 9.5px; }
    .canvas-wrap { padding: 16px 10px; }
    .pages { gap: 18px; }
    .dropzone { padding: 28px 18px; }
    .dropzone .blob { width: 68px; height: 68px; }
    .dropzone h1, .dropzone h2 { font-size: 22px; }
    .dropzone p { font-size: 14px; }
}

/* ---- EDITOR APP LAYOUT ON SMALL SCREENS (<= 820px) ----
   The desktop editor is a 3-column flex row (tool rail + canvas + 304px
   inspector). On phones/small tablets the inspector alone swallows the width
   and squeezes the PDF to nothing. Restructure into: a horizontal tool strip,
   a full-width canvas, and an inspector that slides up as a bottom sheet only
   when there's something to edit. Placed after the 640px block so it wins. */
@media (max-width: 820px) {
    .workspace { flex-direction: column; position: relative; }

    /* Tool rail -> horizontal, swipe-scrollable strip beneath the topbar. */
    .toolrail {
        width: 100%;
        flex: none;
        flex-direction: row;
        align-items: stretch;
        gap: 2px;
        padding: 6px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-right: none;
        border-bottom: 1px solid var(--rule-1);
    }
    .toolrail::-webkit-scrollbar { display: none; }
    .rail-label { display: none; }              /* group labels waste row width */
    .tool {
        flex: none;
        min-width: 58px;
        padding: 8px 6px;
        gap: 4px;
        font-size: 10px;
    }
    /* The active indicator is a left bar on desktop; use an underline in a row. */
    .tool.active::before { display: none; }
    .tool.active { box-shadow: inset 0 -3px 0 var(--red); }

    /* Canvas takes all remaining space and the full width. */
    .canvas-wrap { flex: 1; width: 100%; padding: 14px 8px 40px; }

    /* Inspector -> bottom sheet, hidden until .open. */
    .inspector {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        width: auto;
        max-height: 60vh;
        border-left: none;
        border-top: 1px solid var(--rule-1);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -16px 44px -22px rgba(0,0,0,.45);
        transform: translateY(110%);
        transition: transform .26s ease;
        z-index: 40;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .inspector.open { transform: translateY(0); }

    /* Done bar to dismiss the sheet (and deselect). */
    .insp-mobile-done {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        width: 100%;
        min-height: 46px;
        border: none;
        border-bottom: 1px solid var(--rule-1);
        background: var(--paper);
        color: var(--ink);
        font: 700 13px/1 var(--sans);
        cursor: pointer;
        position: sticky;
        top: 0;
        z-index: 3;
        border-radius: 16px 16px 0 0;
    }
    .insp-mobile-done:hover { background: var(--sheet); }
    /* Small grab-handle affordance above the Done bar. */
    .insp-mobile-done::before {
        content: "";
        position: absolute;
        top: 6px; left: 50%;
        transform: translateX(-50%);
        width: 36px; height: 4px;
        border-radius: 2px;
        background: var(--rule-2);
    }
    /* Done bar owns the sticky top; keep the panel header in normal flow. */
    .inspector .insp-head { position: static; padding-top: 14px; }
}

/* ---- VERY SMALL PHONES (<= 380px) ---- */
@media (max-width: 380px) {
    .site-nav { padding: 8px 12px; gap: 6px; }
    .nav-link { padding: 8px 5px; font-size: 12px; }
    .nav-cta { padding: 9px 11px; font-size: 12.5px; }

    .foot-cols { grid-template-columns: 1fr; gap: 18px; padding: 18px 16px 26px; }
    .foot-top { padding: 26px 16px 14px; }

    .tool-wrap { padding: 22px 14px 18px; }
    .tool-card { padding: 14px; }
    .tool-hero { padding: 28px 0 18px; }
    .tool-hero h1 { font-size: 26px; }

    .about-author { padding: 14px; }
    .aa-name { font-size: 16px; }
    .lp-cta .btn { font-size: 14px; }
    .related { grid-template-columns: 1fr; }
}
