/* Fahl Software site styles. Tokens in tokens.css; rules in DESIGN.md */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s-4); top: var(--s-4); background: var(--surface); padding: var(--s-2) var(--s-4); z-index: 10; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Type */
h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: var(--fs-h1); line-height: 1.15; }
h2 { font-size: var(--fs-h2); line-height: 1.2; }
h3 { font-size: var(--fs-h3); line-height: 1.3; }
.display { font-size: var(--fs-display); line-height: 1.1; max-width: 22ch; }
p, ul, ol { margin: 0 0 var(--s-4); max-width: var(--measure); }
ul, ol { padding-left: 1.25em; }
li + li { margin-top: var(--s-2); }
.lead { font-size: 1.25rem; color: var(--ink); }
.muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: var(--fs-mono); }

/* Placeholder for open decisions. Must not exist at publish time. */
.decidir {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--ink);
  border-bottom: 1px dashed var(--warn);
  padding: 0 0.2em;
  font-style: normal;
}

/* Claude's recommendation, awaiting Felipe's confirmation. Remove before publishing. */
.sugerido {
  background: transparent;
  color: inherit;
  border-bottom: 2px dotted var(--accent);
}

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s-4) var(--s-6); padding-top: var(--s-4); padding-bottom: var(--s-4);
}
.brand { display: inline-flex; }
.brand img { height: 24px; width: auto; }
.site-nav { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }
.site-nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: var(--fs-small); }
.site-nav a:not(.btn):hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2;
  padding: 12px 20px; border-radius: var(--r-sm); text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-secondary:hover { background: var(--surface); }
.btn-small { padding: 8px 14px; font-size: var(--fs-small); }
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.quiet { font-weight: 600; text-decoration: none; }
.quiet:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-6); margin-top: var(--s-6); }

/* Sections */
main section { padding: var(--s-9) 0 0; }
main section:last-child { padding-bottom: var(--s-9); }
.hero { padding-top: var(--s-8); }
.hero .display, .hero h1 { margin-bottom: var(--s-5); }
section > .wrap > h2 { margin-bottom: var(--s-5); }
.section-cta { text-align: center; }
.section-cta p, .section-cta h2 { margin-left: auto; margin-right: auto; }
.section-cta .actions { justify-content: center; }

/* Table: the signature component */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { text-align: left; vertical-align: top; padding: var(--s-4) var(--s-5); }
thead th { color: var(--muted); font-weight: 600; font-size: var(--fs-small); border-bottom: 1px solid var(--line); }
tbody tr + tr td, tbody tr + tr th { border-top: 1px solid var(--line); }
tbody th { font-weight: 600; width: 30%; }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.table-note { margin-top: var(--s-4); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-6); }

/* Two columns */
.split { display: grid; gap: var(--s-5) var(--s-7); grid-template-columns: 1fr; }
.split > h2 { margin-bottom: 0; }
@media (min-width: 52rem) { .split { grid-template-columns: 1fr 1fr; } .split.narrow-left { grid-template-columns: 16rem 1fr; } }

.photo { border-radius: var(--r-md); border: 1px solid var(--line); }

/* Steps */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.5rem 1fr; gap: var(--s-3); }
.steps li::before { content: counter(step); font-family: var(--mono); color: var(--accent); font-weight: 600; }
.steps li + li { margin-top: var(--s-4); }

/* FAQ */
.faq dt { font-weight: 600; margin-top: var(--s-5); }
.faq dd { margin: var(--s-2) 0 0; max-width: var(--measure); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); font-size: var(--fs-small); color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4) var(--s-7); padding-top: var(--s-6); padding-bottom: var(--s-7); }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.site-footer li + li { margin-top: 0; }

@media (max-width: 40rem) {
  main section { padding-top: var(--s-8); }
  main section:last-child { padding-bottom: var(--s-8); }
  th, td { padding: var(--s-3) var(--s-4); }
  tbody th { width: auto; }
  /* Multi-column tables become stacked rows on small screens */
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: var(--s-3) 0; }
  table.stack th, table.stack td { display: block; padding: var(--s-1) var(--s-4); border: 0; }
  table.stack tbody tr + tr { border-top: 1px solid var(--line); }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}
