/* TinyTools — main.css
   Design tokens, base styles, layout, header, hero, footer.
   Mobile-first. Breakpoint overrides live in responsive.css. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Brand palette (dark theme is the default) */
  --bg: #080b14;
  --bg-2: #101626;
  --card: #121b2d;
  --accent: #63e6ff;
  --accent-2: #9b8cff;
  --text: #f1f5ff;
  --text-2: #9aa9c2;
  --border: #25334a;
  --success: #4adea3;
  --error: #ff6b81;

  /* Derived tokens */
  --accent-ink: #04222b;        /* text on accent fills */
  --accent-text: #63e6ff;       /* accent used as text/link colour */
  --accent-soft: rgba(99, 230, 255, 0.1);
  --accent-line: rgba(99, 230, 255, 0.5);
  --violet-soft: rgba(155, 140, 255, 0.14);
  --border-strong: #5a6f91;     /* form-control borders (>= 3:1 on inputs) */
  --input-bg: #0c1322;
  --glass: rgba(16, 22, 38, 0.78);
  --glass-solid: #101626;
  --grid-line: rgba(120, 150, 200, 0.07);
  --glow-a: rgba(99, 230, 255, 0.1);
  --glow-b: rgba(155, 140, 255, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --error-soft: rgba(255, 107, 129, 0.12);
  --success-soft: rgba(74, 222, 163, 0.12);

  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 60px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fc;
  --bg-2: #e9eef7;
  --card: #ffffff;
  --accent: #0b7f9c;
  --accent-2: #6551e0;
  --text: #0d1530;
  --text-2: #475776;
  --border: #cfd9e8;
  --success: #0c7a53;
  --error: #c3243f;
  --accent-ink: #ffffff;
  --accent-text: #0a6f89;
  --accent-soft: rgba(11, 127, 156, 0.1);
  --accent-line: rgba(11, 127, 156, 0.55);
  --violet-soft: rgba(101, 81, 224, 0.1);
  --border-strong: #8091ad;
  --input-bg: #ffffff;
  --glass: rgba(255, 255, 255, 0.82);
  --glass-solid: #ffffff;
  --grid-line: rgba(30, 60, 110, 0.06);
  --glow-a: rgba(11, 127, 156, 0.1);
  --glow-b: rgba(101, 81, 224, 0.09);
  --shadow: 0 10px 28px rgba(30, 50, 90, 0.12);
  --error-soft: rgba(195, 36, 63, 0.08);
  --success-soft: rgba(12, 122, 83, 0.09);
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Ambient lighting + very subtle grid (static, no animation) */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(620px 420px at 10% -6%, var(--glow-a), transparent 70%),
    radial-gradient(720px 480px at 94% -4%, var(--glow-b), transparent 70%);
}
body::after {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}
main { flex: 1 0 auto; display: block; }
main:focus { outline: none; }

img, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: clamp(1.9rem, 6.5vw, 3.1rem); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.35rem, 4.2vw, 1.85rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
code, kbd { font-family: var(--mono); font-size: 0.9em; background: var(--accent-soft); padding: 0.1em 0.4em; border-radius: 6px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--text); }
[hidden] { display: none !important; }
.no-js .js-only { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  text-decoration: none;
}
.skip-link:focus { transform: none; outline-offset: 2px; }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-fill { fill: currentColor; stroke: currentColor; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.section { padding-block: 40px; }
.section-head { margin-bottom: 20px; }
.section-head p { color: var(--text-2); margin: 0; max-width: 60ch; }
.eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 10px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-solid);
  border-bottom: 1px solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { background: var(--glass); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
}
.header-inner { display: flex; align-items: center; gap: 8px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; min-height: 44px; margin-right: auto; }
.brand img { width: 28px; height: 28px; display: block; }
.brand:hover { text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 6px; }

.nav { display: none; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 550; border: 1px solid transparent; }
.nav-link:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.nav-link[aria-current] { color: var(--text); background: var(--accent-soft); border-color: var(--accent-line); }
.nav-link[aria-current]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 10px; flex: none; }

/* Mobile menu panel (JS enabled). Without JS the nav simply shows inline. */
.js .nav.is-open {
  display: block;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  padding: 10px 16px 16px;
  background: var(--glass-solid);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.no-js .nav { display: block; width: 100%; order: 5; padding-bottom: 8px; }
.no-js .nav-list { flex-direction: row; flex-wrap: wrap; }
.no-js .header-inner { flex-wrap: wrap; }
.no-js .menu-toggle, .no-js .search-open, .no-js .theme-toggle { display: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--accent-soft); border-color: var(--border); }
.icon-btn .icon { width: 22px; height: 22px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: inline-block; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-menu { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: inline-block; }

/* ---------- Hero ---------- */
.hero { padding-block: 44px 28px; text-align: center; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent-text), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  display: inline;
}
.hero-lead { color: var(--text-2); font-size: clamp(1rem, 3.2vw, 1.2rem); max-width: 40rem; margin: 14px auto 26px; }

.search-field { position: relative; max-width: 620px; margin-inline: auto; }
.search-field .icon-lead { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--text-2); pointer-events: none; }
.search-input {
  width: 100%;
  height: 58px;
  padding: 0 52px 0 50px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 0 0 0 transparent;
  transition: border-color 0.15s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
}
.search-input::placeholder { color: var(--text-2); opacity: 1; }
.search-input::-webkit-search-cancel-button, .search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-input:hover { border-color: var(--accent-line); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 24px -6px var(--accent-line); }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.trust-list { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 22px 0 0; padding: 0; }
.trust-list li { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--glass); color: var(--text-2); font-size: 0.9rem; }
.trust-list .icon { color: var(--accent-text); width: 1.1em; height: 1.1em; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 48px; border-top: 1px solid var(--border); background: var(--glass-solid); }
.footer-inner { padding-block: 32px; display: grid; gap: 24px; }
.footer-brand p { color: var(--text-2); margin: 8px 0 0; max-width: 34ch; font-size: 0.95rem; }
.footer-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 18px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); text-decoration: none; }
.footer-nav a:hover { color: var(--text); text-decoration: underline; }
.footer-nav a[aria-current] { color: var(--text); font-weight: 600; }
.footer-meta { color: var(--text-2); font-size: 0.85rem; margin: 0; }

/* ---------- Prose pages (About / Privacy / Terms) ---------- */
.prose-page { padding-block: 36px 24px; }
.prose { max-width: 70ch; }
.prose h1 { margin-bottom: 0.4em; }
.prose h2 { margin-top: 1.9em; font-size: 1.35rem; }
.prose .lead { color: var(--text-2); font-size: 1.1rem; }
.prose li { margin-bottom: 0.4em; }
.prose .meta { color: var(--text-2); font-size: 0.9rem; }
.callout { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; margin: 1.2em 0; }
.callout p:last-child { margin-bottom: 0; }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding-block: 72px; }
.not-found .code { font-family: var(--mono); font-size: clamp(3.5rem, 18vw, 7rem); font-weight: 700; line-height: 1; color: var(--accent-text); margin: 0 0 12px; }

/* ---------- Motion (opt-in) ---------- */
@keyframes tt-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  /* The h1 is never animated so the main heading paints immediately (fast LCP). */
  .hero > .container > *:not(h1) { animation: tt-rise 0.5s var(--ease) both; }
  .hero > .container > *:nth-child(3) { animation-delay: 0.05s; }
  .hero > .container > *:nth-child(4) { animation-delay: 0.1s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
