/*
 * Base styles: a small reset plus sensible defaults for raw HTML elements.
 * Design tokens live in variables.css; reusable UI pieces live in
 * components/; page-specific layout lives in views/.
 *
 * Propshaft's `stylesheet_link_tag :app` loads every file in this folder,
 * so new files are picked up automatically.
 */

/* ---------- Reset ---------- */

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

* {
  margin: 0;
}

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

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  font-feature-settings: "cv11", "ss01"; /* Inter: nicer 'a' and digits */
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* ---------- Typography ---------- */

h1,
h2,
h3,
h4 {
  color: var(--color-text);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  text-wrap: balance;
}

/* Page titles in the brand's display face (the same as tuka.vet); everything else stays in Inter */
h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.025em;
}
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
  text-wrap: pretty;
}

small {
  font-size: var(--text-xs);
}

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

a {
  color: var(--color-primary-text);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

hr {
  border: 0;
  border-top: var(--border);
}

::selection {
  background: var(--color-primary-subtle-hover);
}

/* ---------- Accessibility ---------- */

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Visually hidden but still read by screen readers */
.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;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Small utilities ---------- */

.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
/* Text typed in a textarea, its own line breaks kept */
.text-lines { white-space: pre-line; }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Buttons or links side by side that wrap onto the next line in a narrow column, the same gap both ways (a card's
   footer in the right column: "Enviar contrato de adopción" and "Ofrecer a otra persona") */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ---------- Layout helpers (feline-control) ---------- */

/* Forms and settings pages: a readable column instead of the full width, on the left as every other page starts.
   Its title row shares the column, so its buttons ("Borrar") sit over the card's edge, not across the screen. Only
   a .narrow-page that is the page itself (> ): the calendar's modal loads appointment forms into its own page */
.narrow-page,
.app-content:has(> .narrow-page) > .page-header {
  max-width: 40rem;
}

/* The error list inside an .alert at the top of a form */
.form-errors {
  padding-left: var(--space-4);
}

/* Cancel + Save at the foot of a form card */
.form-actions {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* A heading that splits a long form into parts ("Change password") */
.form-section-title {
  margin-top: var(--space-4);
  font-size: var(--text-md);
}

/* The hidden attribute always hides, even on elements whose class sets display (flex, grid…).
   reveal_controller.js and others rely on it */
[hidden] {
  display: none !important;
}
