/* ============================================================
   NetPay — salary converter
   Neutral palette is local; ALL accent color comes from the
   shared theme tokens (cdn.yusufaw.me/theme.css):
   --accent, --accent-hover, --accent-soft, --accent-2,
   --accent-rgb, --accent-border
   ============================================================ */

/* Fallback accent tokens — used only if the CDN stylesheet fails
   to load. theme.css is linked after this file, so its values win. */
:root {
  --accent: #2a737e;
  --accent-hover: #235f69;
  --accent-soft: #e2eef0;
  --accent-2: #4f9aa6;
  --accent-rgb: 42, 115, 126;
  --accent-border: #c2dbdf;
}

/* ---- Fonts (self-hosted variable fonts) ---- */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---- Neutral design tokens ---- */
:root {
  --bg: #ecebe6;
  --bg-gradient-hi: #f4f3ee;
  --bg-gradient-lo: #e7e6df;
  --card: #fdfcf9;
  --card-border: #e2e0d7;
  --text: #2b2822;
  --muted: #8a8477;
  --hairline: #eceae2;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Inter Tight", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(43, 40, 34, 0.04), 0 8px 24px rgba(43, 40, 34, 0.06);
}

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(120% 90% at 50% 0%, var(--bg-gradient-hi) 0%, var(--bg-gradient-lo) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 460px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Header ---- */
.site-header {
  text-align: center;
  margin-bottom: 28px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.tagline {
  color: var(--muted);
  font-size: 15px;
  margin: 0 auto;
  max-width: 34ch;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card + .card {
  margin-top: 14px;
}

/* ---- Fields ---- */
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 7px;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field-note {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.amount-input:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.currency-symbol {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  flex: none;
}

.amount-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 12px 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.amount-input input::placeholder {
  color: var(--hairline);
  color: color-mix(in srgb, var(--muted) 45%, transparent);
}

/* ---- Swap row (monthly ↔ annual) ---- */
.swap-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.hairline {
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.swap-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  flex: none;
}

.mono-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---- Settings ---- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 34px 12px 14px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-wrap select:focus-visible {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.select-chevron {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.tax-input input {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  padding: 12.5px 0;
}

/* ---- Gross / net toggle ---- */
.mode-toggle {
  border: 0;
  padding: 0;
  margin: 16px 0 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--hairline);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 4px;
}

.seg-btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 10px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.is-active {
  background: var(--accent);
  color: #f4f3ee;
}

.seg-btn:focus-visible,
.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Results ---- */
.results-title {
  margin: 0 0 16px;
  text-transform: uppercase;
  font-weight: 500;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.result-info {
  min-width: 0;
}

.result-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}

.result-value {
  display: block;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.result-divider {
  height: 1px;
  background: var(--hairline);
  margin: 16px 0;
}

/* ---- Copy buttons ---- */
.copy-btn {
  flex: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  min-width: 118px;
}

.copy-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #f4f3ee;
}

.copy-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.copy-secondary {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

.copy-secondary:hover {
  background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent-border));
}

.copy-btn.is-copied {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---- Deductions ---- */
.deduction-block {
  margin-top: 18px;
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
  display: grid;
  gap: 6px;
}

.deduction-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--muted);
}

.deduction-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ---- Prose / FAQ ---- */
.prose {
  margin-top: 44px;
}

.prose h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 12px;
}

.prose h3 {
  font-family: var(--font-ui);
  font-size: 15.5px;
  font-weight: 600;
  margin: 22px 0 6px;
}

.prose p {
  font-size: 14.5px;
  color: #55503f;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
  margin: 0 0 12px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 1.5px 6px;
  white-space: nowrap;
}

.faq {
  border-top: 1px solid var(--card-border);
  padding-top: 32px;
}

/* ---- Footer ---- */
.site-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---- Small screens ---- */
@media (max-width: 420px) {
  .page {
    padding-top: 36px;
  }

  h1 {
    font-size: 34px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .result-row {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-btn {
    width: 100%;
    padding: 11px 14px;
  }
}

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