/* ============================================================
   ToolMere — Dark Copper 3D-Clay Design System
   UI Designer deliverable · 2026-09-26
   Dark (default) + light clay themes, WCAG AA, mobile-first,
   CSS-only motion (honours prefers-reduced-motion).
   Contract: DASH_STRUCTURE.md — style blind against it.
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* dark copper clay (default theme) */
  --bg: #0d0f14;
  --bg-deep: #08090d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-hi: rgba(255, 255, 255, 0.08);
  --panel-solid: #151821;
  --edge: rgba(232, 176, 106, 0.18);      /* glowing copper edge */
  --edge-soft: rgba(255, 255, 255, 0.07);
  --acc: #d29a5b;                          /* copper */
  --acc-hi: #f0c078;                       /* bright copper/gold */
  --acc-lo: #8a5a2e;                       /* deep copper */
  --acc-ink: #2b1c0c;                      /* text on copper */
  --text: #f2ede4;
  --muted: #a8a093;                        /* 7.4:1 on --bg — AA */
  --faint: #98917f;                        /* ~5.9:1 — AA for large text */
  --good: #8fd694;
  --bad: #f0938c;
  --warn: #f0c078;
  --info: #93bdf0;

  --r-lg: 20px;   /* chunky clay radii */
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  --shadow-clay:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -3px 8px rgba(0, 0, 0, 0.38),
    0 22px 44px -18px rgba(0, 0, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.5);
  --shadow-clay-sm:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -2px 5px rgba(0, 0, 0, 0.35),
    0 12px 24px -12px rgba(0, 0, 0, 0.8),
    0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(240, 192, 120, 0.22), 0 0 22px rgba(210, 154, 91, 0.28);
  --ease-clay: cubic-bezier(0.22, 0.9, 0.28, 1.25);
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
  --t-fast: 160ms;
  --t-med: 300ms;
}

[data-theme="light"] {
  --bg: #f4efe3;
  --bg-deep: #e9e1cf;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-hi: rgba(255, 255, 255, 0.95);
  --panel-solid: #fbf7ec;
  --edge: rgba(150, 100, 40, 0.30);
  --edge-soft: rgba(120, 85, 40, 0.14);
  --acc: #a86a24;
  --acc-hi: #c98a3a;
  --acc-lo: #7c4f1a;
  --acc-ink: #fff8ec;
  --text: #262014;
  --muted: #6e6252;                        /* ~5.6:1 on --bg — AA */
  --faint: #8a7e6b;
  --good: #2e7d3a;
  --bad: #c0453d;
  --warn: #a86a24;
  --info: #2f6fb8;
  --shadow-clay:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -3px 8px rgba(150, 110, 60, 0.14),
    0 22px 44px -20px rgba(120, 85, 40, 0.35),
    0 2px 6px rgba(120, 85, 40, 0.18);
  --shadow-clay-sm:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 5px rgba(150, 110, 60, 0.12),
    0 12px 24px -12px rgba(120, 85, 40, 0.3),
    0 1px 3px rgba(120, 85, 40, 0.16);
  --shadow-glow: 0 0 0 1px rgba(200, 138, 58, 0.3), 0 0 22px rgba(200, 138, 58, 0.22);
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(210, 154, 91, 0.10), transparent 60%),
    radial-gradient(900px 500px at 85% 110%, rgba(139, 92, 246, 0.06), transparent 60%),
    var(--bg);
  min-height: 100vh;
}

[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(200, 138, 58, 0.14), transparent 60%),
    var(--bg);
}

img, svg { display: inline-block; vertical-align: middle; max-width: 100%; }

/* overflow guards: the page must never scroll horizontally, even at 360px */
html, body { overflow-x: clip; }
/* long unbreakable strings wrap instead of forcing overflow */
h1, h2, h3, p, .breadcrumb, .tool-head h1, .feat-name, .result, .result-box, .note {
  overflow-wrap: break-word;
}

a { color: var(--acc-hi); text-decoration: none; }
a:hover { color: var(--acc); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }

p { margin: 0 0 0.8em; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--acc-hi);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: rgba(210, 154, 91, 0.4); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  background: var(--acc);
  color: var(--acc-ink);
  font-weight: 700;
  padding: 0.7rem 1.2rem;
  border-radius: var(--r-sm);
  transition: top var(--t-fast) var(--ease-out);
}
.skip-link:focus { top: 1rem; text-decoration: none; }

.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;
}

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge-soft);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.7);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;  /* left controls | centered logo | right controls */
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.6rem;
}

.header-side { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.header-left { grid-column: 1; grid-row: 1; justify-content: flex-start; }
.header-right { grid-column: 3; grid-row: 1; justify-content: flex-end; }

/* centered brand logo */
.logo-centered { grid-column: 2; grid-row: 1; justify-self: center; }
.logo-img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  box-shadow:
    0 0 16px rgba(96, 165, 250, 0.45),
    0 8px 18px -6px rgba(0, 0, 0, 0.75);
}
.logo-img-sm { width: 40px; height: 40px; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}
.logo:hover { text-decoration: none; color: var(--acc-hi); }

/* (brand mark is now the logo image: .logo-img) */

.logo-text {
  background: linear-gradient(180deg, var(--text), var(--muted));
  -webkit-background-clip: text;
  background-clip: text;
}

/* mobile-first: search takes a full row under the centered logo (all screens) */
.header-search { grid-column: 1 / -1; grid-row: 2; }

#site-search {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 1.1rem 0.65rem 2.8rem;
  font-size: 0.95rem;
  color: var(--text);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d29a5b' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M15.7 15.7L20.4 20.4'/%3E%3C/svg%3E") 0.9rem center / 20px 20px no-repeat,
    linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-clay-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
#site-search::placeholder { color: var(--faint); }
#site-search:focus {
  border-color: var(--acc);
  box-shadow: var(--shadow-clay-sm), var(--shadow-glow);
}

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-clay-sm);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-clay), box-shadow var(--t-fast);
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-clay-sm), var(--shadow-glow); }
.icon-btn:active { transform: translateY(1px); }

#theme-toggle { margin-left: auto; } /* mobile: pushes theme + menu buttons to the right of the logo */
#theme-icon { display: inline-block; line-height: 1; }
.theme-icon-spin { animation: theme-spin 0.5s var(--ease-out); }
@keyframes theme-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---------- 3b. Mobile nav (hamburger) ---------- */
/* Base = mobile (<640px): the toggle is visible and the drawer drops down
   under the sticky header. Desktop (min-width:640px) hides both — see the
   RESPONSIVE LAYER at the end of this file. */
.menu-toggle { display: inline-flex; }
.menu-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 20px;
}
.menu-bars span {
  display: block;
  height: 2.5px;
  border-radius: 2px;
  background: var(--text);
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast);
}
/* morph to an X when open */
.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-bars span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 0.6rem 1rem 1rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge);
  box-shadow: 0 24px 40px -20px rgba(0, 0, 0, 0.7);
}
.mobile-menu[hidden] { display: none; }
.mobile-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;              /* touch target */
  padding: 0.4rem 0.6rem;
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.mobile-link:hover {
  text-decoration: none;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border-color: var(--edge-soft);
}
.mobile-link .clay-ico { width: 28px; height: 28px; }

/* ---------- 4. Main layout ---------- */
.site-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem 0.9rem 2.5rem;   /* mobile base; widened in the RESPONSIVE LAYER */
}
#app:focus { outline: none; }

.page-enter > * { animation: page-in 0.45s var(--ease-out) both; }
.page-enter > *:nth-child(2) { animation-delay: 0.06s; }
.page-enter > *:nth-child(3) { animation-delay: 0.12s; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* generic entrance for staggered items (uses --i set inline by app.js) */
.reveal {
  animation: reveal-in 0.55s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes reveal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* 3D tilt — --rx/--ry are set by initTilt() in app.js */
.tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
  will-change: transform;
}
.tilt:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px);
}

/* ---------- 5. Dashboard home ---------- */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr);  /* mobile base: single column */
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 2.5rem;
}
/* mobile stacking order: hero -> categories -> featured (per DASH_STRUCTURE.md) */
.dash-main { grid-column: 1 / -1; order: -1; min-width: 0; }
.dash-side { order: 0; min-width: 0; }
.dash-aside { order: 1; min-width: 0; }

.dash-panel {
  background:
    radial-gradient(140% 90% at 20% 0%, rgba(255, 255, 255, 0.06), transparent 55%),
    linear-gradient(165deg, var(--panel-hi), var(--panel) 55%, rgba(0, 0, 0, 0.12));
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-clay);
  padding: 1.25rem;
  position: relative;
}
/* glowing copper edge line along the top */
.dash-panel::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 1px;
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, transparent, rgba(240, 192, 120, 0.5), transparent);
  pointer-events: none;
}

.panel-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc-hi);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--edge-soft);
}

/* panel modifiers (structural hooks kept from DASH_STRUCTURE.md) */
.side-panel { padding: 1.1rem 0.9rem 1.1rem 1.1rem; }
.featured-panel, .why-panel { padding: 1.1rem 1rem; }

/* clay icon hook for the SVG sprite tiles */
.clay-ico {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
  transition: transform var(--t-fast) var(--ease-clay);
}

/* ----- left: categories panel ----- */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 420px;   /* mobile base; taller on desktop — see RESPONSIVE LAYER */
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--acc-lo) transparent;
}
.side-nav::-webkit-scrollbar { width: 8px; }
.side-nav::-webkit-scrollbar-thumb { background: var(--acc-lo); border-radius: 8px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }

.side-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-sm);
  color: var(--text);
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-clay);
}
.side-row:hover {
  text-decoration: none;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border-color: var(--edge-soft);
  transform: translateX(3px);
}
.side-row:hover .clay-ico { transform: scale(1.12) rotate(-4deg); }

.side-name {
  flex: 1 1 auto;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--acc-hi);
  background: rgba(210, 154, 91, 0.14);
  border: 1px solid var(--edge-soft);
  padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

/* ----- center: hero panel ----- */
.hero-panel {
  overflow: hidden;
  text-align: center;
  padding: 1.75rem 1.1rem;   /* mobile base; roomier on larger screens — see RESPONSIVE LAYER */
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(240, 192, 120, 0.10), transparent 60%),
    radial-gradient(140% 90% at 20% 0%, rgba(255, 255, 255, 0.06), transparent 55%),
    linear-gradient(165deg, var(--panel-hi), var(--panel) 55%, rgba(0, 0, 0, 0.12));
}

.hero-orb {
  position: relative;
  width: 140px;    /* mobile base; scales up in the RESPONSIVE LAYER */
  height: 140px;
  margin: 0 auto 1.25rem;
  animation: orb-float 7s ease-in-out infinite;
}
/* puffy copper core sphere — inset in % so it scales with the orb */
.hero-orb::before {
  content: "";
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.6), transparent 44%),
    radial-gradient(circle at 38% 32%, var(--acc-hi), var(--acc) 58%, var(--acc-lo));
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.45),
    inset 0 -8px 16px rgba(0, 0, 0, 0.4),
    0 0 44px rgba(210, 154, 91, 0.45),
    0 18px 36px -12px rgba(0, 0, 0, 0.7);
}
/* ground glow under the orb */
.hero-orb::after {
  content: "";
  position: absolute;
  left: 18%; right: 18%; bottom: 6px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(210, 154, 91, 0.4), transparent);
  filter: blur(4px);
}
@keyframes orb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(240, 192, 120, 0.55);
  box-shadow:
    0 0 18px rgba(210, 154, 91, 0.4),
    inset 0 0 18px rgba(210, 154, 91, 0.22);
}
.orb-ring-1 { animation: orb-spin-a 16s linear infinite; transform: rotateX(72deg); }
.orb-ring-2 {
  inset: 8%;
  border-color: rgba(240, 192, 120, 0.38);
  animation: orb-spin-b 22s linear infinite reverse;
  transform: rotateX(58deg) rotateY(28deg);
}
.orb-ring-3 {
  inset: 16%;
  border-color: rgba(240, 192, 120, 0.28);
  animation: orb-spin-a 30s linear infinite;
  transform: rotateX(80deg) rotateY(-20deg);
}
@keyframes orb-spin-a {
  from { transform: rotateX(72deg) rotateZ(0deg); }
  to { transform: rotateX(72deg) rotateZ(360deg); }
}
@keyframes orb-spin-b {
  from { transform: rotateX(58deg) rotateY(28deg) rotateZ(360deg); }
  to { transform: rotateX(58deg) rotateY(28deg) rotateZ(0deg); }
}

.hero-copy { position: relative; z-index: 1; }

.hero-kicker {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--acc-hi);
  margin: 0 0 0.75rem;
}

.hero-headline {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  background: linear-gradient(180deg, #fffdf7 20%, var(--acc-hi) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text); /* fallback when clip unsupported */
}
[data-theme="light"] .hero-headline {
  background: linear-gradient(180deg, var(--text) 20%, var(--acc) 90%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 34rem;
  margin: 0 auto 1.5rem;
}

.hero-search-wrap {
  position: relative;
  max-width: 34rem;
  margin: 0 auto;
}
.hero-search-ico {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}
#hero-search {
  width: 100%;
  min-height: 56px;   /* mobile base; 60px on larger screens — see RESPONSIVE LAYER */
  padding: 0.9rem 1.4rem 0.9rem 3.8rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-clay), inset 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
#hero-search::placeholder { color: var(--faint); font-weight: 500; }
#hero-search:focus {
  border-color: var(--acc-hi);
  box-shadow: var(--shadow-clay), var(--shadow-glow), inset 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dash-stats {
  display: flex;
  justify-content: center;
  gap: 1.25rem;   /* mobile base; 2.5rem on desktop — see RESPONSIVE LAYER */
  margin: 1.75rem 0 0.75rem;
  flex-wrap: wrap;
}
.dstat { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.dstat-num {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--acc-hi);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(210, 154, 91, 0.35);
}
.dstat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-hint { color: var(--faint); font-size: 0.9rem; margin: 0.75rem 0 0; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.15em 0.5em;
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 700;
  color: var(--acc-hi);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  border-bottom-width: 3px;
  border-radius: 7px;
  box-shadow: var(--shadow-clay-sm);
}

/* ----- right: featured + why panels ----- */
.dash-aside { display: flex; flex-direction: column; gap: 1.25rem; }

.featured-list { display: flex; flex-direction: column; gap: 0.55rem; }

.featured-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 56px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-md);
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  box-shadow: var(--shadow-clay-sm);
  transition: border-color var(--t-fast);
}
.featured-card:hover {
  text-decoration: none;
  border-color: var(--edge);
  box-shadow: var(--shadow-clay-sm), var(--shadow-glow);
}
.feat-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.feat-text { display: flex; flex-direction: column; min-width: 0; }
.feat-name { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feat-cat { font-size: 0.78rem; color: var(--muted); }

.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.why-item { display: flex; gap: 0.8rem; align-items: flex-start; }
.why-item .clay-ico { width: 34px; height: 34px; }
.why-text { display: flex; flex-direction: column; gap: 0.15rem; }
.why-text strong { font-size: 0.95rem; color: var(--text); }
.why-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

/* ---------- 6. Section titles, cards, grids ---------- */
.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.section-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--edge), transparent);
}
.section-sub { color: var(--muted); margin: -0.6rem 0 1.25rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));  /* mobile base */
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.card-grid.categories { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }  /* mobile base */

.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  border-radius: var(--r-lg);
  color: var(--text);
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(165deg, var(--panel-hi), var(--panel) 60%, rgba(0, 0, 0, 0.10));
  border: 1px solid var(--edge-soft);
  box-shadow: var(--shadow-clay-sm);
}
a.card:hover { text-decoration: none; border-color: var(--edge); }

.category-card { align-items: flex-start; text-align: left; }
.card-icon-svg {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.5));
  margin-bottom: 0.35rem;
}
.category-card h3, .tool-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
}
.card-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--acc-hi);
  background: rgba(210, 154, 91, 0.13);
  border: 1px solid var(--edge-soft);
  padding: 0.2rem 0.65rem;
  border-radius: var(--r-pill);
  align-self: flex-start;
}

.tool-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
}
.card-icon { font-size: 2rem; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
.tool-meta { margin-top: 0.4rem; }
.tool-cat {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--acc-hi);
}

/* ---------- 7. Search / category views ---------- */
.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1rem;
}
.breadcrumb a { color: var(--acc-hi); font-weight: 600; }

.search-heading { font-size: 1.5rem; margin-bottom: 0.5rem; }
.search-heading .query { color: var(--acc-hi); }

.search-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  box-shadow: var(--shadow-clay);
  color: var(--muted);
}
.search-empty .big { font-size: 3rem; display: block; margin-bottom: 1rem; }

mark {
  background: rgba(210, 154, 91, 0.32);
  color: inherit;
  border-radius: 4px;
  padding: 0 0.2em;
}

/* ---------- 8. Tool page ---------- */
.tool-head {
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 255, 255, 0.06), transparent 55%),
    linear-gradient(165deg, var(--panel-hi), var(--panel) 60%, rgba(0, 0, 0, 0.10));
  border: 1px solid var(--edge);
  box-shadow: var(--shadow-clay);
  padding: 1.1rem 1.2rem;   /* mobile base; roomier on larger screens — see RESPONSIVE LAYER */
  margin-bottom: 1.25rem;
}
.tool-head h1 {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.7rem;
  margin: 0 0 0.5rem;
}
.tool-icon { font-size: 2.2rem; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5)); }
.tool-head p { color: var(--muted); margin: 0; max-width: 60rem; }

.tool-body {
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, 0.04), transparent 55%),
    linear-gradient(165deg, var(--panel-hi), var(--panel) 60%, rgba(0, 0, 0, 0.08));
  border: 1px solid var(--edge-soft);
  box-shadow: var(--shadow-clay);
  padding: 1.1rem;   /* mobile base; roomier on larger screens — see RESPONSIVE LAYER */
  margin-bottom: 2rem;
  min-height: 240px;
}

/* loading shimmer */
.skeleton-wrap { display: flex; flex-direction: column; gap: 0.9rem; }
.skeleton {
  height: 52px;
  border-radius: var(--r-sm);
  background: linear-gradient(100deg, var(--panel) 30%, var(--panel-hi) 50%, var(--panel) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border: 1px solid var(--edge-soft);
}
.skeleton:nth-child(2) { height: 120px; }
.skeleton:nth-child(4) { width: 62%; }
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.note {
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  background: rgba(210, 154, 91, 0.10);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow-clay-sm);
  color: var(--text);
  margin-bottom: 1rem;
}
.note.error {
  background: rgba(240, 147, 140, 0.10);
  border-color: rgba(240, 147, 140, 0.4);
}

.related-title { margin-top: 0.5rem; }

/* ---------- 9. 404 ---------- */
.not-found {
  text-align: center;
  padding: 4rem 1.5rem;
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  box-shadow: var(--shadow-clay);
  max-width: 42rem;
  margin: 2rem auto;
}
.nf-code {
  display: block;
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 1rem;
  background: linear-gradient(180deg, var(--acc-hi), var(--acc-lo));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--acc);
}
.not-found h1 { font-size: 1.6rem; }
.not-found p { color: var(--muted); }
.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

/* ---------- 10. Forms ---------- */
.field { margin-bottom: 1.1rem; }
.field > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.95rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.08));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-sm);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
[data-theme="light"] .field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
[data-theme="light"] .field select,
[data-theme="light"] .field textarea {
  background: linear-gradient(180deg, #fffdf8, #f7f1e3);
  box-shadow: inset 0 2px 6px rgba(150, 110, 60, 0.12);
}
.field textarea { min-height: 110px; resize: vertical; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.6rem;
  cursor: pointer;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--acc-hi);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25), var(--shadow-glow);
}

/* auto field icons (classes added by enhanceFieldIcons in app.js) */
.field.has-icon { position: relative; }
.field.has-icon > input:not([type="range"]),
.field.has-icon > select,
.field.has-icon > textarea { padding-left: 2.9rem; }
.field.has-icon::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  background: var(--acc);
  -webkit-mask: var(--fi) center / contain no-repeat;
  mask: var(--fi) center / contain no-repeat;
  pointer-events: none;
  z-index: 1;
}
.field.has-icon.icon-textarea::before { top: 1.35rem; transform: none; }
.field.has-icon.icon-range::before { display: none; } /* slider keeps full width */
.field.has-icon.icon-range > input { padding-left: 0.95rem; }

/* icon glyphs (mask data-URIs) */
.field.icon-text, .field.icon-textarea { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 6.5h16M4 11h16M4 15.5h10'/%3E%3C/svg%3E"); }
.field.icon-select { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.6 9.6l5.4 5.4 5.4-5.4'/%3E%3C/svg%3E"); }
.field.icon-search { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M15.7 15.7L20.4 20.4'/%3E%3C/svg%3E"); }
.field.icon-file { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 3.5h7l4 4v13h-11z'/%3E%3Cpath d='M13.5 3.5v4h4'/%3E%3C/svg%3E"); }
.field.icon-color { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.6s5.8 6.3 5.8 10.6a5.8 5.8 0 01-11.6 0C6.2 9.9 12 3.6 12 3.6z'/%3E%3C/svg%3E"); }
.field.icon-date { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='4' y='5.5' width='16' height='15' rx='2'/%3E%3Cpath d='M4 10h16M8.5 3.5v4M15.5 3.5v4'/%3E%3C/svg%3E"); }
.field.icon-time { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.2'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E"); }
.field.icon-email { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5.5' width='17' height='13' rx='2'/%3E%3Cpath d='M4.5 7.5l7.5 5.2 7.5-5.2'/%3E%3C/svg%3E"); }
.field.icon-url { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M10 14a4.2 4.2 0 006 0l2.8-2.8a4.24 4.24 0 00-6-6L11.2 6.8'/%3E%3Cpath d='M14 10a4.2 4.2 0 00-6 0l-2.8 2.8a4.24 4.24 0 006 6l1.6-1.6'/%3E%3C/svg%3E"); }
.field.icon-phone { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 3.8h3.6l1.9 4.8-2.4 1.4a12.5 12.5 0 005.4 5.4l1.4-2.4 4.8 1.9v3.6a1.9 1.9 0 01-1.9 1.9A16.6 16.6 0 013.6 5.7a1.9 1.9 0 011.9-1.9z'/%3E%3C/svg%3E"); }
.field.icon-number { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M9 4L7 20M17 4l-2 16M4 9h17M3 15h17'/%3E%3C/svg%3E"); }
.field.icon-password { --fi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='5.6' y='10.6' width='12.9' height='9.4' rx='2'/%3E%3Cpath d='M8.6 10.6V8a3.5 3.5 0 017 0v2.6M12 14v2.3'/%3E%3C/svg%3E"); }

/* range slider — copper clay thumb */
.field input[type="range"] {
  width: 100%;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.18));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--edge-soft);
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px; height: 30px;
  margin-top: -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--acc-hi), var(--acc) 60%, var(--acc-lo));
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.5), inset 0 -3px 6px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.field input[type="range"]::-moz-range-track {
  height: 12px; border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.18));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}
.field input[type="range"]::-moz-range-thumb {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--acc-hi), var(--acc) 60%, var(--acc-lo));
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.5), 0 4px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

/* file input — clay dropzone button */
.field input[type="file"] {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.5rem;
}
.field input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 700;
  color: var(--acc-ink);
  background: linear-gradient(180deg, var(--acc-hi), var(--acc) 60%, var(--acc-lo));
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--r-sm);
  padding: 0.55rem 1.1rem;
  margin-right: 0.9rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
  transition: transform var(--t-fast) var(--ease-clay);
}
.field input[type="file"]::file-selector-button:hover { transform: translateY(-1px); }
.field.has-icon.icon-file > input[type="file"] { padding-left: 0.5rem; }
.field.has-icon.icon-file::before { display: none; }

/* color input — clay swatch */
.field input[type="color"] {
  width: 64px;
  height: 44px;
  padding: 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--edge-soft);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  box-shadow: var(--shadow-clay-sm);
  cursor: pointer;
}
.field.has-icon.icon-color::before { display: none; }
.field.has-icon.icon-color > input { padding-left: 6px; }

/* checkboxes / radios */
.field input[type="checkbox"], .field input[type="radio"] {
  width: 22px; height: 22px;
  accent-color: var(--acc);
  cursor: pointer;
  vertical-align: -5px;
  margin-right: 0.5rem;
}

/* ---------- 11. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.7rem 1.4rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-clay-sm);
  cursor: pointer;
  user-select: none;
  transition: transform var(--t-fast) var(--ease-clay), box-shadow var(--t-fast), border-color var(--t-fast);
}
.btn:hover { text-decoration: none; color: var(--acc-hi); transform: translateY(-2px); border-color: var(--edge); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.4); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  color: var(--acc-ink);
  background:
    radial-gradient(120% 90% at 30% 10%, rgba(255, 255, 255, 0.45), transparent 50%),
    linear-gradient(180deg, var(--acc-hi), var(--acc) 55%, var(--acc-lo));
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.5),
    inset 0 -3px 7px rgba(0, 0, 0, 0.3),
    0 12px 26px -10px rgba(0, 0, 0, 0.7),
    0 0 18px rgba(210, 154, 91, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { color: var(--acc-ink); filter: brightness(1.06); }
.btn-primary:active { filter: brightness(0.96); }

.btn-small { min-height: 44px; padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: var(--r-sm); }  /* 44px touch target */

/* auto button icons (classes added by enhanceFieldIcons in app.js) */
.btn[class*="icon-"]::before {
  content: "";
  width: 18px; height: 18px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--bi) center / contain no-repeat;
  mask: var(--bi) center / contain no-repeat;
}
.btn.icon-copy { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5.5 15V6a2 2 0 012-2h9'/%3E%3C/svg%3E"); }
.btn.icon-download { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5v12M7.2 11.2L12 16l4.8-4.8M4.2 20.2h15.6'/%3E%3C/svg%3E"); }
.btn.icon-reset { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 11-2.4-5.7'/%3E%3Cpath d='M20 3.5V8h-4.5'/%3E%3C/svg%3E"); }
.btn.icon-calc { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='6.5' y='3.5' width='11' height='17' rx='2'/%3E%3Cpath d='M9.5 7.5h5M9.3 11.5h.9M11.6 11.5h.9M13.9 11.5h.9M9.3 14.8h.9M11.6 14.8h.9M13.9 14.8h.9'/%3E%3C/svg%3E"); }
.btn.icon-search { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M15.7 15.7L20.4 20.4'/%3E%3C/svg%3E"); }
.btn.icon-sparkle { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4.2c.7 4.3 2.2 5.9 6.5 6.6-4.3.7-5.8 2.3-6.5 6.6-.7-4.3-2.2-5.9-6.5-6.6 4.3-.7 5.8-2.3 6.5-6.6z'/%3E%3C/svg%3E"); }
.btn.icon-upload { --bi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15.5v-12M7.2 8.3L12 3.5l4.8 4.8M4.2 20.2h15.6'/%3E%3C/svg%3E"); }

/* ---------- 12. Tool output components ---------- */
/* mobile-first: single column; 2 cols at >=640px, 3 cols at >=1024px — see RESPONSIVE LAYER */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.mt { margin-top: 1.25rem; }

.result {
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
  background: rgba(143, 214, 148, 0.08);
  border: 1px solid rgba(143, 214, 148, 0.35);
  box-shadow: var(--shadow-clay-sm);
  margin-top: 1.25rem;
  overflow-wrap: break-word;
}
.result-box {
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.12));
  border: 1px solid var(--edge-soft);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
  margin-top: 1.25rem;
  overflow-x: auto;
  overflow-wrap: break-word;
}
[data-theme="light"] .result-box {
  background: linear-gradient(180deg, #fffdf8, #f6f0e1);
  box-shadow: inset 0 2px 8px rgba(150, 110, 60, 0.12);
}
.result-box pre, .result pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; margin-top: 1rem; }
.table th, .table td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--edge-soft);
}
.table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--acc-hi);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: rgba(210, 154, 91, 0.07); }

.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ---------- 13. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--edge-soft);
  background:
    radial-gradient(100% 120% at 50% 0%, rgba(210, 154, 91, 0.06), transparent 55%),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25));
  margin-top: 2rem;
}
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 2.5rem 1.25rem 1.5rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;   /* mobile base; 2 cols at >=640px, 4 at >=1024px — see RESPONSIVE LAYER */
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.footer-col h3 {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc-hi);
  margin: 0 0 0.9rem;
}
.footer-col p { color: var(--muted); font-size: 0.9rem; margin: 0.75rem 0 0; }
.footer-brand .logo { margin-bottom: 0.25rem; }
.footer-links { display: flex; flex-direction: column; gap: 0.45rem; }
.footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
  width: fit-content;
  min-height: 44px;             /* touch target */
  display: inline-flex;
  align-items: center;
}
.footer-links a:hover { color: var(--acc-hi); }
.privacy-badge {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--acc-hi);
  background: rgba(210, 154, 91, 0.12);
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  padding: 0.4rem 0.9rem;
}
.footer-bottom {
  border-top: 1px solid var(--edge-soft);
  padding-top: 1.25rem;
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
}

/* ============================================================
   14. ADS LAYER — future ad integration (zero external requests)
   ------------------------------------------------------------
   Named slots: header-banner, sidebar, in-feed, tool-top, footer-banner.
   Markup contract (rendered by app.js / index.html shell):
     <div class="ad-slot" data-ad-slot="<name>" hidden></div>

   STATES (driven by ADS_CONFIG in app.js):
   • default  (enabled:false, preview:false) — slot keeps `hidden`:
     display:none, ZERO space, ZERO layout shift, ZERO requests.
   • enabled  (enabled:true + slot `code` set) — `.ad-live`: the pasted
     network code renders fluidly, centered, capped per breakpoint.
   • preview  (preview:true) — `.ad-preview`: a dashed labeled box for
     layout QA. Pure CSS text — NEVER fires external requests.

   No external URLs, no fetch/XHR anywhere in this layer.
   ============================================================ */

/* base: fluid, centered; the [hidden] kill-switch guarantees zero space */
.ad-slot {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
.ad-slot[hidden] { display: none !important; }   /* zero space while disabled */
/* visible slots get vertical rhythm with surrounding content */
.ad-slot:not([hidden]) { margin-top: 1rem; margin-bottom: 1.5rem; }

/* ---- live ads: fluid widths, max-width caps per breakpoint ----
   (mirrors the size hints documented in ADS_CONFIG) */
.ad-slot.ad-live { text-align: center; }
.ad-slot.ad-live ins,
.ad-slot.ad-live iframe,
.ad-slot.ad-live img,
.ad-slot.ad-live > * { max-width: 100%; }
/* banner slots: 100% on phones ... */
.ad-slot[data-ad-slot="header-banner"],
.ad-slot[data-ad-slot="footer-banner"],
.ad-slot[data-ad-slot="in-feed"],
.ad-slot[data-ad-slot="tool-top"] { max-width: 100%; }
/* ... 728px leaderboard cap on tablets ... */
@media (min-width: 640px) {
  .ad-slot[data-ad-slot="header-banner"],
  .ad-slot[data-ad-slot="footer-banner"],
  .ad-slot[data-ad-slot="in-feed"],
  .ad-slot[data-ad-slot="tool-top"] { max-width: 728px; }
}
/* ... 970px billboard cap on desktop */
@media (min-width: 1024px) {
  .ad-slot[data-ad-slot="header-banner"],
  .ad-slot[data-ad-slot="footer-banner"] { max-width: 970px; }
}
/* sidebar slot: skyscraper column — fixed 300px cap at every breakpoint */
.ad-slot[data-ad-slot="sidebar"] { max-width: 300px; }

/* ---- preview mode: dashed labeled boxes, CSS-only ---- */
.ad-slot.ad-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 1rem;
  border: 2px dashed var(--acc);
  border-radius: var(--r-md);
  background: rgba(210, 154, 91, 0.07);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}
.ad-slot.ad-preview::before { content: "Ad slot: " attr(data-ad-slot); }

/* ---- sidebar layout for category + tool pages ----
   app.js wraps those pages in .with-ad-side > .main-col + .ad-side-col.
   While ads are disabled, applyAdSlots() adds .no-ads and hides the
   column, so the page renders exactly as if ads never existed. */
.with-ad-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.with-ad-side > .main-col { min-width: 0; }
.with-ad-side.no-ads { display: block; }          /* disabled: plain single column */
.ad-side-col { min-width: 0; }
.ad-side-col[hidden] { display: none; }
.ad-side-col .ad-slot:not([hidden]) { margin: 0 auto; }  /* no extra rhythm inside the column */
@media (min-width: 1024px) {
  /* enabled: content + 300px ad column on desktop; stacked on smaller screens */
  .with-ad-side:not(.no-ads) { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* ---------- 15. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-orb, .orb-ring-1, .orb-ring-2, .orb-ring-3 { animation: none; }
  .reveal, .page-enter > * { animation: none; opacity: 1; transform: none; }
  .tilt, .tilt:hover { transform: none; }
  .skeleton { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   16. RESPONSIVE LAYER — mobile-first, min-width breakpoints
   ------------------------------------------------------------
   Base styles above are the phone layout (<640px). Enhancements:
     >=640px   large phones / small tablets
     >=1024px  desktop
     >=1440px  large displays
   Everything here is layout-only (no animation changes), so the
   prefers-reduced-motion block above keeps working untouched.
   The 3D clay aesthetic, dark default + light theme, and every
   contract selector are preserved at all sizes — this layer only
   reflows, resizes, and reorders them.
   ============================================================ */

/* ---- always-on responsive helpers (no breakpoint) ---- */
/* Horizontal scroll region for wide tables (app.js wraps .table via
   enhanceTables). Keeps tables usable on phones without letting the
   page itself scroll sideways. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-scroll > .table {
  width: max-content;   /* let wide tables keep their natural width -> scrolls */
  min-width: 100%;      /* narrow tables still fill the container */
  margin-top: 0;
}

/* ---- >=640px: large phones / small tablets ---- */
@media (min-width: 640px) {
  /* hamburger + drawer are a phone-only pattern */
  .menu-toggle { display: none !important; }
  .mobile-menu { display: none !important; }

  /* header: logo stays centered, search spans full width beneath it */
  .header-search { grid-column: 1 / -1; grid-row: 2; max-width: none; margin-left: 0; }
  #theme-toggle { margin-left: 0.25rem; }

  .site-main { padding: 1.5rem 1.25rem 3rem; }

  /* dashboard: hero full-width on top, categories + featured side by side */
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-main { grid-column: 1 / -1; order: -1; }
  .dash-side { order: 0; }
  .dash-aside { order: 1; }
  .side-nav { max-height: 480px; }

  .hero-panel { padding: 2.25rem 1.5rem 2rem; }
  .hero-orb { width: 180px; height: 180px; }
  #hero-search { min-height: 60px; font-size: 1.05rem; }
  .dash-stats { gap: 2rem; }

  /* tool output grids: 2 columns from here up */
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .card-grid.categories { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

  .tool-body { padding: 1.5rem; }
  .tool-head { padding: 1.35rem 1.5rem; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

/* ---- >=1024px: desktop ---- */
@media (min-width: 1024px) {
  /* dashboard: full 3-column layout, DOM order restored (side | hero | featured) */
  .dash { grid-template-columns: 264px minmax(0, 1fr) 304px; }
  .dash-main { grid-column: auto; order: 0; }
  .dash-side { order: 0; }
  .dash-aside { order: 0; }
  .side-nav { max-height: 592px; }

  .hero-panel { padding: 2.5rem 2rem 2.25rem; }
  .hero-orb { width: 210px; height: 210px; }
  .dash-stats { gap: 2.5rem; }

  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .card-grid.categories { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

  .tool-body { padding: 1.75rem; }
  .tool-head { padding: 1.5rem 1.75rem; }

  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
}

/* ---- >=1440px: large displays ---- */
@media (min-width: 1440px) {
  .site-main, .header-inner, .footer-inner { max-width: 1600px; }
  .dash { grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 1.5rem; }
  .hero-orb { width: 230px; height: 230px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}

/* ============================================================
   17. FAQ SECTION (AEO/GEO) — dark glass panels, copper accents
   ============================================================ */
.faq { margin: 2.5rem 0 1rem; }
.faq-heading {
  font-size: 1.35rem;
  margin: 0 0 1rem;
  letter-spacing: 0.01em;
}
.faq-item {
  background: linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
}
.faq-question {
  font-size: 1.02rem;
  margin: 0 0 0.4rem;
  color: #f4c98f;
}
.faq-answer { margin: 0; color: var(--text-dim, #b8bcc7); line-height: 1.6; }
@media (min-width: 640px) {
  .faq-item { padding: 1.15rem 1.5rem; }
}

/* how-to steps (tool pages: SPA view + prerendered static pages) */
.howto { margin: 0 0 1.5rem; }
.howto-steps { margin: 0.5rem 0 0 1.25rem; padding: 0; display: grid; gap: 0.45rem; }
.howto-steps li { line-height: 1.6; color: var(--text-dim, #b8bcc7); }
.howto-steps li::marker { color: #f4c98f; font-weight: 700; }
