/* ===================================================================
   resizedphoto — Design System
   White / black / green. System fonts. No third-party requests.
   =================================================================== */

/* -------------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------------- */

:root {
  /* Brand */
  --green: #0E7A3D;
  --green-hover: #0A6432;
  --green-press: #08512A;
  --green-soft: #EAF6EF;
  --green-line: #BFE3CE;
  --green-ink: #0A6432;
  --danger: #C0392B;
  --danger-soft: #FBEDEB;

  /* Surfaces */
  --bg: #FFFFFF;
  --surface: #F5F5F7;
  --surface-2: #FAFAFA;
  --surface-raised: #FFFFFF;
  --topbar-bg: rgba(255, 255, 255, 0.72);
  --sidebar-bg: rgba(246, 246, 248, 0.84);
  --scrim: rgba(0, 0, 0, 0.28);

  /* Text */
  --ink: #1D1D1F;
  --ink-2: #6E6E73;
  /* --ink-3 carries the small "quiet" text (meta lines, labels, placeholders),
     so it has to clear 4.5:1 (WCAG AA) against every surface it sits on --
     --surface #F5F5F7 is the tightest at 4.66:1, and it passes on white at
     5.07:1. That is why it shares --ink-2's value: a lighter grey cannot hold
     4.5:1 on the tinted surfaces. Do not lighten it back towards #86868B
     (3.62:1 on white). */
  --ink-3: #6E6E73;
  --ink-on-green: #FFFFFF;

  /* Lines */
  --line: #E5E5EA;
  --line-strong: #D2D2D7;

  /* Depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.05), 0 18px 48px rgba(0, 0, 0, 0.12);
  --shadow-green: 0 1px 2px rgba(14, 122, 61, 0.16), 0 6px 18px rgba(14, 122, 61, 0.14);

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Shape */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --t-fast: 140ms;
  --t-base: 220ms;
  --t-slow: 320ms;

  /* Metrics */
  --topbar-h: 56px;
  --sidebar-w: 272px;
  --page-max: 1180px;
  --page-pad: 24px;
}

[data-theme="dark"] {
  --green: #30D158;
  --green-hover: #46D96A;
  --green-press: #5FE27F;
  --green-soft: rgba(48, 209, 88, 0.14);
  --green-line: rgba(48, 209, 88, 0.32);
  --green-ink: #30D158;
  --danger: #FF6B5E;
  --danger-soft: rgba(255, 107, 94, 0.14);

  --bg: #000000;
  --surface: #1C1C1E;
  --surface-2: #141416;
  --surface-raised: #1C1C1E;
  --topbar-bg: rgba(0, 0, 0, 0.72);
  --sidebar-bg: rgba(28, 28, 30, 0.84);
  --scrim: rgba(0, 0, 0, 0.55);

  --ink: #F5F5F7;
  --ink-2: #A1A1A6;
  --ink-3: #86868B;
  --ink-on-green: #06170C;

  --line: #38383A;
  --line-strong: #48484A;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.6), 0 18px 48px rgba(0, 0, 0, 0.55);
  --shadow-green: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(48, 209, 88, 0.16);
}

/* -------------------------------------------------------------------
   2. Reset & base
   ------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
}

body {
  margin: 0;
  padding-top: var(--topbar-h);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

body.nav-open { overflow: hidden; }

img, svg, canvas { max-width: 100%; display: block; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--green-ink);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

::selection {
  background: var(--green-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.visually-hidden {
  position: absolute !important;
  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;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--green);
  color: var(--ink-on-green);
  border-radius: var(--r-sm);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--t-base) var(--ease-out);
}
.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

/* -------------------------------------------------------------------
   3. Layout
   ------------------------------------------------------------------- */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 40px var(--page-pad) 80px;
}

.page-narrow { max-width: 760px; }

.section { margin-bottom: 56px; }
.section:last-child { margin-bottom: 0; }

.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 32px; }

/* -------------------------------------------------------------------
   4. Top bar
   ------------------------------------------------------------------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 60;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: box-shadow var(--t-base) var(--ease-out);
}

.topbar.scrolled {
  box-shadow: 0 1px 0 var(--line), 0 1px 12px rgba(0, 0, 0, 0.04);
}

.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--page-pad);
}

.topbar-spacer { flex: 1; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { transform: scale(0.94); }

.icon-btn svg { width: 20px; height: 20px; }

/* The toggle swaps between a menu and a close mark. */
.ic-close { display: none; }
body.nav-open .ic-menu { display: none; }
body.nav-open .ic-close { display: block; }

/* Light mode offers the moon, dark mode offers the sun. */
.ic-sun { display: none; }
[data-theme="dark"] .ic-sun { display: block; }
[data-theme="dark"] .ic-moon { display: none; }

/* Wordmark */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.025em;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  background: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-on-green);
}
.brand-mark svg { width: 15px; height: 15px; }

.brand-text .word-accent { color: var(--green-ink); }

/* -------------------------------------------------------------------
   5. Sidebar
   ------------------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base) var(--ease-out),
    visibility 0s linear var(--t-base);
}
.scrim.show {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--t-base) var(--ease-out), visibility 0s;
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line);
  transform: translateX(-101%);
  visibility: hidden;
  transition: transform var(--t-slow) var(--ease-sheet),
    visibility 0s linear var(--t-slow);
  overscroll-behavior: contain;
}
.sidebar.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform var(--t-slow) var(--ease-sheet), visibility 0s;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 28px;
}

.nav-group + .nav-group { margin-top: 22px; }

.nav-group-label {
  padding: 0 10px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 450;
  line-height: 1.35;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out);
}
.nav-item:hover {
  background: var(--surface);
  text-decoration: none;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--ink-3);
  transition: color var(--t-fast) var(--ease-out);
}
.nav-item:hover svg { color: var(--ink-2); }

.nav-item[aria-current="page"] {
  background: var(--green-soft);
  color: var(--green-ink);
  font-weight: 550;
}
.nav-item[aria-current="page"] svg { color: var(--green-ink); }

/* -------------------------------------------------------------------
   6. Buttons
   ------------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
.btn-primary svg,
.btn-secondary svg,
.btn-ghost svg { width: 17px; height: 17px; flex: none; }

.btn-primary > span,
.btn-secondary > span,
.btn-ghost > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--green);
  color: var(--ink-on-green);
  box-shadow: var(--shadow-green);
}
.btn-primary:hover {
  background: var(--green-hover);
  text-decoration: none;
}
.btn-primary:active { transform: scale(0.98); background: var(--green-press); }

.btn-secondary {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  text-decoration: none;
}
.btn-secondary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.btn-ghost:active { transform: scale(0.98); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 0.875rem; }
.btn-block { width: 100%; }

.btn-preset {
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--t-fast) var(--ease-out);
}
.btn-preset:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}
.btn-preset.active {
  background: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green-ink);
  font-weight: 550;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-file-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  background: var(--green);
  color: var(--ink-on-green);
  font-size: 0.9375rem;
  font-weight: 550;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.btn-file-select:hover { background: var(--green-hover); }
.btn-file-select:active { transform: scale(0.98); }

/* -------------------------------------------------------------------
   7. Form controls
   ------------------------------------------------------------------- */

.control-group { margin-bottom: 18px; }

.control-group > label,
.control-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.8125rem;
  font-weight: 550;
  letter-spacing: -0.005em;
  color: var(--ink-2);
}

.input-text,
.select-input,
textarea.input-text {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 0.9375rem;
  transition: border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
textarea.input-text { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }

.input-text:focus,
.select-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.select-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%2386868B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

input[type="range"].range-slider,
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--line);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform var(--t-fast) var(--ease-out);
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.12); cursor: grabbing; }
input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  cursor: grab;
}
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--green-soft);
}

.val-badge {
  display: inline-block;
  min-width: 46px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-2);
  text-align: center;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--ink);
  cursor: pointer;
}
.switch-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
  flex: none;
}

/* -------------------------------------------------------------------
   8. Home — hero, search, sections, cards
   ------------------------------------------------------------------- */

.home-hero {
  padding: 48px 0 40px;
  text-align: center;
}

.home-title {
  font-size: clamp(2.25rem, 1.4rem + 3.4vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  margin: 26px auto 0;
  /* Vertical inset so the field's contents never sit flush against the
     border. The outer height is fixed at 50px, so this is box-sizing safe. */
  padding: 4px 12px 4px 16px;
  height: 50px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
.search-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}
.search-field > svg {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  flex: none;
}
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
}
.search-field input::placeholder { color: var(--ink-3); }

.kbd {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 2px 6px;
  white-space: nowrap;
}

.popular-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--t-fast) var(--ease-out);
}
.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}
.chip svg { width: 15px; height: 15px; color: var(--ink-3); }

.tool-section { margin-top: 52px; }

.tool-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tool-section-title {
  font-size: 1.375rem;
  letter-spacing: -0.025em;
}

.tool-section-count {
  font-size: 0.8125rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 12px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--t-base) var(--ease-out),
    box-shadow var(--t-base) var(--ease-out),
    transform var(--t-base) var(--ease-out);
}
.tool-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card:active { transform: translateY(0); }

.tool-card-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--green-soft);
  color: var(--green-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tool-card-icon svg { width: 19px; height: 19px; }

.tool-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.tool-card-note {
  margin: -6px 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-2);
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tool-card-chevron {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--ink-3);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity var(--t-fast) var(--ease-out),
    transform var(--t-base) var(--ease-out);
}
.tool-card:hover .tool-card-chevron {
  opacity: 1;
  transform: none;
  color: var(--green-ink);
}

/* Sponsored slot */

.ad-slot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin: 32px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-decoration: none;
  color: var(--ink);
  transition: border-color var(--t-base) var(--ease-out);
}
.ad-slot:hover { border-color: var(--line-strong); text-decoration: none; }

.ad-label {
  flex: none;
  /* 11px floor: the sponsorship disclosure has to be readable, not just
     present. 0.625rem (10px) dropped under the minimum for functional text. */
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 2px 6px;
}

.ad-slot-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.ad-slot-icon svg { width: 17px; height: 17px; }

.ad-slot-text { flex: 1; min-width: 0; }
.ad-slot-text strong { display: block; font-size: 0.9375rem; font-weight: 600; }
.ad-slot-text span { font-size: 0.875rem; color: var(--ink-2); }

.ad-slot-cta {
  flex: none;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ad-slot-cta svg { width: 14px; height: 14px; }

/* -------------------------------------------------------------------
   9. Tool pages
   ------------------------------------------------------------------- */

.tool-page-header {
  padding: 36px 0 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--ink-2); }
.breadcrumb svg { width: 13px; height: 13px; opacity: 0.6; }

.tool-page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tool-page-icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--green-soft);
  color: var(--green-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tool-page-icon svg { width: 22px; height: 22px; }

.tool-page-desc {
  margin: 10px 0 0;
  max-width: 62ch;
  font-size: 1rem;
  color: var(--ink-2);
}

.tool-workspace { margin-bottom: 48px; }

.tool-note {
  margin: -30px 0 48px;
  max-width: 70ch;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-3);
}

.workspace-card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.dropzone {
  margin: 24px;
  padding: 44px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease-out),
    background var(--t-base) var(--ease-out);
}
.dropzone:hover { border-color: var(--green-line); }
.dropzone.dragover {
  border-color: var(--green);
  background: var(--green-soft);
}

.dropzone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: var(--r-md);
  background: var(--green-soft);
  color: var(--green-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropzone-icon svg { width: 24px; height: 24px; }

.dropzone h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.dropzone p {
  font-size: 0.875rem;
  color: var(--ink-2);
  margin-bottom: 18px;
}

.tool-controls-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.controls-panel {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.controls-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.preview-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.stats-badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat-value {
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-diff-good { color: var(--green-ink); }

.preview-box {
  flex: 1;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

.preview-img {
  max-width: 100%;
  max-height: 560px;
  object-fit: contain;
  border-radius: var(--r-xs);
}

.progress-container {
  margin-bottom: 18px;
}

.progress-track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  background: var(--green);
  transition: width var(--t-base) var(--ease-out);
}
.progress-text {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* File and page lists */

.pdf-file-list,
.batch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.batch-row,
.batch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
}
.batch-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.batch-thumb {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--r-xs);
  object-fit: cover;
  background: var(--surface);
}
.batch-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.batch-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-size {
  font-size: 0.75rem;
  color: var(--ink-2);
}
.batch-status {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-2);
}
.batch-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}
.btn-dl-item,
.btn-remove-item {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-dl-item:hover { color: var(--green-ink); border-color: var(--green-line); }
.btn-remove-item:hover { color: #C0392B; border-color: #E8B4AE; }
.btn-dl-item svg, .btn-remove-item svg { width: 15px; height: 15px; }

/* File lists for Merge PDF & Images to PDF */
.pdf-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  transition: border-color var(--t-fast) var(--ease-out);
}
.pdf-file-item:hover {
  border-color: var(--line-strong);
}
.pdf-file-thumb {
  width: 44px;
  height: 56px;
  flex: none;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.pdf-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pdf-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pdf-file-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-file-meta {
  font-size: 0.75rem;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdf-file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.pdf-btn-action {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
}
.pdf-btn-action:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--ink);
}
.pdf-btn-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pdf-btn-remove:hover:not(:disabled) {
  color: #C0392B;
  border-color: #E8B4AE;
  background: #FDF2F1;
}

.pdf-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.pdf-page-card,
.pdf-page-thumb {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-raised);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
.pdf-page-card:hover,
.pdf-page-thumb:hover { border-color: var(--line-strong); }
.pdf-page-card.selected,
.pdf-page-thumb.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.pdf-page-card img,
.pdf-page-thumb img,
.pdf-page-card canvas,
.pdf-page-thumb canvas {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface);
}
.pdf-page-num,
.pdf-page-number {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  pointer-events: none;
}
.rotate-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: var(--green);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  pointer-events: none;
}
.unitLabel {
  font-weight: 500;
  color: var(--ink-2);
}
.stat-diff-bad {
  color: #C0392B !important;
  font-weight: 600;
}

/* Cropper */

.crop-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  user-select: none;
  touch-action: none;
}
.crop-container img { max-width: 100%; display: block; }
.crop-box {
  position: absolute;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  cursor: move;
}
.crop-box.circle-crop { border-radius: 50%; }
.crop-grid-line-h,
.crop-grid-line-v {
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}
.crop-grid-line-h { left: 0; right: 0; height: 1px; }
.crop-grid-line-v { top: 0; bottom: 0; width: 1px; }
.crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 3px;
}
.crop-handle.tl { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-handle.tr { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-handle.bl { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-handle.br { right: -7px; bottom: -7px; cursor: nwse-resize; }

.fade-in { animation: fade-in var(--t-base) var(--ease-out); }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Colour palette swatches */

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.swatch {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-raised);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.swatch:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.swatch:active { transform: translateY(0); }
.swatch-color { display: block; height: 64px; width: 100%; }
.swatch-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.8125rem;
}
.swatch-hex {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
  text-transform: uppercase;
}
.swatch-share { font-size: 0.6875rem; color: var(--ink-3); }

/* Detail list */

.detail-list {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-raised);
}

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  font-size: 0.875rem;
}
.detail-row + .detail-row { border-top: 1px solid var(--line); }
.detail-row dt { color: var(--ink-2); flex: none; }
.detail-row dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.detail-empty {
  padding: 14px 12px;
  font-size: 0.875rem;
  color: var(--ink-3);
}

/* Extracted PDF text */

.text-pages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
}

.text-page {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  overflow: hidden;
}
.text-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 600;
}
.text-page-body {
  padding: 12px;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
  color: var(--ink-2);
}
.text-page-body:empty::after {
  content: "No text on this page.";
  color: var(--ink-3);
}

.text-page-copy {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  border-radius: var(--r-xs);
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-2);
}
.text-page-copy:hover { border-color: var(--line-strong); color: var(--ink); }

/* -------------------------------------------------------------------
   10. Legal pages
   ------------------------------------------------------------------- */

.prose {
  max-width: 70ch;
  font-size: 1rem;
  line-height: 1.68;
  color: var(--ink);
}
.prose h2 {
  font-size: 1.1875rem;
  margin: 40px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  letter-spacing: -0.02em;
}
.prose h2:first-of-type { margin-top: 8px; padding-top: 0; border-top: 0; }
.prose h3 {
  font-size: 1rem;
  margin: 26px 0 8px;
  font-weight: 600;
}
.prose p { margin-bottom: 14px; color: var(--ink-2); }
.prose ul { margin: 0 0 16px; }
.prose li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
  color: var(--ink-2);
}
.prose li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}
.prose strong { color: var(--ink); font-weight: 600; }
/* :where() keeps this rule at the specificity of a plain element selector,
   so it styles prose links without out-ranking component styles. Without it,
   ".prose a" (0,1,1) beat ".btn-primary" (0,1,0) and a green button inside a
   .prose block ended up green text on a green background. */
:where(.prose) a { color: var(--green-ink); text-decoration: underline; text-underline-offset: 2px; }

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 56px;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.toc-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.toc a {
  display: block;
  padding: 5px 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--ink-2);
  text-decoration: none;
}
.toc a:hover { color: var(--ink); }

.meta-note {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-3);
}

.contact-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.contact-email svg { width: 18px; height: 18px; color: var(--green-ink); flex: none; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
}
.copy-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.copy-btn svg { width: 15px; height: 15px; }

/* -------------------------------------------------------------------
   11. Footer
   ------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.footer-inner {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 48px var(--page-pad) 28px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 36px;
}

.footer-brand {
  font-size: 0.9375rem;
  color: var(--ink-2);
  max-width: 30ch;
}
.footer-brand .brand { margin-bottom: 10px; }

.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col a {
  font-size: 0.875rem;
  color: var(--ink-2);
  text-decoration: none;
}
.footer-col a:hover { color: var(--ink); text-decoration: underline; }
.footer-col a[aria-current="page"] { color: var(--green-ink); font-weight: 550; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--ink-3);
}

/* -------------------------------------------------------------------
   12. Toast
   ------------------------------------------------------------------- */

#toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  padding: 11px 15px;
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--ink);
  transition: opacity var(--t-base) var(--ease-out),
    transform var(--t-base) var(--ease-out);
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid #D14343; }
.toast-info { border-left: 3px solid var(--ink-3); }

/* -------------------------------------------------------------------
   13. Responsive
   ------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .tool-controls-wrapper { grid-template-columns: 1fr; }
  .controls-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .legal-layout { grid-template-columns: 1fr; gap: 32px; }
  .toc { position: static; border-left: 0; padding-left: 0; }
  .toc-title { margin-top: 8px; }
}

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; max-width: none; }
}

@media (max-width: 640px) {
  :root { --page-pad: 16px; }
  .page { padding: 28px var(--page-pad) 56px; }
  .home-hero { padding: 32px 0 28px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .tool-card { padding: 15px; }
  .tool-section { margin-top: 40px; }
  .footer-inner { padding: 36px var(--page-pad) 22px; }
  .footer-grid { grid-template-columns: 1fr; }
  .search-field { height: 46px; }
  .kbd { display: none; }
  .dropzone { margin: 16px; padding: 32px 18px; }
  .tool-page-header { padding: 24px 0 20px; }
  #toast-container { left: 16px; right: 16px; }
  .toast { max-width: none; }
}

@media (max-width: 400px) {
  .tool-grid { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------
   14. Preferences
   ------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in { animation: none; }
  .tool-card:hover { transform: none; }
  .sidebar, .scrim { transition: opacity 160ms linear, visibility 0s linear 160ms; }
  .sidebar.open { transform: none; transition: opacity 160ms linear, visibility 0s; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .sidebar {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .scrim { background: var(--bg); }
}

@media (prefers-contrast: more) {
  :root { --line: #000000; --line-strong: #000000; }
  [data-theme="dark"] { --line: #FFFFFF; --line-strong: #FFFFFF; }
  .tool-card, .workspace-card { border-width: 1.5px; }
}

@media print {
  .topbar, .sidebar, .scrim, .tool-workspace, #toast-container { display: none !important; }
  body { padding-top: 0; }
}
