/*
 * ANTHO.CSS — Anthropic-style Design System
 * Mobile-first · Warm editorial · Production-ready
 *
 * Google Fonts CDN (use fonts.googleapis.cn mirror in China):
 * @import url('https://fonts.googleapis.cn/css2?family=Poppins:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');
 */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

/* ─── TOKENS ─── */
:root {
  /* Brand colors */
  --dark:        #141413;
  --light:       #faf9f5;
  --mid-gray:    #b0aea5;
  --light-gray:  #e8e6dc;
  --border:      #d4d2c9;

  /* Accents */
  --orange:      #d97757;
  --orange-dim:  #f2e8e3;
  --blue:        #6a9bcc;
  --blue-dim:    #deeaf4;
  --green:       #788c5d;
  --green-dim:   #e3e9db;

  /* Semantic */
  --bg:          var(--light);
  --text:        var(--dark);
  --text-2:      #4a4946;
  --text-3:      var(--mid-gray);
  --accent:      var(--orange);
  --accent-dim:  var(--orange-dim);

  /* Typography */
  --font-head:   'Poppins', Arial, sans-serif;
  --font-body:   'Lora', Georgia, serif;
  --font-mono:   'SF Mono', 'Fira Code', 'Courier New', monospace;

  /* Type scale */
  --t-xs:   0.75rem;
  --t-sm:   0.875rem;
  --t-base: 1rem;
  --t-lg:   1.125rem;
  --t-xl:   1.25rem;
  --t-2xl:  1.5rem;
  --t-3xl:  1.875rem;
  --t-4xl:  2.25rem;
  --t-5xl:  3rem;

  /* Spacing (4px base) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(20,20,19,.07);
  --shadow-md: 0 4px 12px rgba(20,20,19,.09);
  --shadow-lg: 0 8px 24px rgba(20,20,19,.11);
  --shadow-xl: 0 16px 48px rgba(20,20,19,.13);

  /* Transitions */
  --ease-fast: 150ms ease;
  --ease: 250ms ease;
  --ease-slow: 400ms ease;

  /* Layout */
  --w-sm:  640px;
  --w-md:  768px;
  --w-lg:  1024px;
  --w-xl:  1200px;
  --px:    var(--s-4);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── TYPOGRAPHY ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.25;
  color: var(--dark);
}
h1 { font-size: var(--t-3xl); font-weight: 700; }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }
h5 { font-size: var(--t-base); }
h6 { font-size: var(--t-sm); letter-spacing: .05em; text-transform: uppercase; }

@media (min-width: 768px) {
  h1 { font-size: var(--t-4xl); }
  h2 { font-size: var(--t-3xl); }
  h3 { font-size: var(--t-2xl); }
}

p { line-height: 1.75; }
p + p { margin-top: var(--s-4); }

.lead {
  font-size: var(--t-lg);
  color: var(--text-2);
  line-height: 1.7;
}

.caption {
  font-size: var(--t-sm);
  color: var(--text-3);
  font-family: var(--font-head);
}

small { font-size: var(--t-xs); color: var(--text-3); }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--light-gray);
  padding: 2px 6px;
  border-radius: var(--r-sm);
}

strong { font-weight: 600; }
em { font-style: italic; }

/* ─── LAYOUT ─── */
.container {
  width: 100%;
  max-width: var(--w-lg);
  margin-inline: auto;
  padding-inline: var(--px);
}
.container-sm { max-width: var(--w-sm); }
.container-md { max-width: var(--w-md); }

.section {
  padding-block: var(--s-12);
}
@media (min-width: 768px) {
  .section { padding-block: var(--s-20); }
}

/* Stack (vertical spacing utility) */
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-8); }

/* Grid */
.grid {
  display: grid;
  gap: var(--s-4);
}
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Flex helpers */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--s-2); }
.gap-4 { gap: var(--s-4); }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: var(--s-6);
}

/* ─── CARD ─── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
}
.card-flat {
  background: var(--light-gray);
  border: none;
  border-radius: var(--r-xl);
  padding: var(--s-6);
}
.card-accent {
  background: var(--accent-dim);
  border: 1px solid rgba(217,119,87,.2);
  border-radius: var(--r-xl);
  padding: var(--s-6);
}
.card + .card { margin-top: var(--s-4); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-head);
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  padding: var(--s-3) var(--s-6);
  min-height: 44px;           /* touch target */
  transition: all var(--ease-fast);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Primary */
.btn-primary {
  background: var(--dark);
  color: var(--light);
}
.btn-primary:hover:not(:disabled) {
  background: #2a2926;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--light);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

/* Accent (orange) */
.btn-accent {
  background: var(--orange);
  color: #fff;
}
.btn-accent:hover:not(:disabled) {
  background: #c9674a;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(217,119,87,.35);
  text-decoration: none;
  color: #fff;
}

/* Secondary (outline) */
.btn-secondary {
  background: transparent;
  color: var(--dark);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--dark);
  background: var(--light-gray);
  text-decoration: none;
  color: var(--dark);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding-inline: var(--s-3);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--light-gray);
  color: var(--dark);
  text-decoration: none;
}

/* Sizes */
.btn-sm { font-size: var(--t-xs); padding: var(--s-2) var(--s-4); min-height: 32px; }
.btn-lg { font-size: var(--t-base); padding: var(--s-4) var(--s-8); min-height: 52px; }
.btn-full { width: 100%; }

/* ─── FORMS ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.form-group + .form-group { margin-top: var(--s-5); }

label {
  font-family: var(--font-head);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--text-2);
}

.input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-base);
  font-family: var(--font-body);
  color: var(--text);
  min-height: 44px;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(217,119,87,.15);
}
.input::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* Input with prefix/suffix */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .input { padding-left: var(--s-10); }
.input-wrap .input-prefix {
  position: absolute;
  left: var(--s-4);
  color: var(--text-3);
  font-family: var(--font-head);
  font-size: var(--t-sm);
  pointer-events: none;
}
.input-wrap.suffix .input { padding-right: var(--s-10); }
.input-wrap .input-suffix {
  position: absolute;
  right: var(--s-4);
  color: var(--text-3);
  font-family: var(--font-head);
  font-size: var(--t-sm);
  pointer-events: none;
}

/* Select */
.select-wrap {
  position: relative;
}
.select-wrap select { padding-right: var(--s-10); cursor: pointer; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: var(--s-4);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-3);
  pointer-events: none;
}

/* Checkbox & Radio */
.check-group {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  cursor: pointer;
}
.check-group input[type="checkbox"],
.check-group input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex-shrink: 0;
  accent-color: var(--orange);
  cursor: pointer;
}
.check-group label { cursor: pointer; margin: 0; color: var(--text); font-size: var(--t-base); }

/* Form hint */
.form-hint {
  font-size: var(--t-xs);
  color: var(--text-3);
  font-family: var(--font-head);
}
.form-error {
  font-size: var(--t-xs);
  color: #c0392b;
  font-family: var(--font-head);
}

/* ─── BADGES / TAGS ─── */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-head);
  font-size: var(--t-xs);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.badge-default { background: var(--light-gray); color: var(--text-2); }
.badge-orange  { background: var(--orange-dim); color: #a0502f; }
.badge-blue    { background: var(--blue-dim);   color: #3a6a99; }
.badge-green   { background: var(--green-dim);  color: #4a6035; }
.badge-dark    { background: var(--dark);        color: var(--light); }

/* ─── ALERTS / NOTICES ─── */
.alert {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  font-size: var(--t-sm);
  line-height: 1.6;
}
.alert-icon { font-size: 1.1em; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--blue-dim);   border-left: 3px solid var(--blue);   color: #2a4a6a; }
.alert-success { background: var(--green-dim);  border-left: 3px solid var(--green);  color: #2a4020; }
.alert-warning { background: var(--orange-dim); border-left: 3px solid var(--orange); color: #7a3a20; }
.alert-neutral { background: var(--light-gray); border-left: 3px solid var(--mid-gray); color: var(--text-2); }

/* ─── RESULT / HIGHLIGHT BOX ─── */
/* For displaying calculated results prominently */
.result-box {
  background: var(--dark);
  color: var(--light);
  border-radius: var(--r-xl);
  padding: var(--s-6) var(--s-8);
  text-align: center;
}
.result-box .result-label {
  font-family: var(--font-head);
  font-size: var(--t-sm);
  color: var(--mid-gray);
  margin-bottom: var(--s-2);
  letter-spacing: .04em;
}
.result-box .result-value {
  font-family: var(--font-head);
  font-size: var(--t-4xl);
  font-weight: 700;
  color: var(--orange);
  line-height: 1;
}
.result-box .result-sub {
  font-size: var(--t-sm);
  color: var(--mid-gray);
  margin-top: var(--s-2);
}

/* Savings highlight (accent box) */
.savings-box {
  background: var(--orange-dim);
  border: 1px solid rgba(217,119,87,.25);
  border-radius: var(--r-xl);
  padding: var(--s-5) var(--s-6);
  text-align: center;
}
.savings-box .savings-label {
  font-family: var(--font-head);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--orange);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: var(--s-1);
}
.savings-box .savings-value {
  font-family: var(--font-head);
  font-size: var(--t-3xl);
  font-weight: 700;
  color: var(--dark);
}
.savings-box .savings-desc {
  font-size: var(--t-sm);
  color: var(--text-2);
  margin-top: var(--s-1);
}

/* ─── COMPARISON ROW ─── */
/* For comparing two tax methods side by side */
.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.compare-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  text-align: center;
  transition: border-color var(--ease-fast);
}
.compare-card.is-best {
  border-color: var(--orange);
  background: var(--orange-dim);
}
.compare-card .compare-label {
  font-family: var(--font-head);
  font-size: var(--t-xs);
  color: var(--text-3);
  margin-bottom: var(--s-2);
}
.compare-card.is-best .compare-label { color: var(--orange); font-weight: 600; }
.compare-card .compare-amount {
  font-family: var(--font-head);
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--dark);
}
.compare-card.is-best .compare-amount { color: var(--orange); }

/* ─── TABS ─── */
.tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font-family: var(--font-head);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--text-3);
  padding: var(--s-3) var(--s-5);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  white-space: nowrap;
  transition: color var(--ease-fast), border-color var(--ease-fast);
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--dark);
  border-bottom-color: var(--orange);
}

/* ─── TOGGLE / SWITCH ─── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
}
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--light-gray);
  border-radius: var(--r-full);
  transition: background var(--ease-fast);
  cursor: pointer;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform var(--ease-fast);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-track {
  background: var(--orange);
}
.toggle input:checked + .toggle-track::before {
  transform: translateX(20px);
}

/* ─── PROGRESS BAR ─── */
.progress-bar {
  height: 8px;
  background: var(--light-gray);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: var(--r-full);
  transition: width var(--ease-slow);
}
.progress-fill.blue  { background: var(--blue); }
.progress-fill.green { background: var(--green); }
.progress-fill.dark  { background: var(--dark); }

/* ─── STEP INDICATOR ─── */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--s-8);
  overflow-x: auto;
}
.step {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--light-gray);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-3);
  flex-shrink: 0;
}
.step-dot.is-active { background: var(--orange); border-color: var(--orange); color: #fff; }
.step-dot.is-done   { background: var(--dark);   border-color: var(--dark);   color: #fff; }
.step-label {
  font-family: var(--font-head);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
}
.step-label.is-active { color: var(--dark); }
.step-connector {
  width: 24px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
  margin-inline: var(--s-1);
}

/* ─── DIVIDER WITH LABEL ─── */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-block: var(--s-6);
  color: var(--text-3);
  font-family: var(--font-head);
  font-size: var(--t-xs);
  letter-spacing: .04em;
}
.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── HEADER / NAV ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-overlay, 100);
  background: rgba(250, 249, 245, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding-inline: var(--px);
  max-width: var(--w-lg);
  margin-inline: auto;
}
.site-logo {
  font-family: var(--font-head);
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--dark);
  text-decoration: none;
}
.site-logo:hover { text-decoration: none; color: var(--dark); }

/* ─── PAGE HEADER ─── */
.page-header {
  padding-top: var(--s-10);
  padding-bottom: var(--s-8);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-8);
}
.page-header .eyebrow {
  font-family: var(--font-head);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: var(--s-3);
}
.page-header h1 { margin-bottom: var(--s-3); }
.page-header .lead { max-width: 60ch; }

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: var(--s-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: var(--light);
  font-family: var(--font-head);
  font-size: var(--t-sm);
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-xl);
  z-index: 300;
  opacity: 0;
  transition: transform var(--ease), opacity var(--ease);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── UTILITIES ─── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: var(--t-sm); }
.text-xs     { font-size: var(--t-xs); }
.text-lg     { font-size: var(--t-lg); }
.text-muted  { color: var(--text-3); }
.text-accent { color: var(--orange); }
.text-head   { font-family: var(--font-head); }

.mt-2  { margin-top: var(--s-2); }
.mt-4  { margin-top: var(--s-4); }
.mt-6  { margin-top: var(--s-6); }
.mt-8  { margin-top: var(--s-8); }
.mb-2  { margin-bottom: var(--s-2); }
.mb-4  { margin-bottom: var(--s-4); }
.mb-6  { margin-bottom: var(--s-6); }
.mb-8  { margin-bottom: var(--s-8); }

.hidden  { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── RESPONSIVE HELPERS ─── */
@media (max-width: 639px) { .hide-mobile { display: none !important; } }
@media (min-width: 640px) { .hide-desktop { display: none !important; } }

/* ─── PRINT ─── */
@media print {
  .btn, .site-header, .toast { display: none !important; }
  body { background: #fff; color: #000; }
}
