/**
 * advent.studio block styles for the WordPress block editor.
 *
 * Moved from the ALPS theme (resources/styles/blocks.css) into the plugin's
 * Gutenberg module: the plugin owns the look, the theme only the structure.
 * Loaded on the front end (after `alps-main` when the ALPS theme is active, so
 * it wins on equal specificity) and inside the block editor canvas.
 *
 * Every color comes from the theme.json palette (`--wp--preset--color--*`), so
 * these styles follow whatever theme provides the palette (ALPS rewrites it
 * with the active color theme; advent-lite ships the same slugs). The
 * fallbacks are the `ming` tones, so the sheet also reads well on a theme
 * without those presets. Class names keep the `is-style-alps-*` prefix: they
 * are stored in post content and must not change.
 */

/* --------------------------------------------------------------------------
 * Guards: ALPS article rules that collide with core block markup
 * ----------------------------------------------------------------------- */

/* `.text a` underlines every link with a black border; buttons are links. */
.text .wp-block-button__link,
.text .wp-element-button,
.text .wp-block-file__button,
.text .wp-block-image a,
.text .wp-block-post-title a {
  border-bottom: 0;
}

/* `.text > p` adds side padding to paragraphs that are direct children of the
 * article. Inside a styled group the group already provides the padding. */
.text [class*="is-style-alps-"] p,
.text [class*="is-style-alps-"] h2,
.text [class*="is-style-alps-"] h3 {
  padding-left: 0;
  padding-right: 0;
}

/* Images never overflow the 6/7 content column. */
.wp-block-image img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
 * core/group
 * ----------------------------------------------------------------------- */

/* Tarjeta: white card with soft shadow, as on umi.org.mx. */
.wp-block-group.is-style-alps-card {
  background-color: var(--adv-surface-raised, #fff);
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06), 0 0.5rem 1.5rem rgba(0, 0, 0, 0.08);
  padding: var(--wp--preset--spacing--50, 2.5rem) var(--wp--preset--spacing--40, 1.25rem);
  overflow: hidden;
}

.wp-block-group.is-style-alps-card > .wp-block-image:first-child {
  margin: calc(-1 * var(--wp--preset--spacing--50, 2.5rem)) calc(-1 * var(--wp--preset--spacing--40, 1.25rem)) var(--wp--preset--spacing--40, 1.25rem);
}

.wp-block-group.is-style-alps-card > .wp-block-image:first-child img {
  border-radius: 0;
}

.wp-block-group.is-style-alps-card > :last-child {
  margin-bottom: 0;
}

/* Caja destacada: primary left border on a light-gray panel. */
.wp-block-group.is-style-alps-highlight {
  background-color: var(--wp--preset--color--light-gray, #f2f4f5);
  border-left: 0.25rem solid var(--wp--preset--color--primary, #007f98);
  padding: var(--wp--preset--spacing--40, 1.25rem) var(--wp--preset--spacing--40, 1.25rem) var(--wp--preset--spacing--40, 1.25rem) var(--wp--preset--spacing--50, 2.5rem);
}

/* Franja: darker band with white text, links and buttons. */
.wp-block-group.is-style-alps-band {
  background-color: var(--wp--preset--color--darker, #002938);
  color: #fff;
  padding: var(--wp--preset--spacing--60, 3.75rem) var(--wp--preset--spacing--40, 1.25rem);
}

.wp-block-group.is-style-alps-band :where(h1, h2, h3, h4, h5, h6, p, li, figcaption, cite) {
  color: inherit;
}

.wp-block-group.is-style-alps-band a:not(.wp-element-button) {
  color: var(--wp--preset--color--lighter, #9ae1f0);
  border-bottom-color: currentColor;
}

.wp-block-group.is-style-alps-band .wp-block-button:not(.is-style-alps-arrow) .wp-block-button__link {
  background-color: #fff;
  color: var(--wp--preset--color--darker, #002938);
}

.wp-block-group.is-style-alps-band .wp-block-button.is-style-alps-arrow .wp-block-button__link {
  color: var(--wp--preset--color--lighter, #9ae1f0);
}

/* --------------------------------------------------------------------------
 * core/quote
 * ----------------------------------------------------------------------- */

.wp-block-quote.is-style-alps-quote {
  border-left: 0.1875rem solid var(--wp--preset--color--primary, #007f98);
  margin-left: 0;
  margin-right: 0;
  padding: var(--wp--preset--spacing--30, 0.625rem) 0 var(--wp--preset--spacing--30, 0.625rem) var(--wp--preset--spacing--50, 2.5rem);
  position: relative;
}

.wp-block-quote.is-style-alps-quote::before {
  content: "\201C";
  position: absolute;
  top: -0.25rem;
  left: 0.75rem;
  font-family: "Noto Serif", Georgia, Times, "Times New Roman", serif;
  font-size: 3rem;
  line-height: 1;
  color: var(--wp--preset--color--primary, #007f98);
}

/* ALPS' global `blockquote p` adds a 3.75rem left padding for its own quote
 * mark; the style above draws its own. */
.wp-block-quote.is-style-alps-quote p {
  font-family: "Noto Serif", Georgia, Times, "Times New Roman", serif;
  font-size: var(--wp--preset--font-size--medium, 1.25rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  color: var(--wp--preset--color--darker, #002938);
  margin-top: 0;
  padding: 0;
}

.wp-block-quote.is-style-alps-quote cite {
  display: block;
  margin-top: var(--wp--preset--spacing--30, 0.625rem);
  font-family: "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 0.8125rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wp--preset--color--dark-gray, #7e7f80);
}

/* --------------------------------------------------------------------------
 * core/button
 * ----------------------------------------------------------------------- */

/* Botón ALPS: the `.o-button` look (pill, uppercase, bold). */
.wp-block-button.is-style-alps-primary .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8125rem 1.25rem 0.75rem;
  border: 1px solid var(--wp--preset--color--primary, #007f98);
  border-radius: 3.125rem;
  background-color: var(--wp--preset--color--primary, #007f98);
  color: var(--adv-on-primary, #fff);
  font-family: "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.3s ease-out, border-color 0.3s ease-out;
}

.wp-block-button.is-style-alps-primary .wp-block-button__link:hover,
.wp-block-button.is-style-alps-primary .wp-block-button__link:focus-visible {
  background-color: var(--wp--preset--color--darker, #002938);
  border-color: var(--wp--preset--color--darker, #002938);
  color: var(--adv-on-primary, #fff);
}

/* Enlace con flecha: text link in the primary tone followed by an arrow. */
.wp-block-button.is-style-alps-arrow .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--wp--preset--color--primary, #007f98);
  font-family: "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  text-decoration: none;
}

.wp-block-button.is-style-alps-arrow .wp-block-button__link::after {
  content: "\2192";
  transition: transform 0.2s ease-out;
}

.wp-block-button.is-style-alps-arrow .wp-block-button__link:hover::after,
.wp-block-button.is-style-alps-arrow .wp-block-button__link:focus-visible::after {
  transform: translateX(0.25rem);
}

.wp-block-button.is-style-alps-arrow .wp-block-button__link:hover {
  color: var(--wp--preset--color--darker, #002938);
}

/* --------------------------------------------------------------------------
 * core/image
 * ----------------------------------------------------------------------- */

.wp-block-image.is-style-alps-16-9 img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
}

.wp-block-image.is-style-alps-16-9 figcaption {
  margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
 * Pattern helpers (advent-studio patterns, core blocks only)
 * ----------------------------------------------------------------------- */

/* Equal-height cards in the 3-column patterns. */
.wp-block-columns.alps-cards > .wp-block-column,
.wp-block-columns.alps-downloads > .wp-block-column {
  display: flex;
}

.wp-block-columns.alps-cards > .wp-block-column > .is-style-alps-card,
.wp-block-columns.alps-downloads > .wp-block-column > .is-style-alps-card {
  flex: 1 1 auto;
}

/* Downloads gallery: the "Descargar" button sits at the bottom of each card. */
.wp-block-columns.alps-downloads > .wp-block-column > .is-style-alps-card {
  display: flex;
  flex-direction: column;
}

.wp-block-columns.alps-downloads > .wp-block-column > .is-style-alps-card > .wp-block-buttons {
  margin-top: auto;
  padding-top: var(--wp--preset--spacing--30, 0.625rem);
}

.alps-downloads .alps-file-meta {
  font-family: "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wp--preset--color--dark-gray, #7e7f80);
}
