/* Palette and type scale mirrored from matrixinnsolutions.com. Dark is the
   brand default; light is a derived counterpart for viewers whose OS asks. */
:root {
  --bg: #0a0c12;
  --surface: #141926;
  --surface-2: #1a2030;
  --thumb-bg: #0e111a;
  --text: #eef0f6;
  --text-dim: #b7c0d2;
  --text-muted: #8b93a8;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --track: rgba(255, 255, 255, .16);
  --accent: #c9f24e;
  --accent-hover: #a9d62f;
  --accent-text: #c9f24e;
  --accent-soft: rgba(201, 242, 78, .07);
  --accent-edge: rgba(201, 242, 78, .45);
  --on-accent: #0a0c12;
  --danger: #ff6b6b;
  --warn-bg: rgba(255, 107, 107, .10);

  --sans: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: 'Bricolage Grotesque', Georgia, serif;

  --r: 14px;
  --r-lg: 22px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    /* Neutral greys, no blue cast; cards sit on white and are separated by
       their border rather than by a tinted page background. */
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f7f7f8;
    --thumb-bg: #f0f0f1;
    --text: #0a0c12;
    --text-dim: #45464d;
    --text-muted: #6b6b73;
    --line: rgba(0, 0, 0, .11);
    --line-2: rgba(0, 0, 0, .20);
    --track: rgba(0, 0, 0, .14);
    /* Lime is unreadable as text on white; it darkens here but stays the fill. */
    --accent-text: #4f6d05;
    --accent-hover: #b6e034;
    --accent-soft: rgba(201, 242, 78, .22);
    --accent-edge: rgba(120, 160, 20, .55);
    --danger: #c0392b;
    --warn-bg: rgba(192, 57, 43, .07);
  }
}

@font-face {
  font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('/assets/fonts/hanken-grotesk-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 600;
  font-display: swap; src: url('/assets/fonts/hanken-grotesk-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('/assets/fonts/bricolage-grotesque-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 800;
  font-display: swap; src: url('/assets/fonts/bricolage-grotesque-800.woff2') format('woff2');
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent-text); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 600; z-index: 50;
}
.skip-link:focus { left: 0; }

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: 16px 0;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.logo { display: block; line-height: 0; }
.logo img { width: auto; height: 30px; display: block; }
.tagline { margin: 0; font-size: 0.82rem; color: var(--text-muted); }

/* Nav */
.site-nav { border-bottom: 1px solid var(--line); background: var(--bg); }
.nav-row {
  display: flex; align-items: center; gap: 4px;
  padding-top: 6px; padding-bottom: 6px;
  /* .wrap's 880px reading-width cap is too tight for 6 tool links plus two
     dropdowns -- it pushed them into nav-inner's horizontal-scroll fallback
     on an ordinary 1280px desktop, silently clipping "Compress" mid-word
     with no scroll affordance to hint why. Same specificity as .wrap, later
     in the file, so this wins for max-width while still inheriting .wrap's
     centering margin and side padding. */
  max-width: 1100px;
}
/* Tool links scroll internally on narrow screens; the two dropdowns sit
   outside this scroller (see .nav-dropdown below) so their popovers are
   never clipped by nav-inner's overflow-x. */
.nav-inner {
  display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  flex: 1 1 0; min-width: 0;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 7px 13px; border-radius: 999px; white-space: nowrap;
  font-size: 0.88rem; font-weight: 600; text-decoration: none;
  color: var(--text-muted); border: none; background: none;
  font-family: inherit; cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-current { color: var(--on-accent); background: var(--accent); }

/* Dropdowns: plain <details>/<summary>, same pattern as the FAQ blocks —
   no JS required for the open/close behaviour itself. */
.nav-dropdown { position: relative; flex-shrink: 0; }
.nav-dropdown-trigger {
  display: flex; align-items: center; gap: 4px;
  list-style: none;
}
.nav-dropdown-trigger::-webkit-details-marker { display: none; }
.nav-dropdown-trigger svg { width: 14px; height: 14px; transition: transform .15s; }
.nav-dropdown[open] .nav-dropdown-trigger svg { transform: rotate(180deg); }
.nav-dropdown[open] .nav-dropdown-trigger { color: var(--text); background: var(--surface-2); }
.nav-dropdown-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; max-width: calc(100vw - 40px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 6px; z-index: 30;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}
.nav-dropdown-panel .nav-link { display: block; text-align: left; }

.breadcrumb {
  font-size: 0.8rem; color: var(--text-muted);
  padding-top: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb span:last-child { color: var(--text-dim); }

/* Intro */
.intro { text-align: center; padding: 44px 0 30px; }
.intro h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.75rem, 4.6vw, 2.7rem);
  line-height: 1.04; letter-spacing: -0.035em; margin: 0 0 14px;
}
.intro p { color: var(--text-dim); margin: 0 auto; max-width: 640px; }
.post-date { color: var(--text-muted); font-size: 0.82rem; margin: 0 0 10px; }

/* Tool card */
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px; margin-bottom: 46px;
}

.dropzone {
  border: 2px dashed var(--line-2); border-radius: var(--r);
  padding: 44px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent-edge); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { width: 40px; height: 40px; color: var(--accent-text); margin-bottom: 10px; }
.dz-title { font-weight: 600; font-size: 1.05rem; margin: 4px 0; }
.dz-sub { margin: 4px 0; color: var(--text-dim); }
.dz-formats { font-size: 0.8rem; color: var(--text-muted); margin: 10px 0 0; }
.link-btn {
  background: none; border: none; color: var(--accent-text); font: inherit;
  cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px;
}

.notice {
  margin: 16px 0 0; padding: 11px 14px; border-radius: 10px;
  font-size: 0.86rem; background: var(--warn-bg);
  border: 1px solid var(--line-2); color: var(--text-dim);
}

/* Controls */
.controls {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end;
  margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line);
}
.control-group {
  display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 190px;
}
.control-group-wide { flex-basis: 100%; }
.control-group > label {
  font-size: 0.76rem; font-weight: 600; color: var(--text-muted);
  letter-spacing: .05em; text-transform: uppercase;
}
.control-group select, .control-group input[type="range"] { width: 100%; }

select {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  font: inherit; font-size: 0.95rem; background: var(--surface-2); color: var(--text);
}

/* Needs to out-specify `.control-group > label`, which uppercases field labels. */
.control-group > label.checkbox {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 0.86rem; color: var(--text-dim); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 400;
}
.checkbox input { accent-color: var(--accent); width: 17px; height: 17px; margin-top: 2px; flex-shrink: 0; }

.control-hint { margin: 2px 0 0; font-size: 0.76rem; color: var(--text-muted); line-height: 1.4; }

/* Target Size mode — /compress-image only */
.mode-switch { display: flex; gap: 6px; }
.mode-btn {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text-muted); font: inherit;
  font-size: 0.86rem; font-weight: 600; cursor: pointer;
}
.mode-btn.is-active { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.mode-btn:not(.is-active):hover { color: var(--text); border-color: var(--accent-edge); }

.target-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.target-preset-btn {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font: inherit;
  font-size: 0.84rem; font-weight: 600; cursor: pointer;
}
.target-preset-btn:hover { border-color: var(--accent-edge); color: var(--accent-text); }

.target-custom { display: flex; gap: 8px; align-items: center; max-width: 220px; }
.target-custom input[type="number"] {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); font: inherit; font-size: 0.95rem;
  background: var(--surface-2); color: var(--text);
}
.target-custom select { width: auto; flex-shrink: 0; }

/* Styled explicitly rather than via accent-color: Chrome derives its own
   unfilled-track colour from the accent and picks a dark bar for lime. */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0 var(--fill, 80%), var(--track) var(--fill, 80%) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}

.control-buttons { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }

.btn {
  padding: 11px 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-edge); color: var(--accent-text); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }

.progress { width: 100%; margin: 0; font-size: 0.84rem; color: var(--accent-text); font-weight: 600; }

/* File list */
.file-list {
  list-style: none; margin: 22px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.file-item {
  display: flex; align-items: center; gap: 13px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
}
.file-thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: var(--thumb-bg); flex-shrink: 0;
}
.file-thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 700; color: var(--text-muted);
  border: 1px solid var(--line);
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 0.79rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.file-status { font-size: 0.77rem; font-weight: 600; white-space: nowrap; letter-spacing: .03em; }
.file-status.pending { color: var(--text-muted); }
.file-status.working, .file-status.done { color: var(--accent-text); }
.file-status.error { color: var(--danger); }
.file-download {
  font-size: 0.85rem; font-weight: 600; color: var(--accent-text);
  text-decoration: none; white-space: nowrap; border-bottom: 1px solid transparent;
}
.file-download:hover { border-bottom-color: currentColor; }
.file-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.2rem; line-height: 1; padding: 4px;
}
.file-remove:hover { color: var(--danger); }

.summary {
  margin: 16px 0 0; font-size: 0.86rem; font-weight: 600;
  color: var(--accent-text); text-align: center;
}

/* Trust cards */
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 50px; }
.trust-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px;
}
.trust-item h3 {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.02em;
  font-size: 1.02rem; margin: 0 0 7px;
  display: flex; align-items: center; gap: 9px;
}
.trust-icon { width: 21px; height: 21px; color: var(--accent-text); flex-shrink: 0; }
.trust-item p { font-size: 0.86rem; color: var(--text-dim); margin: 0; }

/* Long-form content */
.prose { max-width: 100%; margin: 0; }
.prose h2 {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.03em;
  font-size: 1.5rem; line-height: 1.15; margin: 40px 0 12px;
}
.prose h3 {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.02em;
  font-size: 1.12rem; margin: 28px 0 8px;
}
.prose p { margin: 0 0 14px; color: var(--text-dim); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; color: var(--text-dim); }
.prose li { margin-bottom: 8px; }
.prose code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
}

.table-wrap { overflow-x: auto; margin: 0 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 0.87rem; }
caption {
  caption-side: bottom; text-align: left; font-size: 0.78rem;
  color: var(--text-muted); padding-top: 9px;
}
th, td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th { color: var(--text-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: .05em; }
tbody th { font-weight: 600; color: var(--text); white-space: normal; }
td { color: var(--text-dim); font-variant-numeric: tabular-nums; }
td.best { color: var(--accent-text); font-weight: 600; }
td.warn { color: var(--danger); font-weight: 600; }
.note-flag {
  display: block; font-size: 0.72rem; color: var(--text-muted);
  text-transform: none; letter-spacing: 0;
}

.link-grid { list-style: none; padding: 0 !important; margin: 0 0 16px; display: grid; gap: 10px; }
.link-grid a {
  display: block; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); text-decoration: none;
  transition: border-color .15s;
}
.link-grid a:hover { border-color: var(--accent-edge); }
.link-grid strong { display: block; color: var(--accent-text); font-size: 0.95rem; }
.link-grid span { display: block; color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }

.post-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.post-list a {
  display: block; padding: 20px; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); text-decoration: none;
  transition: border-color .15s;
}
.post-list a:hover { border-color: var(--accent-edge); }
.post-list strong {
  display: block; font-family: var(--display); font-weight: 700;
  letter-spacing: -0.02em; font-size: 1.15rem; color: var(--text); margin-bottom: 4px;
}
.post-card-date { display: block; color: var(--text-muted); font-size: 0.78rem; margin-bottom: 8px; }
.post-card-excerpt { display: block; color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 0.97rem;
  list-style: none; display: flex; justify-content: space-between; gap: 14px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent-text); font-size: 1.2rem; line-height: 1; }
.faq-item[open] summary::after { content: '−'; }
.faq-answer { padding: 0 0 14px; }
.faq-answer p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 20px; }
.footer-nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  margin-bottom: 20px; font-size: 0.84rem;
}
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent-text); }
.footer-nav-legal { margin-top: 20px; margin-bottom: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.site-footer p { font-size: 0.81rem; color: var(--text-muted); margin: 0; text-align: center; }
.footer-note { max-width: 640px; margin: 0 auto !important; line-height: 1.6; }
.footer-brand { margin-top: 14px !important; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.footer-company { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.footer-company:hover { color: var(--accent-text); }
.footer-sibling { margin-top: 10px !important; }
.footer-sibling a { color: var(--text-muted); font-weight: 600; }
.footer-sibling a:hover { color: var(--accent-text); }
.footer-link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: inherit; color: var(--text-muted); cursor: pointer; }
.footer-link-btn:hover { color: var(--accent-text); }

.consent-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50;
  max-width: 640px; margin: 0 auto; padding: 16px 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.consent-banner p { flex: 1 1 280px; margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--text-dim); }
.consent-banner a { color: var(--accent-text); }
.consent-actions { display: flex; gap: 8px; }
.consent-actions .btn { padding: 8px 18px; font-size: 0.88rem; }

/* Responsive */
@media (max-width: 760px) {
  .trust { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  /* Below this width the tool row + two dropdowns no longer fit on one line.
     Wrap instead of horizontally scrolling — a scroll port narrow enough to
     clip mid-label looks broken, wrapping to a second line does not. */
  .nav-row { flex-wrap: wrap; row-gap: 4px; }
  .nav-inner { flex-wrap: wrap; overflow: visible; flex: 1 1 auto; }
  /* A right-aligned popover can end up positioned off the left edge of a
     narrow screen once the trigger itself has wrapped near the left side.
     Rather than compute a direction, drop the popover positioning entirely
     and let the panel expand inline like an accordion. */
  .nav-dropdown-panel {
    position: static; box-shadow: none; margin-top: 4px; width: 100%;
    max-width: none;
  }
  .intro { padding: 30px 0 22px; }
  .tool-card { padding: 18px; }
  .control-group { min-width: 100%; }
  .logo img { height: 26px; }
  .tagline { display: none; }
  .prose h2 { font-size: 1.3rem; }
  .file-item { flex-wrap: wrap; }
  .file-info { flex-basis: calc(100% - 57px); }
  .file-status, .file-download { margin-left: 57px; }
  .file-download + .file-remove { margin-left: auto; }
}
