/* ===========================
   Professional Calculator UI
   Drop-in CSS (no framework)
   =========================== */

:root {
  --bg: #0b1020;
  --panel: #101a33;
  --panel-2: #0f1730;
  --text: #e7ecff;
  --muted: rgba(231, 236, 255, 0.72);
  --muted-2: rgba(231, 236, 255, 0.55);

  --border: rgba(231, 236, 255, 0.12);
  --border-2: rgba(231, 236, 255, 0.18);

  --accent: #7aa2ff;
  --accent-2: #9a7bff;
  --danger: #ff6b6b;
  --ok: #4fe3a7;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;

  --maxw: 980px;
  --pad: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(
      1200px 600px at 20% -10%,
      rgba(122, 162, 255, 0.18),
      transparent 55%
    ),
    radial-gradient(
      900px 500px at 90% 0%,
      rgba(154, 123, 255, 0.14),
      transparent 55%
    ),
    radial-gradient(
      800px 600px at 40% 120%,
      rgba(79, 227, 167, 0.08),
      transparent 55%
    ),
    var(--bg);

  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Dither/noise overlay to prevent gradient banding */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035; /* tweak: 0.02–0.06 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* Keep your content above the noise layer */
body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover {
  color: var(--text);
  border-bottom-color: var(--border-2);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 26px;
}

.site-header {
  padding: 34px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  margin: 14px 0 10px;
  font-size: clamp(26px, 3.3vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
}

.top-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease,
    border-color 120ms ease;
  user-select: none;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  border-color: rgba(122, 162, 255, 0.35);
  background: linear-gradient(
    135deg,
    rgba(122, 162, 255, 0.18),
    rgba(154, 123, 255, 0.14)
  );
}
.btn.primary:hover {
  border-color: rgba(122, 162, 255, 0.55);
}

main {
  padding: 10px 0 40px;
}

.stack {
  display: grid;
  gap: 16px;
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card .card-header {
  padding: 18px var(--pad);
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}

.card .card-header h2,
.card .card-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.card .card-body {
  padding: var(--pad);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 820px) {
  .grid.two {
    grid-template-columns: 1fr 1fr;
  }
  .grid.three {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.field {
  display: grid;
  gap: 7px;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.help {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted-2);
}

.input,
.select {
  width: 100%;
  appearance: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease,
    box-shadow 120ms ease;
}

.select {
  padding-right: 42px;
  background-image: linear-gradient(
      45deg,
      transparent 50%,
      rgba(231, 236, 255, 0.75) 50%
    ),
    linear-gradient(135deg, rgba(231, 236, 255, 0.75) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.input::placeholder {
  color: rgba(231, 236, 255, 0.35);
}

.input:focus,
.select:focus {
  border-color: rgba(122, 162, 255, 0.65);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 4px rgba(122, 162, 255, 0.12);
}

.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.results {
  display: grid;
  gap: 10px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.08);
}

.result-row .k {
  color: var(--muted);
  font-size: 13px;
}

.result-row .v {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.result-row.primary {
  border-color: rgba(79, 227, 167, 0.35);
  background: linear-gradient(
    135deg,
    rgba(79, 227, 167, 0.14),
    rgba(122, 162, 255, 0.06)
  );
}

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.table th,
.table td {
  padding: 12px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.14);
}

.table tr:last-child td {
  border-bottom: 0;
}

.table td:last-child,
.table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-content td:last-child,
.table-content th:last-child {
  text-align: left;
  font-variant-numeric: normal;
}

.callout {
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(122, 162, 255, 0.25);
  background: rgba(122, 162, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.footer {
  padding: 22px 0 40px;
  color: var(--muted-2);
  font-size: 12px;
}

.footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.small {
  font-size: 12px;
  color: var(--muted-2);
}

/* Accessibility helpers */
.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;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.08);
  padding: 12px 14px;
}

.faq-q {
  cursor: pointer;
  font-weight: 650;
  color: var(--text);
  list-style: none;
}

.faq-q::-webkit-details-marker {
  display: none;
}

.faq-a {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.faq-a p {
  margin: 0;
}
