/* app.css: shared layout and tokens for every free tool and the hub. Light and dark via prefers-color-scheme.
   Tools add their own file (/free-tools/<tool>/*.css). Content column ~70ch, 8px grid, system type. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --ink: #111316; --ink2: #33373d; --muted: #5d636b; --line: #e3e3de;
  --soft: #ecece7; --accent: #111316; --accent-fg: #ffffff; --link: #1f4fd1; --focus: #2f6bff; --bubble: #eef3fb; --bubble-ink: #2a5fb0;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(17, 19, 22, .05), 0 8px 24px rgba(17, 19, 22, .06);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #101113; --surface: #17191c; --ink: #ecebe7; --ink2: #cfcdc7; --muted: #9b9a94; --line: #2a2d31; --soft: #1e2125; --accent: #ecebe7; --accent-fg: #101113; --link: #8fb0ff; --focus: #8fb0ff; --bubble: #1b2433; --bubble-ink: #9dbcf0; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark; }
}
*, *::before, *::after { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto } *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px }
a:hover { text-decoration-thickness: 2px }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px }
img { max-width: 100%; height: auto }
kbd { font: 600 .82em var(--mono); padding: .1em .45em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--ink) }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 600 }
.skip:focus { top: 12px }
.small { font-size: .875rem } .muted { color: var(--muted) }
/* `hidden` always wins over component display rules. */
[hidden] { display: none !important }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 }
.sr:focus-visible + small, label:has(+ .sr:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px }

/* Content */
.ft-main { outline: none; position: relative; background: var(--bg) }
.ft-head, .ft-article, .ft-more, .ft-author-in { max-width: 760px; margin: 0 auto; padding: 0 24px }
@media (max-width: 640px) { .ft-head, .ft-article, .ft-more, .ft-author-in { padding: 0 16px } }
.ft-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 28px; padding-bottom: 8px; font-size: .9rem }
.ft-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 0; padding: 0; color: var(--muted) }
.ft-crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line) }
.ft-crumbs a { color: var(--muted); text-decoration: none } .ft-crumbs a:hover { color: var(--ink); text-decoration: underline }
.ft-crumbs [aria-current] { color: var(--ink2) }
.ft-lang { flex: none; color: var(--ink2); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface) }
.ft-lang:hover { border-color: var(--muted) }

h1, h2, h3 { font-family: var(--display); color: var(--ink); text-wrap: balance }
h1 { font-size: clamp(2rem, 1.2rem + 3.2vw, 3.1rem); line-height: 1.06; letter-spacing: -.028em; font-weight: 750; margin: 24px 0 16px }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 1.9rem); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; margin: 72px 0 12px }
h3 { font-size: 1.08rem; line-height: 1.3; letter-spacing: -.01em; font-weight: 650; margin: 0 0 4px }
p { margin: 0 0 16px }
.ft-lead { font-size: 1.18rem; line-height: 1.55; color: var(--ink2); max-width: 64ch }
.ft-article section > p { color: var(--ink2); max-width: 66ch }

/* "Przemo says": the author's speech bubble (same look as the blog's > [!PRZEMO] callout) */
.przemo { display: grid; grid-template-columns: 64px 1fr; gap: 0 18px; align-items: start; margin: 36px 0 8px }
.przemo-face { display: block; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: #cfdcf2; margin-top: 6px }
.przemo-face img { width: 64px; height: 64px; object-fit: cover; object-position: 50% 12%; display: block }
.przemo-bubble { position: relative; background: var(--bubble); border-radius: 18px; padding: 16px 22px 4px; color: var(--ink) }
.przemo-bubble::before { content: ""; position: absolute; left: -8px; top: 30px; width: 18px; height: 18px; background: var(--bubble); transform: rotate(45deg); border-radius: 3px }
.przemo-label { position: relative; margin: 0 0 6px; color: var(--bubble-ink); font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase }
.przemo-bubble p { position: relative; margin: 0 0 12px; line-height: 1.6 }
@media (max-width: 520px) { .przemo { grid-template-columns: 48px 1fr; gap: 0 14px } .przemo-face, .przemo-face img { width: 48px; height: 48px } .przemo-bubble { padding: 14px 16px 2px } .przemo-bubble::before { top: 20px } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer; transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s }
.btn:hover { border-color: var(--muted); text-decoration: none }
.btn:active { transform: scale(.98) }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg) }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 20px rgba(17, 19, 22, .18) }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 1.05rem }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0 }
.arrow-link { font-weight: 600; text-decoration: none } .arrow-link:hover { text-decoration: underline }

/* FAQ */
.ft-faq { margin-top: 8px }
.faq { border-top: 1px solid var(--line) }
.faq:last-of-type { border-bottom: 1px solid var(--line) }
.faq summary { list-style: none; cursor: pointer; padding: 18px 40px 18px 0; position: relative; font-weight: 620; font-size: 1.04rem; line-height: 1.4 }
.faq summary::-webkit-details-marker { display: none }
.faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .25s var(--ease) }
.faq[open] summary::after { transform: translateY(-30%) rotate(-135deg) }
.faq-a { padding: 0 0 12px; color: var(--ink2) }

/* Tool cards (hub and "More free tools") */
.tool-grid { list-style: none; margin: 16px 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px }
.tool-card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink2); text-decoration: none; transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease) }
.tool-card:hover { border-color: var(--muted); box-shadow: var(--shadow); transform: translateY(-2px) }
.tool-card strong { color: var(--ink); font-size: 1.05rem }
.tool-card span { font-size: .95rem; line-height: 1.5 }
.tool-icon { display: block; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 10px; box-shadow: 0 1px 2px rgba(17, 19, 22, .12) }
.tool-icon svg { display: block; width: 40px; height: 40px }
.tool-open { margin-top: auto; padding-top: 8px; color: var(--link); font-weight: 600 }
.tool-card.is-soon { background: transparent; border-style: dashed }
.tool-card.is-soon:hover { transform: none; box-shadow: none; border-color: var(--line) }
.tool-card.is-soon .tool-open { color: var(--muted) }
.tool-grid-lg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) }
.ft-more { padding-top: 24px }

/* Author card */
.ft-author { margin: 72px 0 0; padding: 48px 0; border-top: 1px solid var(--line); background: var(--surface) }
.ft-author-in { display: grid; grid-template-columns: 80px 1fr; gap: 20px; align-items: start }
.ft-author img { border-radius: 50%; width: 80px; height: 80px }
.ft-author h2 { margin: 0 0 8px; font-size: 1.35rem }
.ft-author p { color: var(--ink2) }
@media (max-width: 520px) { .ft-author-in { grid-template-columns: 1fr } }

/* The shared footer sits flush under the author card. */
.ft-author + .cf-foot, main + .cf-foot { margin-top: 0 }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface) }

/* ---------- Workbench: the panel text tools share (JWT, counter, Base64) ---------- */
.wb { margin: 28px 0 8px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden }
.wb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line) }
.wb-label { font-weight: 700; font-size: .95rem; color: var(--ink) }
.wb-actions { display: flex; gap: 6px; flex-wrap: wrap }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .88rem; gap: 6px }
.wb-area { display: block; width: 100%; min-height: 220px; padding: 16px 18px; border: 0; resize: vertical; background: transparent; color: var(--ink); font: 1rem/1.6 var(--sans); outline: none }
.wb-area.mono { font: .95rem/1.6 var(--mono); word-break: break-all }
.wb-area::placeholder { color: var(--muted); opacity: .8 }
.wb:focus-within { border-color: color-mix(in srgb, var(--focus) 55%, var(--line)); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent) }
.wb-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--soft); font-size: .85rem; color: var(--muted) }
.private { display: inline-flex; align-items: center; gap: 6px }
.private svg { flex: none }
.wb-error { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); color: #b42318; font-weight: 600; font-size: .92rem }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wb-error { color: #ff8a7a } }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line) }
.stat { background: var(--surface); padding: 14px 18px }
.stat b { display: block; font: 750 1.6rem/1.1 var(--display); letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums }
.stat span { font-size: .82rem; color: var(--muted) }
.stat.hero b { font-size: 2.2rem }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line) }
.seg button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font: 600 .85rem var(--sans); cursor: pointer }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(17, 19, 22, .12) }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: .9rem; color: var(--ink2); cursor: pointer }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0 }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 100; transform: translate(-50%, 12px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease) }
.toast.show { opacity: 1; transform: translate(-50%, 0) }
.code { margin: 0; padding: 14px 18px; overflow-x: auto; font: .9rem/1.6 var(--mono); color: var(--ink); white-space: pre-wrap; word-break: break-word }
.ft-article section h3 { margin-top: 32px }
.ft-article .steps h3, .ft-article .uses h3 { margin-top: 0 }
.ref { width: 100%; border-collapse: collapse; font-size: .95rem }
.ref th, .ref td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top }
.ref tbody tr:last-child > * { border-bottom: 0 }
.ref code { font-size: .88em }
code { font-family: var(--mono); font-size: .9em; padding: .1em .35em; border-radius: 6px; background: var(--soft) }
.wb-h { margin: 0; font-size: .95rem; line-height: 1.3; letter-spacing: 0 }
/* Phones: get the tool and its numbers into the first screen. */
@media (max-width: 640px) {
  .ft-head { padding-top: 16px; font-size: .8rem }
  .ft-lang { padding: 4px 10px }
  [data-layout="workbench"] h1 { font-size: 1.7rem; margin: 14px 0 8px }
  [data-layout="workbench"] .ft-lead { font-size: .98rem; line-height: 1.5 }
  .wb { margin-top: 18px; border-radius: 16px }
  .wb-head { padding: 8px 8px 8px 14px; row-gap: 6px }
  .wb-head .wb-label { white-space: nowrap }
  .wb-actions { flex-wrap: nowrap }
  .btn-sm { min-height: 34px; padding: 0 10px; font-size: .82rem }
  .wb-area, .cc .wb-area { min-height: 150px; height: 150px; padding: 12px 14px }
  .stat { padding: 10px 14px }
  .cc .stat b { font-size: 1.35rem }
}
