/*
 * Copyright (C) 2026, Alex Morales
 * Copyright (C) 2026, sfw.tools sfwtools.com
 *
 * All rights reserved.
 */

/* Theme: default-02 — "operations console".
   default-02 is the live iteration target. When it improves, keep default-01 in
   sync by copying this file over it:
     cp src/client/themes/default-02/theme.css src/client/themes/default-01/theme.css
   (default-01 is an exact copy; the two must render identically.)
   The design reads like an internal productivity suite:
     - light-gray canvas with pure-white content panels (no colored tinting),
     - deep navy accent with square-ish radii and hairline dividers,
     - category sections as two-column rows: a micro-label column + card grid,
     - tool cards as horizontal rows (icon chip left, text right) that highlight
       on hover instead of boxed cards with lift,
     - a slim accent strip across the very top of the page,
     - the whole UI set in self-hosted Varela Round (rounded, friendly).
   Same HTML, same CSS variables; only the rules differ. Both color modes keep
   identical component rules; only the variables change under the dark query. */

/* Self-hosted Varela Round (OFL-1.1) as the console typeface. Subsetted
   WOFF2 (latin + common punctuation/symbols), copied from the shared
   src/client/fonts/ next to theme.css by the build so this relative url()
   resolves on the home page and in every tool mini-site. Varela Round ships a
   single Regular weight; heavier weights are synthesized by the browser, and
   the missing ✓/← glyphs fall back to the system stack. */
@font-face {
  font-family: 'Varela Round';
  src: url('fonts/varela-round.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f5f7;
  --bg-alt: #ffffff;
  --text: #1a2332;
  --text-muted: #5a6572;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --border: #e3e6ea;
  --error: #b3261e;
  --error-bg: #fdecec;
  --radius: 6px;
  --focus-ring: rgb(29 78 216 / 0.25);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151d;
    --bg-alt: #1a2130;
    --text: #e6eaf0;
    --text-muted: #9aa5b1;
    --accent: #5b8bf5;
    --accent-text: #0d1220;
    --border: #2a3342;
    --error: #ff8a80;
    --error-bg: #3a1c1c;
    --radius: 6px;
    --focus-ring: rgb(91 139 245 / 0.3);
  }
}

body {
  background: var(--bg);
  font-family: 'Varela Round', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--focus-ring);
}

/* A slim accent strip across the very top of the page, like a product badge. */

body::before {
  content: '';
  display: block;
  height: 6px;
  background: var(--accent);
}

/* ---------- Header: flat white bar, hairline underline ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.brand {
  flex-direction: row;
  align-items: baseline;
  gap: 0.6rem;
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-name::after {
  content: '|';
  margin-left: 0.6rem;
  color: var(--accent);
  font-weight: 700;
}

.brand-tagline {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  top: -0.03em;
}

/* ---------- Home hero: compact console header ---------- */

#home-title {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-bottom: 0.2rem;
}

main {
  max-width: 72rem;
  padding-bottom: 1rem;
}

/* ---------- Category rows: micro-label column + card grid ---------- */

.tool-grid section {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.tool-grid h2 {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.5rem;
}

/* ---------- Tool cards: icon, name, description stacked ---------- */

.tool-card {
  display: block;
  padding: 1.1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.tool-card:hover,
.tool-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgb(15 23 42 / 0.08);
  transform: translateY(-1px);
}

.tool-card .tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.7rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
  color: var(--accent);
}

.tool-card .tool-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.tool-card h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.tool-card p {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

/* ---------- Section titles: numbered overline ---------- */

.section-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  text-align: center;
}

/* Why / How become white panels with hairline dividers */

.why,
.how {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-top: 2rem;
}

.why ul {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem 1.5rem;
  margin-top: 0.9rem;
}

.why li::before {
  content: '✓';
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.how ul {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem 2rem;
  margin-top: 0.9rem;
}

.how li {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
}

.how h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.how p {
  line-height: 1.5;
}

/* ---------- Focus & inputs ---------- */

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.option input[type='text'],
.option input[type='number'],
.option input[type='color'],
.option select {
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  background: var(--bg);
  border-color: var(--border);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.option input[type='text']:focus,
.option input[type='number']:focus,
.option input[type='color']:focus,
.option select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.option label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.option-help {
  font-size: 0.78rem;
}

/* ---------- Drop zone: flat dashed panel ---------- */

.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 2.75rem 1.5rem;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-alt));
}

/* ---------- Buttons ---------- */

.primary {
  border-radius: var(--radius);
  padding: 0.65rem 1.75rem;
  background: var(--accent);
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}

.primary:active {
  transform: translateY(1px);
}

.guide-toggle {
  border-radius: var(--radius);
  padding: 0.4rem 1rem;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-weight: 600;
  border: 1px solid var(--border);
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.guide-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg);
}

.download {
  border-radius: var(--radius);
  padding: 0.5rem 1.05rem;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.download:hover {
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Tool page ---------- */

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--accent);
}

.tool-title h1 {
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.tool-title .tool-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-description {
  color: var(--text-muted);
}

/* Options and the file section live in a white panel */

.options {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Slim strip between header and fields, not a chunky card. */
  padding: 0.9rem 1.25rem;
}

/* ---------- Guide dialog ---------- */

.guide-head {
  padding: 1rem 1.4rem;
}

.guide-close-btn {
  border-radius: var(--radius);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

/* ---------- Progress ---------- */

.progress-track {
  height: 0.5rem;
  background: var(--bg);
  border-color: var(--border);
}

.progress-bar {
  background: var(--accent);
}

/* ---------- Results ---------- */

.result-text {
  border-radius: var(--radius);
  background: var(--bg-alt);
  border-color: var(--border);
}

/* ---------- Footer: quiet meta row ---------- */

.site-footer {
  border-top: none;
  text-align: center;
  color: var(--text-muted);
  padding: 1rem 1.5rem 4rem;
}

/* Footer lines stack tightly, like a compact signature block. */
.site-footer p {
  margin: 0 0 0.25rem;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.module-line {
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ---------- Mobile: collapse the two-column catalog to one column ----------
   Below 48rem the category micro-label column (9rem) plus the card grid's
   minmax(17rem, 1fr) forces ~27.5rem into a ~24.4rem viewport, clipping cards.
   Every fixed multi-column rule collapses here; the desktop layout above is
   untouched. */
@media (max-width: 48rem) {
  .tool-grid section {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .tool-grid h2 {
    padding-top: 0;
    border-top: none;
  }

  .tool-list {
    grid-template-columns: 1fr;
  }

  .why ul {
    grid-template-columns: 1fr;
  }

  .how ul {
    grid-template-columns: 1fr;
  }
}

/* ---------- Reduced motion ----------
   Users who prefer reduced motion get a still site: no transitions, no
   animations, no hover lift, no smooth scrolling. The blanket !important
   reset is the accepted pattern for this; keep it to this single block. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .tool-card:hover,
  .tool-card:focus-visible {
    transform: none;
  }

  html {
    scroll-behavior: auto !important;
  }
}
