/* Mobilia Tools — single stylesheet for every page.
   Identity: a workshop wall of small, precise tools. Faint graph-paper ground
   (the site's subject is measurement), real Play icons as the visual material,
   indigo accent lifted from the Mobilia logo, monospace for numbers.
   Design tokens up top; change them here and the whole site follows. */

:root {
  --paper: #f6f7f5;
  --grid-line: rgba(28, 34, 48, 0.05);
  --surface: #ffffff;
  --ink: #1c2434;
  --ink-2: #5a6472;
  --accent: #5b54d9;
  --accent-deep: #443db8;
  --accent-wash: #eeedfb;
  --line: #e3e6ec;
  --success: #187a52;
  --error: #c53929;
  --radius: 14px;
  --radius-sm: 9px;
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 20px;
  --space-4: 34px;
  --space-5: 56px;
  --shadow: 0 1px 2px rgba(20, 24, 33, 0.05), 0 6px 20px rgba(20, 24, 33, 0.06);
  --shadow-lift: 0 2px 4px rgba(20, 24, 33, 0.06), 0 10px 28px rgba(20, 24, 33, 0.1);
  --max-width: 780px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121419;
    --grid-line: rgba(232, 234, 240, 0.035);
    --surface: #1b1e26;
    --ink: #e8eaf0;
    --ink-2: #98a1b1;
    --accent: #8f89f2;
    --accent-deep: #aca7f6;
    --accent-wash: #23243a;
    --line: #2b3040;
    --success: #6fcfa4;
    --error: #f28b82;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 4px 22px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  /* the graph-paper ground */
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-3); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: var(--space-3) 0 var(--space-2);
}
h2 { font-size: 1.18rem; letter-spacing: -0.01em; margin: var(--space-4) 0 var(--space-2); }

.intro { color: var(--ink-2); margin: 0 0 var(--space-3); max-width: 58ch; }
.lead { font-size: 1.08rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-1);
}

.section-title { margin-top: var(--space-5); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-2);
}
.section-head .section-title { margin-bottom: var(--space-2); }
.section-more {
  font-family: var(--font-mono);
  font-size: 0.8rem; font-weight: 600;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 20;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; top: 0; }

/* ------------------------------------------------------------- header/footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface); /* fallback for browsers without color-mix */
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 58px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em;
  color: var(--ink);
}
.logo img { border-radius: 7px; }
.logo:hover { text-decoration: none; color: var(--accent); }
.site-nav { display: flex; gap: var(--space-3); }
.site-nav a { color: var(--ink-2); font-size: 0.93rem; font-weight: 500; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

.site-footer {
  margin-top: var(--space-5);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.88rem;
  text-align: center;
}
.site-footer .footnote { opacity: 0.75; margin-top: var(--space-1); }

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.78rem; color: var(--ink-2);
  margin-top: var(--space-3);
}
.breadcrumb a { color: var(--ink-2); }
.breadcrumb a:hover { color: var(--accent); }

/* --------------------------------------------------------------------- hero */

.hero { padding: var(--space-4) 0 var(--space-2); }
.hero h1 { font-size: clamp(2rem, 6vw, 2.8rem); margin-top: 4px; }

.icon-wall {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: var(--space-3) 0 var(--space-2);
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 160ms ease, transform 160ms ease;
}
.icon-wall:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); text-decoration: none; }
.icon-wall .appicon { width: 44px; height: 44px; }
.icon-wall-more {
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 600;
  color: var(--ink-2);
  padding: 0 10px;
  white-space: nowrap;
}

/* app icons everywhere */
.appicon {
  border-radius: 22%;
  flex-shrink: 0;
  background: var(--paper);
}
.appicon-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  border: 1px solid var(--line);
}

.app-hero {
  display: flex; align-items: center; gap: var(--space-3);
  margin-top: var(--space-2);
}
.app-hero .appicon { width: 72px; height: 72px; box-shadow: var(--shadow); }
.app-hero h1 { margin: 0 0 2px; }
.app-hero .eyebrow { margin: 0; }

/* --------------------------------------------------------------- calculator */

.calc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-3);
  margin: var(--space-3) 0;
}

.field { margin-bottom: var(--space-2); }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field input[type="number"], .field input[inputmode] { font-family: var(--font-mono); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field-row { display: flex; gap: var(--space-2); }
.field-row .field { flex: 1; min-width: 0; }

.result {
  display: none;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--accent-wash);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 1.02rem;
  overflow-wrap: break-word;
}
.result.visible { display: block; animation: result-in 180ms ease-out; }
@keyframes result-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.result .big {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem; font-weight: 700;
  letter-spacing: -0.01em;
}
.result .ok { color: var(--success); font-weight: 700; }
.result .bad { color: var(--error); font-weight: 700; }
.result table { width: 100%; border-collapse: collapse; margin-top: var(--space-1); }
.result td { padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.result td:last-child {
  text-align: right; font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.result tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------------------ content */

.content-section { margin-top: var(--space-4); }
.content-section code {
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.88em;
}
.content-section table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.92rem;
}
.content-section th {
  font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
}
.content-section th, .content-section td {
  text-align: left; padding: 9px 13px;
  border-bottom: 1px solid var(--line);
}
.content-section tr:last-child td { border-bottom: none; }
.content-section td { font-variant-numeric: tabular-nums; }

.policy h1 { font-size: 1.5rem; }
.policy h2 { font-size: 1.05rem; }

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: background 120ms ease, transform 120ms ease;
}
.btn-primary:hover { background: var(--accent-deep); text-decoration: none; transform: translateY(-1px); }

/* ---------------------------------------------------------------------- CTA */

.cta-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-3);
  margin-top: var(--space-4);
}
.cta-card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.cta-card p { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.cta-lead { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.cta-lead .appicon { width: 48px; height: 48px; }

.play-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: #000; color: #fff;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: transform 120ms ease, opacity 120ms ease;
}
.play-badge:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.play-badge small { display: block; font-size: 0.62rem; letter-spacing: 0.06em; opacity: 0.85; }
.play-badge span { line-height: 1.15; font-weight: 600; }

/* ---------------------------------------------------------------- ad slots */

.ad-slot {
  margin: var(--space-4) 0;
  min-height: 90px;
  text-align: center;
}

/* ----------------------------------------------------------------- FAQ/grid */

.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}
.faq details[open] { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: var(--space-2) 0 var(--space-1); color: var(--ink-2); }

.tool-grid {
  list-style: none; padding: 0; margin: var(--space-2) 0 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2);
}
.hub-grid { margin-top: var(--space-3); }
.tool-card {
  display: flex; gap: var(--space-2); align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  height: 100%;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.tool-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card strong { display: block; font-size: 0.97rem; letter-spacing: -0.01em; }
.tool-card small { color: var(--ink-2); font-size: 0.82rem; line-height: 1.45; display: block; margin-top: 2px; }
.tool-card .appicon { width: 40px; height: 40px; }

/* --------------------------------------------------------- chips/stats/misc */

.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: var(--space-3) 0 0;
}
.chip {
  font-family: var(--font-mono);
  font-size: 0.78rem; font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  transition: border-color 120ms ease, color 120ms ease;
}
.chip:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.content-section[id] { scroll-margin-top: 76px; }

.stat-row {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin: var(--space-3) 0 0; padding: 0;
}
.stat-row > div {
  flex: 1; min-width: 130px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}
.stat-row dt {
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2);
}
.stat-row dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem; font-weight: 700;
  color: var(--accent);
}

.legal-links {
  margin-top: var(--space-3);
  font-size: 0.88rem;
  color: var(--ink-2);
}

.router-grid { margin-top: var(--space-4); }

.faq summary::marker { color: var(--accent); }

@media (max-width: 600px) {
  .tool-grid { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .icon-wall .appicon { width: 36px; height: 36px; }
  .app-hero .appicon { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
