/* ==========================================================================
   LetrasMX — design system
   Editorial ink & paper, single terracotta accent. No external fonts.
   ========================================================================== */

:root {
  --paper: #fbfaf6;
  --surface: #ffffff;
  --ink: #191510;
  --ink-2: #423b31;
  --muted: #726a5d;
  --line: #e8e2d6;
  --line-2: #d9d2c2;
  --accent: #b8431e;
  --accent-dark: #9a3616;
  --accent-soft: #f9ede7;
  --dark: #17130f;
  --dark-2: #241e18;
  --good: #1c6b46;

  --font-display: Georgia, "Times New Roman", Times, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(25, 21, 16, 0.05);
  --shadow-2: 0 1px 2px rgba(25, 21, 16, 0.05), 0 6px 20px rgba(25, 21, 16, 0.07);
  --wrap: 1120px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.22;
  color: var(--ink);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); margin-top: 0.4em; }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.35rem); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }

strong { color: var(--ink); }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.2rem 0;
}

code, kbd { font-family: var(--font-mono); font-size: 0.92em; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

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

.skip-link {
  position: absolute;
  left: 8px; top: -48px;
  background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: 0 0 var(--r-sm) var(--r-sm);
  z-index: 100; transition: top 0.15s;
}
.skip-link:focus { top: 0; color: #fff; text-decoration: none; }

/* Layout ------------------------------------------------------------ */
.wrap {
  width: min(var(--wrap), 100% - 2.4rem);
  margin-inline: auto;
}
.wrap--narrow { width: min(780px, 100% - 2.4rem); }

.section { padding: clamp(2.6rem, 6vw, 4.4rem) 0; }
.section--tight { padding: clamp(1.8rem, 4vw, 2.8rem) 0; }
.section--alt { background: #f4f1e9; }
.section--surface { background: var(--surface); border-block: 1px solid var(--line); }

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.7rem;
}

.lead {
  font-size: clamp(1.02rem, 1.6vw, 1.14rem);
  color: var(--ink-2);
  max-width: 68ch;
}

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.section-head { max-width: 70ch; margin-bottom: 2rem; }
.section-head p:last-child { margin-bottom: 0; }

/* Header ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 246, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .brand-dot { color: var(--accent); }
.brand em {
  font-style: normal;
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 6px;
}

.nav { margin-left: auto; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-block;
  padding: 0.5rem 0.72rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-2);
  border-radius: var(--r-sm);
}
button.nav-link {
  background: transparent;
  border: 0;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}
button.nav-link[data-active="yes"] { color: var(--ink); background: rgba(25, 21, 16, 0.05); }
.nav-link:hover, .nav-link[aria-current="page"] {
  color: var(--ink);
  text-decoration: none;
  background: rgba(25, 21, 16, 0.05);
}
.nav-caret { font-size: 0.62em; margin-left: 5px; color: var(--muted); }

.nav-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
  padding: 0.5rem;
  display: none;
}
.nav-item:hover > .nav-drop,
.nav-item:focus-within > .nav-drop { display: block; }
.nav-drop a {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 0.94rem;
}
.nav-drop a:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }

.nav-cta { margin-left: 0.4rem; }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 940px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    padding: 0.6rem 1.2rem 1rem;
    margin-left: 0;
  }
  .site-header.nav-open .nav { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-link { display: block; padding: 0.65rem 0.4rem; }
  .nav-drop {
    position: static;
    display: block;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 0.4rem 0.9rem;
    min-width: 0;
  }
  .nav-caret { display: none; }
  .nav-cta { margin: 0.5rem 0 0; }
  .nav-cta .btn { width: 100%; justify-content: center; }
}

/* Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.62em 1.25em;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 650;
  line-height: 1.4;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); color: #fff; }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--ink-2); color: var(--ink); }

.btn--quiet {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding-inline: 0.7em;
}
.btn--quiet:hover { color: var(--ink); background: rgba(25,21,16,0.05); }

.btn--sm { font-size: 0.87rem; padding: 0.42em 0.9em; }
.btn--block { width: 100%; }

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Hero -------------------------------------------------------------- */
.hero { padding: clamp(2.4rem, 6vw, 4.2rem) 0 clamp(2rem, 5vw, 3.4rem); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.6rem;
}
.hero h1 .accent-word {
  position: relative;
  white-space: nowrap;
}
.hero h1 .accent-word::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.06em;
  height: 0.3em;
  background: var(--accent-soft);
  z-index: -1;
  border-radius: 2px;
}
.hero .lead { margin-bottom: 0.4rem; }
.hero-note {
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
.hero-note span::before { content: "✓ "; color: var(--good); font-weight: 700; }

/* Generator --------------------------------------------------------- */
.gen {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: clamp(1.1rem, 3vw, 1.7rem);
}
.gen-top { display: grid; gap: 0.8rem; }

.gen-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.4rem;
}

.gen-input-row { display: flex; gap: 0.6rem; }
.gen-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.08rem;
  padding: 0.72em 0.95em;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
}
.gen-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.gen-input::placeholder { color: #a49b8b; }

.gen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.gen-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

.gen-hint {
  font-size: 0.86rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 0.75rem;
  margin: 0.25rem 0 0;
}
.gen-hint strong { color: var(--ink-2); }

.gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 0.7rem;
  margin-top: 1.1rem;
}

.style-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.6rem 0.65rem 0.6rem 0.85rem;
  min-width: 0;
}
.style-card:hover { border-color: var(--line-2); }
.style-meta { min-width: 0; flex: 1; }
.style-name {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}
.style-preview {
  display: block;
  font-size: 1.14rem;
  line-height: 1.5;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.style-preview.is-empty { color: #b3aa9a; }
.style-copy { flex-shrink: 0; }

/* Toast -------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(8px);
  background: var(--dark);
  color: #f5f1e8;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 99px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Cards & grids ------------------------------------------------------ */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1.1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.25rem 1.3rem;
  box-shadow: var(--shadow-1);
}
.card h3 { margin-bottom: 0.4rem; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card--flat { box-shadow: none; background: var(--paper); }

.card-link { display: block; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.card-link:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.card-link .card-kw { font-size: 0.84rem; color: var(--muted); }
.card-link .go { color: var(--accent); font-weight: 650; font-size: 0.92rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3.2rem;
  margin: 0;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 2.2rem; height: 2.2rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.steps h3 { margin-bottom: 0.2rem; font-size: 1.08rem; }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.97rem; }

/* Chips / example strips --------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 0.55rem; list-style: none; padding: 0; margin: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0.42em 1em;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--ink-2);
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }

.example-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0; margin: 0 0 1rem;
}
.example-strip li {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.85rem;
  font-size: 1.12rem;
}

.copy-inline {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}
.copy-inline:hover { color: var(--accent-dark); text-decoration: underline; }

/* FAQ ---------------------------------------------------------------- */
.faq { border-top: 1px solid var(--line); }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 0.15rem 0;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
  padding: 0.95rem 0;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  margin-left: auto;
  color: var(--accent);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq .faq-body { padding: 0 2.2rem 1.1rem 0; color: var(--ink-2); }
.faq .faq-body p:last-child { margin-bottom: 0; }

/* Related links ------------------------------------------------------ */
.related { columns: 2; column-gap: 2rem; list-style: none; padding: 0; margin: 0; }
.related li { break-inside: avoid; margin-bottom: 0.5rem; }
@media (max-width: 640px) { .related { columns: 1; } }

/* Breadcrumbs -------------------------------------------------------- */
.crumbs {
  font-size: 0.86rem;
  color: var(--muted);
  padding: 0.9rem 0 0;
}
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.crumbs li:not(:last-child)::after { content: "›"; margin-left: 0.35rem; color: var(--line-2); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current="page"] { color: var(--ink-2); }

/* Page header block --------------------------------------------------- */
.page-head { padding: clamp(1.4rem, 4vw, 2.6rem) 0 clamp(1rem, 3vw, 1.6rem); }
.page-head .lead { margin-bottom: 0; }

/* Prose (guide/article content) --------------------------------------- */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.4em; }
.prose .callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 0.9rem 1.1rem;
  margin: 1.4rem 0;
}
.prose .callout p:last-child { margin-bottom: 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1.2rem 0;
}
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  text-align: left;
}
.prose th { background: #f4f1e9; font-weight: 700; }
.prose .example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.8rem 0 1.2rem;
}
.prose .example-row span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.4rem 0.8rem;
  font-size: 1.05rem;
}

/* Trust/legal --------------------------------------------------------- */
.doc h2 { font-size: 1.25rem; margin-top: 1.8em; }

/* Footer -------------------------------------------------------------- */
.site-footer {
  background: var(--dark);
  color: #cfc7b8;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding: clamp(2.2rem, 5vw, 3.4rem) 0 1.6rem;
  font-size: 0.94rem;
}
.site-footer a { color: #ece5d7; }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(140px, 1fr));
  gap: 1.6rem 2rem;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer .brand { color: #f5f0e6; }
.site-footer .brand em { color: #9a917f; }
.footer-about p { color: #a79e8d; max-width: 34ch; margin-top: 0.7rem; }
.footer-col h4 {
  color: #f0eadf;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.45rem; }
.footer-bottom {
  border-top: 1px solid var(--dark-2);
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  justify-content: space-between;
  color: #8f8776;
  font-size: 0.85rem;
}

/* 404 ----------------------------------------------------------------- */
.err-page { text-align: center; padding: clamp(3rem, 10vw, 6rem) 0; }
.err-page .err-code {
  font-family: var(--font-display);
  font-size: clamp(4rem, 14vw, 7rem);
  color: var(--accent);
  line-height: 1;
  margin: 0;
}

/* Utilities ----------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
