/* TWM Services LLC - shared styles */
:root {
  /* Brand colors sampled from assets/twm-logo.svg */
  --brand-navy: #245781;
  --brand-orange: #EB6A37;
  --brand-orange-ink: #b5491b; /* darker orange, 5.3:1 on white, for any orange text */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #14202c;
  --ink-2: #2b3a48;
  --muted: #5a6878;
  --line: #dde4ec;
  --line-2: #e8edf3;
  --accent: var(--brand-navy);
  --accent-2: #2d6a99;
  --accent-deep: #173b59;
  --accent-ink: #ffffff;
  --accent-soft: #e8eff6;
  --accent-glow: rgba(45, 106, 153, .18);
  --night: #102a40;
  --warn-bg: #fff7e3;
  --warn-line: #efd28a;
  --warn-ink: #6b4e00;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  --good: #1e7a3c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 48, .05), 0 1px 3px rgba(16, 32, 48, .04);
  --shadow: 0 1px 2px rgba(16, 32, 48, .04), 0 8px 24px -8px rgba(16, 32, 48, .10);
  --shadow-lg: 0 2px 4px rgba(16, 32, 48, .04), 0 18px 40px -12px rgba(16, 32, 48, .22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); line-height: 1.55; font-size: 16px;
  background:
    radial-gradient(1100px 420px at 85% -120px, rgba(45, 106, 153, .10), transparent 70%),
    radial-gradient(900px 380px at -10% -80px, rgba(36, 87, 129, .07), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); letter-spacing: -.015em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--accent-deep); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
[id] { scroll-margin-top: 88px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 50; border-radius: 8px; box-shadow: var(--shadow); }

/* Header */
.site-header {
  border-top: 4px solid var(--brand-navy);
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(221, 228, 236, .9);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; text-decoration: none; border-radius: 8px; padding: 4px 0; }
.brand img { display: block; height: 52px; width: auto; }
.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a:not(.btn) { text-decoration: none; color: var(--brand-navy); font-size: 15px; font-weight: 550; padding: 7px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.nav a:not(.btn):hover { color: var(--accent); background: var(--accent-soft); }
.nav .btn { margin-left: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink); text-decoration: none; padding: 11px 18px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 650; line-height: 1.2;
  box-shadow: 0 6px 16px -6px rgba(36, 87, 129, .6), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .15s, box-shadow .15s, filter .15s, background .15s;
}
.btn:hover { color: var(--accent-ink); filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(36, 87, 129, .65), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: var(--surface); color: var(--accent); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { color: var(--accent-deep); background: var(--accent-soft); border-color: rgba(36, 87, 129, .35); box-shadow: var(--shadow-sm); filter: none; }
.btn-ghost::before { content: "\21BA"; font-size: 16px; line-height: 1; }
.btn-sm { padding: 8px 15px; font-size: 14px; }

/* Hero */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 28px 0 28px; padding: 56px 48px 44px; border-radius: 24px; color: #fff;
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(110, 165, 215, .35), transparent 65%),
    radial-gradient(500px 260px at 0% 100%, rgba(45, 106, 153, .45), transparent 70%),
    linear-gradient(140deg, #142f47 0%, var(--accent) 55%, #1b4566 100%);
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(ellipse at 80% 10%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse at 80% 10%, #000 10%, transparent 70%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; right: -80px; bottom: -120px; width: 340px; height: 340px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 0 0 40px rgba(255, 255, 255, .03), 0 0 0 80px rgba(255, 255, 255, .02);
}
.hero h1 { color: #fff; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.025em; max-width: 760px; }
.hero p { color: rgba(255, 255, 255, .86); max-width: 680px; font-size: 18px; margin: 0 0 22px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.pills li {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pills li::before { content: "\2713"; font-size: 12px; color: #f59a72; }
.hero .note-small { margin: 4px 0 0; color: rgba(255, 255, 255, .7); }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; padding: 4px 0 44px; }
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 20px;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--brand-orange));
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.card:hover { color: var(--ink); border-color: rgba(36, 87, 129, .35); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.card:hover::before { transform: scaleX(1); }
.card .num {
  align-self: flex-start; font-size: 11px; font-weight: 750; color: var(--accent); letter-spacing: .1em; text-transform: uppercase;
  background: var(--accent-soft); padding: 4px 10px; border-radius: 999px;
}
.card h2 { font-size: 19px; margin: 4px 0 0; line-height: 1.25; }
.card p { margin: 0; color: var(--muted); font-size: 15px; flex: 1; }
.card .go { font-weight: 650; color: var(--accent); font-size: 14px; margin-top: 6px; transition: letter-spacing .2s; }
.card:hover .go { letter-spacing: .02em; }

/* CTA band */
.cta-band {
  position: relative; overflow: hidden; isolation: isolate;
  color: #fff; border-radius: 22px; padding: 34px 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 12px 0 44px;
  background:
    radial-gradient(520px 240px at 100% 0%, rgba(45, 106, 153, .55), transparent 70%),
    radial-gradient(420px 220px at 0% 120%, rgba(235, 106, 55, .18), transparent 70%),
    var(--night);
  box-shadow: var(--shadow-lg);
}
.cta-band > div { max-width: 640px; }
.cta-band h2 { margin: 0 0 6px; font-size: 24px; color: #fff; }
.cta-band p { margin: 0; color: rgba(255, 255, 255, .78); }
.cta-band .btn { background: #fff; color: var(--accent-deep); border-color: #fff; padding: 13px 22px; box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .5); }
.cta-band .btn::after { content: "\2192"; color: var(--brand-orange-ink); transition: transform .15s; }
.cta-band .btn:hover { color: var(--accent-deep); }
.cta-band .btn:hover::after { transform: translateX(3px); }

/* Tool page */
.crumbs { font-size: 14px; color: var(--muted); padding-top: 28px; }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.tool-head { padding: 6px 0 22px; }
.tool-head h1 { margin: 4px 0 8px; font-size: clamp(28px, 4.2vw, 40px); line-height: 1.12; letter-spacing: -.025em; }
.tool-head p { margin: 0; color: var(--muted); max-width: 760px; font-size: 17px; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 22px; align-items: start; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.panel h2 { font-size: 19px; margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 11px; }
.results-panel { position: sticky; top: 88px; border-color: rgba(36, 87, 129, .22); }
.results-panel .badge { background: var(--accent-soft); border-color: rgba(36, 87, 129, .25); color: var(--accent-deep); }
.results-panel .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 3px rgba(45, 106, 153, .2); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(45, 106, 153, 0); } }
fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
legend { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-deep); margin-bottom: 12px; padding: 0; }
legend::before { content: ""; width: 14px; height: 3px; border-radius: 3px; background: var(--brand-orange); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field[hidden] { display: none; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.input-wrap {
  display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-wrap:hover { border-color: #c5d2df; }
.input-wrap:focus-within { border-color: var(--accent-2); background: #fff; box-shadow: 0 0 0 4px var(--accent-glow); }
.input-wrap .affix { display: flex; align-items: center; padding: 0 11px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; background: transparent; }
.input-wrap input { border: 0; padding: 11px 11px; font: inherit; font-weight: 550; font-variant-numeric: tabular-nums; width: 100%; min-width: 0; background: transparent; color: var(--ink); }
.input-wrap input:focus-visible { outline: none; }
.input-wrap .affix:first-child { padding-right: 0; }
.input-wrap .affix:last-child { padding-left: 0; }
.field select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 38px 11px 12px; font: inherit; font-weight: 550; color: var(--ink);
  background-color: var(--surface-2); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  transition: border-color .15s, box-shadow .15s;
}
.field select:hover { border-color: #c5d2df; }
.field select:focus-visible { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-glow); }
.field.check { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); align-self: end; }
.field.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.field.check label { cursor: pointer; }
.field.has-error .input-wrap { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 3px rgba(179, 38, 30, .12); }
.field-msg { color: var(--bad); font-size: 12px; font-weight: 600; min-height: 0; }
.field-msg:empty { display: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line-2); }

/* Results */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; background: var(--surface-2); }
.stat-big {
  grid-column: 1 / -1; border: 0; padding: 20px 22px; color: #fff; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(360px 160px at 100% 0%, rgba(110, 165, 215, .35), transparent 70%),
    linear-gradient(135deg, #142f47, var(--accent) 70%, var(--accent-2));
  box-shadow: 0 12px 28px -14px rgba(36, 87, 129, .8);
}
.stat-big::after { content: ""; position: absolute; z-index: -1; right: -40px; bottom: -70px; width: 180px; height: 180px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .14); }
.stat-big .stat-label { color: rgba(255, 255, 255, .8); font-weight: 600; }
.stat-big .stat-value { font-size: 38px; color: #fff; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.stat-big .stat-sub { color: rgba(255, 255, 255, .78); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 550; }
.stat-value { font-size: 23px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tone-bad .stat-value { color: var(--bad); }
.tone-good .stat-value { color: var(--good); }
.stat.tone-bad:not(.stat-big) { background: #fff7f6; border-color: #f3cdc9; }
.stat.tone-good:not(.stat-big) { background: #f3faf5; border-color: #c8e6d1; }
.stat-big.tone-bad { background: radial-gradient(360px 160px at 100% 0%, rgba(255, 160, 150, .3), transparent 70%), linear-gradient(135deg, #5c1410, var(--bad) 75%); box-shadow: 0 12px 28px -14px rgba(179, 38, 30, .8); }
.stat-big.tone-good { background: radial-gradient(360px 160px at 100% 0%, rgba(140, 230, 170, .3), transparent 70%), linear-gradient(135deg, #0f3d1f, var(--good) 75%); box-shadow: 0 12px 28px -14px rgba(30, 122, 60, .8); }
.stat-big.tone-bad .stat-value, .stat-big.tone-good .stat-value { color: #fff; }
.notice { position: relative; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px; padding: 10px 14px 10px 38px; margin: 0 0 12px; font-size: 14px; color: #4d3800; }
.notice::before { content: "!"; position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; border-radius: 50%; background: #e0a800; color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.notice-error { background: var(--bad-soft); border-color: #f0b4ae; color: #7a1c15; }
.notice-error::before { background: var(--bad); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.detail { border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.detail th, .detail td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.detail tr:last-child th, .detail tr:last-child td { border-bottom: 0; }
.detail tr:nth-child(even) th, .detail tr:nth-child(even) td { background: var(--surface-2); }
.detail th { text-align: left; font-weight: 500; color: var(--muted); }
.detail td { text-align: right; font-weight: 650; }
.detail tr.strong th, .detail tr.strong td { color: var(--accent-deep); font-weight: 750; background: var(--accent-soft); }
.table-title { font-size: 15px; margin: 20px 0 8px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.grid-table th, .grid-table td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
.grid-table thead th { background: var(--surface-2); font-weight: 750; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
.grid-table tbody th { text-align: left; font-weight: 650; }
.grid-table tbody tr { transition: background .12s; }
.grid-table tbody tr:hover { background: var(--surface-2); }
.grid-table tr.hl, .grid-table tr.hl:hover { background: var(--accent-soft); }
.grid-table tr.hl th { color: var(--accent-deep); box-shadow: inset 3px 0 0 var(--accent); }
.grid-table tbody tr:last-child th, .grid-table tbody tr:last-child td { border-bottom: 0; }
.table-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* How this works */
.how { margin: 26px 0; padding: 26px 28px; }
.how h2 { display: flex; align-items: center; gap: 10px; font-size: 21px; margin: 0 0 12px; }
.how h2::before {
  content: "\0192"; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px;
  font-size: 17px; font-style: italic; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent));
}
#about.how h2::before { content: "i"; font-family: Georgia, serif; }
.how ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.how li { position: relative; padding: 9px 12px 9px 30px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; }
.how li::before { content: ""; position: absolute; left: 13px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-orange); }
.how code, .formula { font-family: var(--mono); font-size: 13.5px; color: var(--accent-deep); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; overflow-wrap: anywhere; }
.how .note { color: var(--muted); font-size: 14px; margin: 14px 0 0; padding-left: 12px; border-left: 3px solid var(--line); }
#about.how p { color: var(--ink-2); max-width: 820px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0 32px; margin-top: 28px; font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; align-items: center; }
.site-footer strong { color: var(--ink); }
.site-footer a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.disclaimer { width: 100%; margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 13px; }

.note-small { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.tool-layout.wide { grid-template-columns: minmax(0, 1fr); }
.tool-layout.wide .results-panel { position: static; }
.tool-layout.wide .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-table thead th:first-child { text-align: left; }

@media (max-width: 860px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .results-panel { position: static; }
  .tool-layout.wide .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 44px 30px 34px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .fields, .tool-layout.wide .fields { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .site-header .wrap { min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
  .brand img { height: 44px; }
  .nav .hide-sm { display: none; }
  .hero { margin: 16px 0 22px; padding: 32px 22px 26px; border-radius: 20px; }
  .hero p { font-size: 16px; }
  .panel { padding: 18px; }
  .how { padding: 20px 18px; }
  .cta-band { padding: 26px 22px; }
  .cta-band .btn { width: 100%; }
  .stat-big .stat-value { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { background: #fff; }
  .site-header, .cta-band, .form-actions, .nav { display: none; }
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .panel, .card { box-shadow: none; }
  .stat-big { background: var(--accent-soft); color: var(--ink); box-shadow: none; }
  .stat-big .stat-value, .stat-big .stat-label, .stat-big .stat-sub { color: var(--ink); }
}
