/* Reset y elementos base del theme Capello. */

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

html {
  color-scheme: light;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-block-size: 100vh;
  min-block-size: 100dvh;
  margin: 0;
  background: var(--bg-page);
  color: var(--fg-base);
  font-family: var(--f-body);
  font-size: var(--t-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:where(h1, h2, h3, h4, h5, h6, p, ul, ol) {
  margin-block-start: 0;
}

:where(h1, h2, h3, h4, h5, h6) {
  color: var(--fg-base);
  font-family: var(--f-display);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-display);
}

h1 {
  margin-block-end: var(--s-5);
  font-size: var(--t-h1);
  line-height: var(--lh-tight);
}

h2 {
  margin-block-end: var(--s-4);
  font-size: var(--t-h2);
  line-height: var(--lh-heading);
}

:where(h3, h4, h5, h6) {
  margin-block-end: var(--s-3);
  font-size: var(--t-h3);
  line-height: var(--lh-heading);
}

p {
  margin-block-end: var(--s-4);
}

.cap-prose p {
  max-inline-size: var(--w-prose);
}

:where(ul, ol) {
  margin-block-end: var(--s-4);
  padding-inline-start: var(--s-5);
}

:where(ul:not([class]), ol:not([class])) > li + li {
  margin-block-start: var(--s-2);
}

a {
  color: var(--c-violeta);
  text-decoration-color: var(--c-dorado);
  text-underline-offset: var(--s-1);
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--c-violeta-soft);
}

:where(img, picture, svg, video, canvas) {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

:where(button, input[type="button"], input[type="reset"], input[type="submit"]),
.cap-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: var(--r-pill);
  min-block-size: 50px;
  padding: var(--s-4) var(--s-7);
  background: var(--c-violeta);
  color: var(--c-crema);
  cursor: pointer;
  font-family: var(--f-body);
  font-size: var(--t-body);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  text-decoration: none;
  transition:
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

:where(button, input[type="button"], input[type="reset"], input[type="submit"]):hover,
.cap-btn-primary:hover {
  background: var(--c-violeta-soft);
  color: var(--c-crema);
  box-shadow: var(--sh-raised);
  transform: translateY(-1px);
}

:where(button, input[type="button"], input[type="reset"], input[type="submit"]):focus-visible,
.cap-btn-primary:focus-visible {
  outline: 2px solid var(--c-dorado);
  outline-offset: 2px;
}

:where(button, input[type="button"], input[type="reset"], input[type="submit"]):disabled,
.cap-btn-primary.is-disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

:where(input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]), select) {
  inline-size: 100%;
  max-inline-size: 100%;
  border: thin solid var(--border-base);
  border-radius: var(--r-pill);
  padding: var(--s-3) var(--s-5);
  background: var(--bg-surface);
  color: var(--fg-base);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

textarea {
  inline-size: 100%;
  max-inline-size: 100%;
  border: thin solid var(--border-base);
  border-radius: var(--r-card);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface);
  color: var(--fg-base);
  font: inherit;
  min-block-size: var(--s-10);
  resize: vertical;
  appearance: none;
  -webkit-appearance: none;
}

/* Safari input type="search" webkit overrides */
input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

/* Normalización de Autofill en WebKit/Safari */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--fg-base);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-surface) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

::placeholder {
  color: var(--fg-muted);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--c-violeta);
  outline-offset: var(--s-1);
}

:where(code, kbd, samp, pre, time) {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
}

small {
  font-size: var(--t-small);
}

[hidden] {
  display: none !important;
}

.cap-skip-link {
  position: fixed;
  inset-block-start: var(--s-3);
  inset-inline-start: var(--s-3);
  z-index: var(--z-overlay);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--fg-base);
  transform: translateY(calc(-100% - var(--s-5)));
}

.cap-skip-link:focus-visible {
  transform: translateY(0);
}

.cap-container {
  inline-size: 100%;
  max-inline-size: var(--w-max);
  margin-inline: auto;
  padding-inline: var(--w-gutter);
}

.cap-site-main {
  padding-block: var(--s-7);
}

:where(.cap-site-main > article:not([class]) + article:not([class]), .cap-prose article + article) {
  margin-block-start: var(--s-7);
}

/* Offset para anclas evitando que el header sticky tape títulos */
:target {
  scroll-margin-top: calc(var(--s-8) + var(--s-4));
}

/* Prevención de auto-zoom molesto de iOS Safari en inputs con font-size < 16px */
@media (max-width: 48rem) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Utilidad de accesibilidad: solo visible para lectores de pantalla */
.cap-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}
