* { box-sizing: border-box; margin: 0; padding: 0; }

/* The UA sheet is low priority: any later display: rule would silently defeat
   [hidden] and leak the section back into the accessibility tree. */
[hidden] { display: none !important; }

:root {
  --bg: #05060a;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-2: rgba(255, 255, 255, 0.015);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.3);
  /* Input borders are the only cue that a field is editable, so they need the
     3:1 of WCAG 1.4.11 — the decorative --border sits at 1.22:1. */
  --border-control: rgba(148, 163, 184, 0.58);
  --text: #e6eaf2;
  --muted: #8b93a7;
  --accent: #53d9ff;
  --accent-soft: rgba(83, 217, 255, 0.1);
  --accent-glow: rgba(83, 217, 255, 0.35);
  --danger: #ff7070;
  --warn: #ffc861;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

html { color-scheme: dark; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 420px at 50% -120px, rgba(83, 217, 255, 0.09), transparent 70%),
    radial-gradient(700px 420px at 85% 5%, rgba(139, 124, 255, 0.06), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding: 3rem 1rem 5rem;
}

::selection { background: rgba(83, 217, 255, 0.3); }

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

/* Icons — all inline SVGs share the .i class */
.i {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Visually hidden, still read by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  z-index: 10;
  background: var(--accent);
  color: #03131c;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  transition: transform 0.15s;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* Header */
header { text-align: center; margin-bottom: 2.5rem; position: relative; }
.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
}
.lang-switch a {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.lang-switch a:hover { color: var(--accent); border-color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; }
.brand-link { display: flex; padding: 2px; border-radius: 8px; }
.brand .logo { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2; }
header h1 {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #9adcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header p { color: var(--muted); margin-top: 0.5rem; font-size: 0.92rem; }

main { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; }

section {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
h2::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--accent-glow);
}

.hint, .dz-hint { color: var(--muted); font-size: 0.82rem; }

/* Dropzone */
#dropzone {
  border: 1px dashed var(--border-strong);
  cursor: pointer;
  text-align: center;
  padding: 3rem 1.5rem;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
#dropzone:hover, #dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 32px rgba(83, 217, 255, 0.08) inset, 0 0 24px rgba(83, 217, 255, 0.06);
}
/* Keep a real outline: a dashed 1px border identical to :hover would make
   focus indistinguishable from mouse-over on the largest control on the page. */
#dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dz-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.dz-icon .i { width: 26px; height: 26px; stroke-width: 1.8; }
.dz-title { font-size: 0.95rem; }
.dz-title strong { font-weight: 600; }
.dz-hint { margin-top: 0.4rem; }

/* Gallery */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { margin-bottom: 0; }
.section-actions { display: flex; gap: 0.5rem; }
#count { color: var(--accent); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0; }

#gallery {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}
#gallery li {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0b0e15;
  cursor: grab;
  user-select: none;
  transition: border-color 0.15s;
}
#gallery li:hover { border-color: var(--border-strong); }
#gallery li.dragging { opacity: 0.35; border-color: var(--accent); }
#gallery li img {
  width: 100%;
  height: 96px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  background: repeating-conic-gradient(#11141d 0% 25%, #0b0e15 0% 50%) 0 0 / 16px 16px;
}
#gallery li .order {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(5, 8, 14, 0.85);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
}
#gallery li .remove {
  position: absolute;
  top: 4px; right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: rgba(5, 8, 14, 0.85);
  color: var(--text);
  width: 24px; height: 24px; /* WCAG 2.5.8 minimum pointer target */
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
#gallery li .remove .i { width: 12px; height: 12px; }
#gallery li .remove:hover { color: var(--danger); border-color: var(--danger); }
#gallery li .foot {
  display: flex;
  align-items: center;
  min-height: 24px;
  border-top: 1px solid var(--border);
}
#gallery li .name {
  flex: 1;
  min-width: 0;
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0.4rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
#gallery li .move {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 26px;
  align-self: stretch;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
#gallery li .move .i { width: 12px; height: 12px; }
#gallery li .move:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
#gallery li .move:disabled { opacity: 0.3; cursor: default; }

/* Options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}
.option label, .option .option-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.option label span { color: var(--accent); font-family: var(--mono); }

.option input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.option input[type="number"]:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}

/* The input box is the pointer target, not the thumb drawn over it: a 4px-tall
   input is a 4px-tall target. Give it 24px for WCAG 2.5.8 and let the
   pseudo-elements draw the thin track. */
.option input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0.35rem 0;
  background: transparent;
  cursor: pointer;
}
.option input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
}
.option input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px; /* (track 4px - thumb 24px) / 2 */
  border-radius: 50%;
  border: none;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: grab;
}
.option input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
}
.option input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: grab;
}
.option .range-value {
  display: block;
  margin-top: 0.15rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.option input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border-control);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s;
}
.option input[type="color"]:hover { border-color: var(--border-strong); }
.option input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.option input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.option input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }

.layout-picker, .format-picker { display: flex; gap: 0.5rem; }
.format-btn {
  flex: 1;
  padding: 0.65rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}
.format-btn:hover { color: var(--text); border-color: var(--border-strong); }
.format-btn.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px rgba(83, 217, 255, 0.12);
}
.layout-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}
.layout-btn .i { width: 22px; height: 22px; stroke-width: 1.7; }
.layout-btn:hover { color: var(--text); border-color: var(--border-strong); }
.layout-btn.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  /* inset ring = a non-colour cue for the selected state (WCAG 1.4.1) */
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px rgba(83, 217, 255, 0.12);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.4rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn .i { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); color: #03131c; }
.btn.primary:hover { background: #7ce2ff; box-shadow: 0 0 24px var(--accent-glow); }
.btn.primary:disabled,
.btn.primary[aria-disabled="true"] { opacity: 0.55; cursor: wait; box-shadow: none; }
.btn.primary[aria-disabled="true"]:hover { background: var(--accent); box-shadow: none; }
.btn.subtle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.btn.subtle:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.03); }

#process { width: 100%; }
.error { color: var(--danger); margin-top: 0.9rem; font-size: 0.88rem; }

/* Result */
.stats { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.stats span .i { width: 14px; height: 14px; color: var(--accent); }
.stats span.warn { border-color: rgba(255, 200, 97, 0.4); color: var(--warn); }
.stats span.warn .i { color: var(--warn); }

.preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: 60vh;
  background: repeating-conic-gradient(#11141d 0% 25%, #0b0e15 0% 50%) 0 0 / 20px 20px;
  text-align: center;
}
.preview-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.preview-wrap::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 999px; }
.preview-wrap::-webkit-scrollbar-track { background: transparent; }
#preview { max-width: 100%; display: inline-block; }
.result-actions { display: flex; gap: 0.75rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; }
#result:focus { outline: none; }
#result:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Editorial content below the tool ---- */

.content {
  max-width: 760px;
  margin: 3.5rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}
.content h2 {
  display: block;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--text);
  margin-bottom: 0.85rem;
}
.content h2::before { content: none; }
.content h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.content p {
  color: #b7bfd0;
  font-size: 0.97rem;
  line-height: 1.72;
}

.steps, .cases { list-style: none; display: grid; gap: 1.4rem; }
.cases { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.steps { counter-reset: step; }
.steps li { position: relative; padding-left: 2.6rem; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  width: 1.85rem;
  height: 1.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.82rem;
}
.cases li {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  background: var(--panel);
}

/* Wide tables scroll inside their own box rather than the page */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.specs { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.specs tr + tr { border-top: 1px solid var(--border); }
.specs th, .specs td { padding: 0.7rem 1.1rem; text-align: left; }
.specs th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.specs td { color: #b7bfd0; }

.faq { display: flex; flex-direction: column; gap: 0.6rem; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  list-style: none;
  transition: background 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.faq-item summary:hover { background: rgba(255, 255, 255, 0.03); }
.faq-item summary h3 { margin: 0; }
.faq-item p { padding: 0 1.1rem 1.1rem; }

.related { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.related a {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.related a:hover { color: var(--accent); border-color: var(--accent); }

footer {
  max-width: 760px;
  margin: 3.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
footer p { color: var(--muted); font-size: 0.84rem; }
.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  margin-top: 0.7rem;
  font-size: 0.84rem;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-links [aria-current="page"] { color: var(--text); }

header .updated { color: var(--muted); font-size: 0.82rem; margin-top: 0.5rem; }

/* Definition-style list used in the legal pages */
.facts { list-style: none; display: grid; gap: 0.45rem; margin: 0.9rem 0; }
.facts li { color: #b7bfd0; font-size: 0.95rem; }
.facts li span {
  display: inline-block;
  min-width: 12rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.content a { color: var(--accent); }
.content ul:not(.related):not(.cases):not(.facts) {
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
  color: #b7bfd0;
  font-size: 0.97rem;
  line-height: 1.7;
}
.content p + p { margin-top: 0.8rem; }
#content:focus { outline: none; }
#content:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
