/* TradeFlow — static site styles */
:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --text: #1a1d21;
  --text-muted: #5c6370;
  --accent: #0d4f6e;
  --accent-hover: #0a3d55;
  --border: #e6e9ed;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(26, 29, 33, 0.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 720px;
  --wide: 1040px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}

.nav a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 3rem 1.25rem 2.5rem;
  text-align: center;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero .lead {
  margin: 0 auto 1.75rem;
  max-width: 36rem;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.section {
  margin-top: 3rem;
}

.section:first-of-type {
  margin-top: 0;
}

.section h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  max-width: var(--max);
}

.section p:last-child {
  margin-bottom: 0;
}

.card-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card p {
  margin: 0;
  font-size: 0.9375rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(13, 79, 110, 0.08);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.15rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.page-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-intro {
  margin: 0 0 2rem;
  color: var(--text-muted);
  max-width: 42rem;
}

.steps {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 2.75rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.steps li:last-child {
  margin-bottom: 0;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.85rem;
  height: 1.85rem;
  line-height: 1.85rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
}

.tool-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.section + .tool-hero {
  margin-top: 2rem;
}

.tool-hero h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.tool-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.disclaimer {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  max-width: 42rem;
}

.contact-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.75rem 1.5rem;
  max-width: 28rem;
  box-shadow: var(--shadow);
}

/* Only direct paragraphs on the card — do not style <p> inside #contact-form */
.contact-block > p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.contact-block a.mail {
  font-weight: 600;
  word-break: break-all;
}

/* Contact form card: full width up to max; grid + #contact-form id for stable layout */
.contact-block.contact-form-wrap {
  width: 100%;
  max-width: 38rem;
  box-sizing: border-box;
}

#contact-form.contact-form {
  margin: 0;
  padding: 0;
  border: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  width: 100%;
  max-width: 100%;
}

#contact-form .form-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: start;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}

#contact-form .form-field > label {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
  padding: 0;
  text-align: left;
}

#contact-form .form-field > input[type="email"],
#contact-form .form-field > textarea {
  grid-column: 1;
  grid-row: 2;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

#contact-form .form-field > textarea {
  resize: vertical;
  min-height: 9rem;
  overflow: auto;
}

#contact-form .form-field > input::placeholder,
#contact-form .form-field > textarea::placeholder {
  color: #8b939e;
  font-family: var(--font);
}

#contact-form .form-field > input:focus,
#contact-form .form-field > textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 79, 110, 0.18);
}

#contact-form .form-actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.2rem 0 0;
  width: 100%;
  min-width: 0;
}

#contact-form .form-status {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--accent);
}

#contact-form .form-hint {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.legal {
  max-width: 42rem;
}

.legal h2 {
  font-size: 1.1rem;
  margin: 2rem 0 0.75rem;
}

.legal h2:first-child {
  margin-top: 0;
}

.legal p,
.legal ul {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.legal ul {
  padding-left: 1.25rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent);
}

/* FatcaNilReporter help (fatcanilreporter-help.html) — width follows global main (var(--wide)) */
.help-back {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

.help-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.help-toc-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 600;
}

.help-toc ul {
  margin: 0;
  padding-left: 1.25rem;
}

.help-toc a {
  font-size: 0.9375rem;
}

.help-section {
  margin-bottom: 1.5rem;
}

.help-section h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.help-h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.help-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.help-figure {
  margin: 1rem 0 0;
}

.help-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.help-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.help-steps {
  margin-top: 0.5rem;
}
