/* ==========================================================================
   ImageToAll - site stylesheet
   A single stylesheet, no framework. Layout uses flex and grid, colours are
   defined once as custom properties, and every interactive control has a
   visible focus state.
   ========================================================================== */

:root {
  --ink: #14181f;
  --ink-soft: #4a5566;
  --muted: #6b7688;
  --line: #dfe4ec;
  --line-soft: #eef1f6;
  --page: #ffffff;
  --tint: #f6f8fc;
  --accent: #0b5cff;
  --accent-dark: #0645c4;
  --accent-soft: #eaf0ff;
  --ok: #0f7b4f;
  --ok-soft: #e6f6ee;
  --warn: #8a5300;
  --warn-soft: #fdf3e2;
  --error: #b3261e;
  --error-soft: #fdecea;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 24, 31, .06), 0 8px 24px rgba(20, 24, 31, .06);
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, .08);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .15em; }
a:hover { color: var(--accent-dark); }
img, svg, canvas { max-width: 100%; height: auto; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: .35em; }
code, kbd, samp { font-family: var(--mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* The hidden attribute must win over any display value set by a class. Without
   this rule a rule like `.btn-row { display: flex }` overrides the browser's
   default `[hidden] { display: none }`, and elements the script hides — the
   download-all and clear buttons — stay visible and appear to do nothing. */
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.6) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 64px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #6f4bff);
  color: #fff; border-radius: 9px; font-weight: 700; font-size: .85rem; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }

.site-nav ul { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: .45rem .7rem; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none; font-size: .95rem; font-weight: 500;
}
.site-nav a:hover { background: var(--tint); color: var(--accent-dark); }

/* ------------------------------------------------------------------- hero */

.hero { padding: 2.5rem 0 1rem; }
.hero h1 { max-width: 22ch; }
.hero .lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 68ch; }

.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; font-weight: 600;
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--page); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-pad { padding: 1.25rem 1.4rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.section { padding: 2.5rem 0; }
.section-tint { background: var(--tint); border-block: 1px solid var(--line); }
.section-head { max-width: 68ch; margin-bottom: 1.5rem; }
.section-head p { color: var(--ink-soft); }

/* ---------------------------------------------------------------- converter */

.converter { margin: 0 0 1.5rem; }

.dropzone {
  /* position: relative is required, not cosmetic: the file input inside is
     absolutely positioned, and without a positioned ancestor it escapes to the
     top-left of the page, where it is invisible and unclickable. */
  position: relative;
  border: 2px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--tint); padding: 2rem 1.25rem; text-align: center;
  transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover { border-color: #b9c6dd; background: #f8fafe; }
/* The focus ring belongs to the button, which is the focusable control. */
.dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone h3 { margin-bottom: .7rem; }
.dropzone p { color: var(--ink-soft); margin: 0 0 .75rem; }

/* The visible affordance is a real <label for> the file input, so activating it is
   native browser behaviour and needs no script. It is styled as a secondary button
   rather than a solid accent block: the page uses the accent colour for one
   primary action per screen (Convert), and a second solid accent block competes
   with it. White with a border and the accent as the text colour reads as the
   intended secondary action and matches the rest of the site. */
.dropzone-button {
  display: inline-block; cursor: pointer;
  font-weight: 600; font-size: 1rem; color: var(--accent-dark);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem 1.4rem; margin: 0 0 1rem;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.dropzone-button:hover {
  background: var(--accent-soft); border-color: #b9c6dd;
  box-shadow: 0 2px 8px rgba(11, 92, 255, .12);
}
.dropzone-button:active { transform: translateY(1px); }
.dropzone-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.dropzone .hint { font-size: .85rem; color: var(--muted); margin: 0; }

/* The real file input is kept out of the pointer path. Parking it off-screen
   rather than covering the zone means a click lands on the container or the label
   exactly once, so the scripted forward cannot open the picker a second time. */
.dropzone .file-input,
.dropzone input[type="file"] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  opacity: 0; left: 0; top: 0;
}

.controls {
  display: grid; gap: 1rem; margin-top: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.field .help { font-size: .78rem; color: var(--muted); }
input[type="number"], input[type="text"], input[type="email"], select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .5rem .65rem; width: 100%;
}
textarea { min-height: 9rem; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: var(--tint); color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
.checkline { display: flex; align-items: flex-start; gap: .5rem; }
.checkline label { font-size: .92rem; }
.checkline input { margin-top: .28rem; flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  padding: .6rem 1.1rem; border-radius: var(--radius);
  border: 1px solid transparent; background: var(--accent); color: #fff;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--tint); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* --------------------------------------------------------------- file list */

.file-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .75rem; }

.file-item {
  display: grid; gap: .5rem 1rem; align-items: start;
  grid-template-columns: 88px minmax(0, 1fr);
  padding: .85rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
/* When a row carries a selection checkbox the grid gains a leading column. The
   script only renders that column once more than one file is queued. The `:has()`
   form is a progressive enhancement; the class is what actually applies, since it
   works in every browser this site targets. */
.file-item.has-select,
.file-item:has(.file-select) { grid-template-columns: 26px 88px minmax(0, 1fr); }

/* ------------------------------------------------------------- selection box */

.select-all {
  margin: 1.25rem 0 0; padding: .6rem .8rem;
  background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius);
}
.select-all .checkline { align-items: center; }
.select-all .checkline span { font-size: .92rem; font-weight: 600; }

.selection-note {
  margin: .5rem 0 0; font-size: .85rem; color: var(--muted);
}

.file-select { display: flex; align-items: flex-start; padding-top: .35rem; }
.file-select-empty { display: block; }
.file-checkbox {
  width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer;
  accent-color: var(--accent); flex: 0 0 auto;
}
/* A skipped row is visibly de-emphasised, so it is obvious before converting that
   it will be left alone. */
.file-item.is-skipped { opacity: .55; }
.file-item.is-skipped .file-name { text-decoration: line-through; }
.file-item[data-status="done"] {
  border-color: #bde5cf; background: linear-gradient(180deg, #f6fdf9, #fff);
  /* A coloured left edge makes finished rows distinguishable when scrolling a long
     batch, without depending on reading the badge. */
  box-shadow: inset 4px 0 0 var(--ok);
}
.file-item[data-status="error"] {
  border-color: #f3c9c5; background: linear-gradient(180deg, #fffbfa, #fff);
  box-shadow: inset 4px 0 0 var(--error);
}
.file-item[data-status="working"] {
  border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent), 0 0 0 3px rgba(11, 92, 255, .08);
}

/* The thumbnail is the visible proof that the file was opened. */
.file-thumb {
  width: 88px; height: 88px; border-radius: 8px; overflow: hidden;
  background: var(--tint); border: 1px solid var(--line-soft);
  display: grid; place-items: center; flex: 0 0 auto;
}
.file-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.file-thumb-text {
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
  color: var(--muted); letter-spacing: .04em;
}

.file-body { min-width: 0; display: grid; gap: .35rem; }

/* The file name and its status badge share a line, so the state of every file in a
   long batch is readable without reading the detail lines. */
.file-title {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
}
.file-name {
  font-weight: 650; font-size: .96rem; overflow-wrap: anywhere; min-width: 0;
}
.file-detail { font-size: .82rem; color: var(--muted); }
.file-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .15rem; }
.file-actions .btn { padding: .35rem .8rem; font-size: .88rem; }
.file-notes { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .85rem; }

/* ------------------------------------------------------------------- badges */

/* The badge states the outcome in words. A full progress bar alone is easy to miss
   among rows that otherwise look alike, which is the whole problem when several
   files are queued at once. */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  padding: .18rem .55rem; border-radius: 999px; text-transform: uppercase;
  white-space: nowrap; flex: 0 0 auto;
}
.badge-pending { background: var(--line-soft); color: var(--muted); }
.badge-working { background: var(--accent-soft); color: var(--accent-dark); }
.badge-done { background: var(--ok-soft); color: var(--ok); }
.badge-error { background: var(--error-soft); color: var(--error); }

/* A tick on the finished badge, so it reads as complete at a glance and not only
   to someone who distinguishes green from grey. */
.badge-done::before { content: "\2713"; font-size: .9em; line-height: 1; }
/* A pulsing dot while the conversion runs. */
.badge-working::before {
  content: ""; width: .45rem; height: .45rem; border-radius: 50%;
  background: currentColor; animation: badge-pulse 1.1s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  .badge-working::before { animation: none; }
}

.file-progress { margin-top: .3rem; }
.file-progress .progress { margin-top: 0; }
.progress-label { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.file-progress.is-done .progress > span { background: var(--ok); }
.file-progress.is-done .progress-label { color: var(--ok); font-weight: 600; }
.file-progress.is-error .progress > span { background: var(--error); }
.file-progress.is-error .progress-label { color: var(--error); font-weight: 600; }

.progress {
  height: 8px; border-radius: 999px; background: var(--line-soft);
  overflow: hidden; margin-top: .45rem; position: relative;
}
.progress > span {
  display: block; height: 100%; width: 0; background: var(--accent);
  border-radius: 999px; transition: width .25s ease;
}
/* Used while the server converts, where no percentage is available. */
.progress > span.progress-indeterminate {
  animation: progress-slide 1.1s ease-in-out infinite;
}
@keyframes progress-slide {
  0%   { margin-left: -35%; }
  100% { margin-left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .progress > span.progress-indeterminate { animation: none; width: 100%; opacity: .5; }
}

.notice {
  border-radius: var(--radius); padding: .75rem .9rem; margin: 1rem 0;
  border: 1px solid var(--line); background: var(--tint); font-size: .92rem;
}
.notice-info { background: var(--accent-soft); border-color: #c9d8ff; }
.notice-warn { background: var(--warn-soft); border-color: #f0dcb4; }
.notice-error { background: var(--error-soft); border-color: #f3c9c5; color: var(--error); }
.notice-ok { background: var(--ok-soft); border-color: #bde5cf; color: var(--ok); }
.notice ul { margin: .4rem 0 0; }

/* -------------------------------------------------------------------- docs */

.prose { max-width: 74ch; }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }
.prose ul, .prose ol { margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.25rem; font-size: .94rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .65rem; text-align: left; vertical-align: top; }
.prose th { background: var(--tint); font-weight: 650; }
.table-scroll { overflow-x: auto; }

.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 1rem; }
.steps > li { position: relative; padding-left: 3rem; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}

.faq { display: grid; gap: .5rem; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.faq summary {
  cursor: pointer; padding: .8rem 1rem; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 700; }
.faq details[open] summary::after { content: "\2212"; }
.faq .faq-body { padding: 0 1rem .9rem; color: var(--ink-soft); }
.faq .faq-body p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ footer */

.site-footer { margin-top: 3rem; padding: 2.5rem 0 1.5rem; background: var(--tint); border-top: 1px solid var(--line); }
.footer-grid { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-heading { font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.footer-links { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.footer-links li { margin-bottom: .35rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .85rem;
}
.footer-bottom p { margin: 0; }

.breadcrumbs { margin: 1rem 0 0; font-size: .88rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.breadcrumbs li + li::before { content: "/"; color: var(--line); margin-right: .4rem; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ------------------------------------------------------------------ tables */

.cmp-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.cmp-table th, .cmp-table td { border: 1px solid var(--line); padding: .5rem .6rem; text-align: left; }
.cmp-table th { background: var(--tint); font-weight: 650; }
.cmp-table td.yes { color: var(--ok); font-weight: 600; }
.cmp-table td.no { color: var(--muted); }

/* ------------------------------------------------------------ blog listing */

.post-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.post-card { display: block; padding: 1.1rem 1.25rem; text-decoration: none; color: inherit; }
.post-card:hover { border-color: var(--accent); }
.post-card h2, .post-card h3 { margin-bottom: .3rem; }
.post-card p { margin: 0; color: var(--ink-soft); font-size: .94rem; }
.post-meta { font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }

.ad-slot {
  margin: 1.5rem 0; min-height: 90px; display: grid; place-items: center;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: .8rem; background: var(--tint);
}

@media (max-width: 640px) {
  .header-inner { min-height: 56px; }
  .brand-text small { display: none; }
  .file-item { grid-template-columns: 64px minmax(0, 1fr); padding: .7rem; }
  .file-thumb { width: 64px; height: 64px; }
  .file-actions { grid-column: 1 / -1; }
  .hero { padding-top: 1.5rem; }
  .section { padding: 1.75rem 0; }
}

@media print {
  .site-header, .site-footer, .dropzone, .btn, .ad-slot { display: none !important; }
  body { font-size: 12pt; }
}
