/* =========================================================================
 * Unit Converter — styles. Follows the HEIC tool template (site design:
 * amber #f5a623, ink #0f1420, 1200px container) with teal #0d9488 accent.
 * All motion disabled under prefers-reduced-motion.
 * ========================================================================= */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --ink: #0f1420;
  --ink-soft: #4b5573;
  --ink-faint: #8a93ad;
  --line: #e2e7f2;
  --accent: #0d9488;
  --accent-dark: #0b7c73;
  --accent-soft: #f0fdfa;
  --accent-line: #99f6e4;
  --amber: #f5a623;
  --ok: #0f9d58;
  --ok-soft: #e5f6ec;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 20, 32, 0.08);
  --shadow-lg: 0 18px 50px rgba(13, 148, 136, 0.16);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  text-decoration: none; font-weight: 700; transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--amber));
  box-shadow: var(--shadow);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 10px; transition: background 0.18s, color 0.18s;
}
.nav a:hover, .nav a:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }

/* ---------------- hero ----------------
   Compact by design: one line of headline + one line of promise, so the
   converter itself is on the first screen. */
.hero {
  padding: 26px 0 10px;
  background:
    radial-gradient(600px 300px at 15% 0%, rgba(13, 148, 136, 0.10), transparent 60%),
    radial-gradient(700px 320px at 90% 10%, rgba(245, 166, 35, 0.10), transparent 60%);
}
.hero h1 {
  font-size: clamp(1.65rem, 3.4vw, 2.25rem);
  line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 6px; max-width: none;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 1rem; color: var(--ink-soft); max-width: none; margin: 0 0 12px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.trust-row li {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(15, 20, 32, 0.05);
}
.trust-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------------- tool ---------------- */
.tool-section { padding: 8px 0 32px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
  margin: 18px 0;
  min-width: 0;
  animation: card-in .45s ease both;
}
.card:nth-of-type(2) { animation-delay: .05s; }
.card:nth-of-type(3) { animation-delay: .1s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 { margin: 0 0 6px; font-size: 1.25rem; line-height: 1.3; }
h3 { margin: 18px 0 4px; font-size: 1.05rem; }
p { margin: 8px 0; }
.hint { color: var(--ink-soft); font-size: .9rem; }

.field label { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
select, input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .22);
}
select { margin-bottom: 10px; }
input[type="text"] { font-size: 1.25rem; font-weight: 600; }

/* Category tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.tab {
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.tab:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.tab:focus-visible { outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px; }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(13, 148, 136, .35);
}

/* Converter row — flexible tracks, nothing wider than the card */
.convert-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}
.convert-row .field { min-width: 0; }

.btn {
  font: inherit;
  font-weight: 650;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { padding: 7px 12px; font-size: .9rem; }

#swap-btn { margin-bottom: 10px; font-size: 1.1rem; padding: 11px 14px; }

.pair-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }

/* Result */
.result { margin-top: 18px; padding: 16px 18px; background: var(--accent-soft); border: 1.5px solid var(--accent-line); border-radius: 12px; }
.result-line { margin: 0; font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.result-sub { margin: 8px 0 0; font-size: .95rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  font-size: .85rem;
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 6px;
}

/* Value flash when the other box updates */
@keyframes pulse-in {
  0% { background: #ccfbf1; }
  100% { background: #fff; }
}
.pulse { animation: pulse-in .5s ease; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; font-size: .95rem; margin: 14px 0 0; }
.alert-error { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca; }

/* Quick chips */
.chips-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.chips-label { font-weight: 650; font-size: .95rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-weight: 650;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chip:focus-visible { outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px; }
.chip:active { transform: scale(.96); }

/* Share */
.share-row { margin-top: 18px; }
.share-row > label { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
.share-controls { display: flex; gap: 10px; min-width: 0; }
.share-controls input { flex: 1; min-width: 0; font-size: .95rem; font-weight: 400; }
.share-controls .btn { flex-shrink: 0; }

/* Common conversions table */
.table-wrap { overflow-x: auto; }
.common-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.common-table th, .common-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.common-table th { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.common-table td { font-size: 1.05rem; }
.common-table td:last-child { font-weight: 700; color: var(--accent); }
.common-row { cursor: pointer; transition: background .12s ease; }
.common-row:hover, .common-row:focus-visible { background: var(--accent-soft); outline: none; }
.common-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

/* privacy */
.privacy { padding: 8px 0 44px; }
.privacy-card {
  background: linear-gradient(135deg, #0f1420, #0f766e);
  color: #e6f4f2; border-radius: 22px; padding: clamp(22px, 3vw, 36px);
  box-shadow: var(--shadow-lg);
}
.privacy-card h2 { color: #fff; margin: 0 0 10px; font-size: 1.4rem; }
.privacy-card p { margin: 0 0 16px; }
.net-meter {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 9px 16px; font-weight: 700; color: #fff;
}
.net-meter b { font-size: 1.15rem; }
.net-meter .pulse { width: 10px; height: 10px; border-radius: 50%; background: #34d399; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
}
.verify-steps { margin: 16px 0 0; padding-left: 20px; }
.verify-steps li { margin: 6px 0; }
kbd {
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px; padding: 1px 7px; font: inherit; font-size: 0.85em;
}
.content kbd {
  background: var(--surface-2); border-color: var(--line); color: var(--ink);
}

/* content */
.content { padding: 20px 0 44px; }
.content h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin: 0 0 12px; }
.content h3 { font-size: 1.08rem; margin: 26px 0 8px; color: var(--accent); }
.content p, .content li { color: var(--ink-soft); }
.content ol, .content ul { padding-left: 22px; }
.content li { margin: 6px 0; }
.content a { color: #8a5c06; }

.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin: 10px 0;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq summary:focus-visible { outline: 3px solid rgba(13, 148, 136, 0.35); outline-offset: 2px; border-radius: 6px; }
.faq details p { margin: 10px 0 2px; }

/* footer — one small, quiet line */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 26px; color: var(--ink-faint); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; }
.site-footer p { margin: 0; }
.site-footer .footer-note { color: var(--ink-faint); }
.site-footer a { color: #8a5c06; }

/* responsive */
@media (max-width: 640px) {
  .nav { display: none; }
  .hero { padding: 20px 0 8px; }
  .convert-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #swap-btn { width: 100%; margin: 4px 0 10px; }
  .share-controls { flex-direction: column; }
  .share-controls .btn { width: 100%; }
  .card { padding: 18px; }
  .site-footer .wrap { flex-direction: column; gap: 2px; }
}

/* Reduced motion: kill every animation and transition. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
