/* Letras Bonitas — papel de fondo, escenario de tinta, fichas de plomo. */

:root {
  --ink: #14120e;
  --ink-soft: #3a342c;
  --muted: #5c564e;
  --paper: #f4efe6;
  --sheet: #fbf8f2;
  --cream: #f4efe6;
  --wax: #8c3a2f;
  --wax-deep: #6e2d24;
  --gold: #c4a46a;
  --on-ink: #f4efe6;
  --on-ink-soft: #ddd4c8;
  --line: rgba(20, 18, 14, 0.16);
  --line-strong: rgba(20, 18, 14, 0.38);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --move: 180ms ease-out;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255, 252, 247, 0.7), transparent 46%),
    repeating-linear-gradient(0deg, rgba(20, 18, 14, 0.018) 0 1px, transparent 1px 5px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--wax);
  color: var(--paper);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--wax-deep);
  text-decoration-color: rgba(196, 164, 106, 0.95);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--wax-deep);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1rem;
  z-index: 20;
  text-decoration: none;
}

.skip:focus {
  transform: none;
}

.wrap {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header,
.site-footer {
  width: min(72rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  min-height: 4rem;
  border-bottom: 1px solid rgba(196, 164, 106, 0.7);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.22rem, 1.7vw, 1.62rem);
  letter-spacing: -0.02em;
  line-height: 1;
  min-height: 44px;
}

.seal {
  position: relative;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  background: var(--wax);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--gold), inset 0 0 0 4px rgba(20, 18, 14, 0.28);
  transform: none;
  flex: none;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 0.38rem;
  border: 1px solid rgba(244, 239, 230, 0.8);
  border-radius: 50%;
}

.nav-desktop {
  display: none;
}

.nav-desktop a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: border-color var(--move), transform var(--move);
}

.nav-desktop a:hover {
  color: var(--wax-deep);
  border-bottom-color: var(--gold);
}

.nav-desktop a[aria-current="page"] {
  color: var(--wax-deep);
  border-bottom-color: var(--gold);
  box-shadow: none;
}

.nav-mobile summary {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  list-style: none;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.nav-mobile summary::-webkit-details-marker {
  display: none;
}

.nav-mobile nav {
  position: absolute;
  right: 0;
  z-index: 6;
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--gold);
  min-width: min(16rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.25rem 0;
  box-shadow: 4px 4px 0 rgba(140, 58, 47, 0.16);
}

.nav-mobile {
  position: relative;
}

.nav-mobile a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 1rem;
  color: var(--ink);
  text-decoration: none;
}

.nav-mobile a[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--gold);
  color: var(--wax-deep);
}

main {
  padding-bottom: 3rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.crumbs a {
  color: var(--ink-soft);
}

.crumbs [aria-current="page"] {
  color: var(--ink);
}

h1 {
  margin: 0.25rem 0 0.4rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.15rem);
  line-height: 0.94;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1::first-letter {
  color: var(--wax);
}

.lede {
  margin: 0 0 0.8rem;
  max-width: 36rem;
  font-size: 1.02rem;
  line-height: 1.45;
}

.lede::before {
  content: "";
  display: block;
  width: 2.75rem;
  height: 2px;
  margin-bottom: 0.5rem;
  background: var(--gold);
}

.stage {
  display: grid;
  gap: 1rem;
  padding-top: 0.15rem;
}

.stage-main,
.stage-side,
.tool,
.style,
.style-main {
  min-width: 0;
}

.tool {
  background: var(--ink);
  color: var(--on-ink);
  border: 1px solid rgba(196, 164, 106, 0.42);
  border-top: 3px solid var(--gold);
  box-shadow: 4px 4px 0 rgba(140, 58, 47, 0.28);
  padding: 0.8rem 0.8rem 0.95rem;
}

.tool-kicker,
.style-name,
.family,
.step-kicker,
.footer-label,
.meta-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.tool .tool-kicker {
  color: var(--gold);
}

label[for="entrada"] {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.28rem;
  color: var(--ink);
}

.tool label[for="entrada"] {
  color: var(--on-ink);
}

textarea {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0.2rem;
  padding: 0.3rem 0 0.45rem;
  border: 0;
  border-bottom: 2px solid var(--gold);
  border-radius: 0;
  background: transparent;
  color: var(--on-ink);
  caret-color: var(--gold);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 4.2vw, 2rem);
  line-height: 1.28;
  min-height: 3.6rem;
  resize: vertical;
}

textarea::placeholder {
  color: #c9bfb0;
  font-style: italic;
  opacity: 1;
}

textarea:focus-visible,
.tool .chip:focus-visible,
.tool .meta .text-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin: 0.4rem 0 0.65rem;
}

.hint {
  flex: 1 1 12rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.tool .hint,
.tool #nota-filtro,
.tool .empty,
.tool .noscript,
.tool .quiet,
.tool #contador {
  color: var(--on-ink-soft);
}

#contador {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  min-width: 4.5rem;
}

#contador.is-warn,
#contador.is-max {
  color: var(--wax-deep);
  font-weight: 600;
}

.tool #contador.is-warn,
.tool #contador.is-max {
  color: var(--gold);
}

.filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin: 0 0 0.55rem;
  padding: 0.35rem;
  border: 1px solid rgba(196, 164, 106, 0.55);
  background: rgba(244, 239, 230, 0.04);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  min-width: 0;
  scrollbar-width: thin;
  max-width: 100%;
}

button,
summary {
  font: inherit;
}

button {
  cursor: pointer;
}

.chip,
.text-btn,
.copy {
  min-height: 44px;
  border-radius: 0;
  transition: transform var(--move), border-color var(--move), opacity var(--move);
}

.chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 0 0.75rem;
  background: transparent;
  color: var(--on-ink);
  border: 1px solid rgba(244, 239, 230, 0.32);
  font-size: 0.86rem;
}

.chip:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.chip[aria-pressed="true"] {
  background: var(--wax);
  color: var(--paper);
  border-color: var(--gold);
  box-shadow: inset 0 -2px 0 var(--gold);
}

.text-btn {
  padding: 0 0.7rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
}

.tool .meta .text-btn {
  border-color: rgba(244, 239, 230, 0.32);
  color: var(--on-ink);
}

.tool .meta .text-btn:hover,
.tool .meta .text-btn[aria-pressed="true"] {
  color: var(--gold);
  border-color: var(--gold);
}

.copy {
  padding: 0 1rem;
  background: var(--wax);
  color: var(--paper);
  border: 1px solid var(--wax);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
}

.copy:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.copy.is-done {
  background: var(--ink);
  color: var(--gold);
  border-color: var(--gold);
}

.chip:active,
.copy:active {
  transform: translateY(0);
}

#nota-filtro,
.noscript,
.empty,
.quiet {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

#nota-filtro {
  margin: 0 0 0.75rem;
}

.family {
  margin: 1.05rem 0 0.45rem;
}

.tool .family,
.tool .saved-block h3 {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--on-ink);
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.08em;
}

.tool .family::after,
.tool .saved-block h3::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--gold);
}

.results-list,
.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.style {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border: 1px solid rgba(20, 18, 14, 0.14);
  border-left: 3px solid var(--wax);
  background: var(--sheet);
  color: var(--ink);
  padding: 0.7rem 0.8rem 0.65rem;
  cursor: pointer;
  transition: transform var(--move), border-color var(--move), box-shadow var(--move);
}

.style::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--gold);
}

.style:hover,
.style:focus-within {
  z-index: 1;
  border-color: var(--wax);
  transform: translateY(-3px);
}

.style.is-picked {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.style:has(.copy.is-done) {
  border-color: var(--gold);
  border-left-color: var(--wax);
  transform: translateY(-3px);
}

.style-name {
  margin-bottom: 0.05rem;
  color: var(--muted);
}

.style-out {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 3.6vw, 2.05rem);
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.results-list > .style:first-child .style-out {
  font-size: clamp(1.8rem, 4.4vw, 2.45rem);
}

.style-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.style-actions .text-btn {
  border-color: var(--line-strong);
  color: var(--ink);
}

.style-actions .text-btn:hover,
.style-actions .text-btn[aria-pressed="true"] {
  color: var(--wax-deep);
  border-color: var(--wax);
}

.style-actions .copy,
.style > .copy {
  flex: 1.35;
}

.style-actions .text-btn {
  flex: 0.8;
}

.saved-block {
  margin: 0.4rem 0 1rem;
}

.saved-block h3 {
  margin: 0.8rem 0 0.45rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
}

.stage-side h2 {
  margin: 0.2rem 0 0.45rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stage-side .ornament {
  margin: 0 0 0.15rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 3.25rem;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(140, 58, 47, 0.55);
  user-select: none;
  pointer-events: none;
}

.answer {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  line-height: 1.5;
}

.step-kicker {
  color: var(--wax-deep);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0 0.85rem;
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--wax);
  background: var(--sheet);
}

.steps li {
  padding: 0.75rem 0 0.75rem 0.15rem;
  border-bottom: 1px solid var(--line);
}

.steps li:last-child {
  border-bottom: 0;
}

.steps h3,
.prose h2,
.prose h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.steps h3 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
}

.steps p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.prose {
  max-width: 40rem;
  margin-top: 2.4rem;
}

.prose h2 {
  margin: 2.1rem 0 0.55rem;
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  font-style: italic;
}

.prose h2::before {
  content: "";
  display: block;
  width: 2.25rem;
  height: 2px;
  margin-bottom: 0.5rem;
  background: var(--gold);
}

.prose h3 {
  margin: 1.3rem 0 0.35rem;
  font-size: 1.25rem;
}

.prose p,
.prose li {
  font-size: 1.05rem;
}

.prose ul,
.prose ol {
  padding-left: 1.15rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.pairs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem 1rem;
  margin: 0.6rem 0 1rem;
}

.pairs dt {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
}

.pairs dd {
  margin: 0 0 0.75rem;
}

.faq {
  border-top: 1px solid var(--line);
}

.faq summary {
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 0;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary h3 {
  display: inline;
  margin: 0;
  font-size: 1.18rem;
}

.faq summary::after {
  content: "+";
  float: right;
  color: var(--wax);
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1;
}

.faq[open] summary::after {
  content: "–";
}

.faq[open] summary h3 {
  color: var(--wax-deep);
}

.faq p {
  margin: 0 0 1rem;
}

.callout {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--gold);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.15rem 0 2.2rem;
}

.footer-grid {
  display: grid;
  gap: 1.1rem;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-right: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--wax-deep);
}

.site-footer p,
.legal {
  margin: 0.3rem 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.legal {
  margin-top: 0.8rem;
  font-size: 0.82rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 699px) {
  .stage-side .ornament {
    display: none;
  }
}

@media (min-width: 700px) {
  .stage-side .ornament {
    font-size: clamp(4.5rem, 8vw, 6.5rem);
  }
}

@media (min-width: 720px) {
  .style:has(.style-main) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 1rem;
    align-items: center;
  }

  .style-actions {
    margin-top: 0;
    flex-direction: column;
    min-width: 7.4rem;
  }

  .style-actions .copy,
  .style-actions .text-btn {
    flex: none;
    width: 100%;
  }

  .pairs {
    grid-template-columns: 9.5rem minmax(0, 1fr);
  }

  .pairs dd {
    margin: 0 0 0.55rem;
  }
}

.use-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: -0.2rem 0 0.7rem;
  color: var(--wax-deep);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin: 0.35rem 0 0.7rem;
  padding: 0.55rem 0.7rem;
  min-height: 4.6rem;
  background: var(--sheet);
  color: var(--ink);
  border-left: 3px solid var(--gold);
}

.preview-main {
  flex: 1 1 12rem;
  min-width: 0;
}

.preview-kicker {
  margin: 0;
  color: var(--wax-deep);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}

.preview-out {
  margin: 0.1rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 4.2vw, 1.9rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 1.3em;
}

.preview .copy {
  flex: 1 1 7rem;
}

.nav-label {
  margin: 0.55rem 1rem 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 699px) {
  h1 {
    font-size: 1.85rem;
    margin-top: 0.2rem;
  }

  .lede {
    margin-bottom: 0.4rem;
    font-size: 0.98rem;
  }

  .tool {
    padding: 0.65rem 0.7rem 0.75rem;
  }

  textarea {
    min-height: 2.7rem;
    font-size: 1.35rem;
  }
}

@media (min-width: 960px) {
  .wrap,
  .site-header,
  .site-footer {
    width: min(72rem, calc(100% - 4rem));
  }

  h1 {
    font-size: clamp(3.15rem, 4.6vw, 4.6rem);
  }

  .lede {
    font-size: 1.12rem;
  }

  .nav-desktop {
    display: flex;
    gap: 1.05rem;
    align-items: center;
  }

  .nav-mobile {
    display: none;
  }

  .stage {
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    column-gap: 2.75rem;
    align-items: start;
  }

  .tool {
    padding: 1.05rem 1.15rem 1.1rem;
  }

  .filters {
    flex-wrap: wrap;
    overflow: visible;
  }

  .footer-grid {
    grid-template-columns: 1.15fr 1fr 1fr 0.85fr;
  }
}

@media (min-width: 1100px) {
  .results-list {
    grid-template-columns: 1fr 1fr;
  }

  .results-list > .style:first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) and (min-height: 760px) {
  .stage-side {
    position: sticky;
    top: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (forced-colors: active) {
  .tool,
  .style,
  .chip,
  .copy,
  .steps {
    border: 1px solid CanvasText;
  }

  .seal {
    background: CanvasText;
    box-shadow: none;
  }
}

@media print {
  .nav-mobile,
  .nav-desktop,
  .filters,
  .style-actions,
  .meta .text-btn,
  .stage-side {
    display: none !important;
  }

  body,
  .tool,
  .style {
    background: #fff;
    color: #000;
    box-shadow: none;
  }

  .tool,
  .tool label,
  .tool textarea,
  .tool .family,
  .tool .hint,
  .tool #nota-filtro,
  .style-out {
    color: #000;
  }
}
