/**
 * Ana Maleno — theme styles that theme.json cannot express.
 * Design reference: 1440px desktop mockup.
 */

/* ---------- Base ---------- */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Line heights paired with each size of the type scale. */
.has-xxs-font-size {
  line-height: 1.2143;
}
.has-xs-font-size {
  line-height: 1.3333;
}
.has-s-font-size {
  line-height: 1.3333;
}
.has-m-font-size {
  line-height: 1.2;
}
.has-ml-font-size {
  line-height: 1.25;
}
.has-l-font-size {
  line-height: 1.2143;
}
.has-xl-font-size {
  line-height: 1.2;
}
.has-xxl-font-size {
  line-height: 1.2222;
}
.has-xxxl-font-size {
  line-height: 1.2;
}
.has-display-font-size {
  line-height: 1;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* Visible focus for keyboard users on every background. */
:where(a, button, summary, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--wp--preset--color--navy);
  outline-offset: 3px;
  border-radius: 2px;
}

:where(.has-navy-background-color, .has-teal-background-color)
  :where(a, button, summary):focus-visible {
  outline-color: var(--wp--preset--color--base);
}

.ma-arrow {
  display: inline-block;
  margin-left: 0.3em;
  transition: transform 0.2s ease;
}

a:hover .ma-arrow,
a:focus-visible .ma-arrow,
button:hover .ma-arrow,
button:focus-visible .ma-arrow {
  transform: translateX(4px);
}

.wp-element-button {
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* ---------- Header ---------- */

.ma-header .ma-nav a {
  text-decoration: none;
}

.ma-header .ma-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.ma-header .ma-nav-cta > a {
  background: var(--wp--preset--color--coral);
  color: var(--wp--preset--color--navy);
  border-radius: 999px;
  padding: 0.65rem 1.6rem;
}

.ma-header .ma-nav-cta > a:hover {
  background: var(--wp--preset--color--navy);
  color: var(--wp--preset--color--base);
  text-decoration: none;
}

.wp-block-navigation__responsive-container.is-menu-open .ma-nav-cta > a {
  display: inline-block;
}

/* Mobile overlay: CTA as plain coral text, no pill. */
.ma-header .is-menu-open .ma-nav-cta > a,
.ma-header .is-menu-open .ma-nav-cta > a:hover {
  background: none;
  color: var(--wp--preset--color--coral);
  padding: 0;
  border-radius: 0;
}

/* Header (main and sticky): wide width from theme.json (1286px). */
.wp-site-blocks .ma-header {
  max-width: var(--wp--style--global--wide-size, 1286px);
  margin-left: auto;
  margin-right: auto;
}

.wp-site-blocks .ma-header.is-layout-constrained > * {
  max-width: none;
}

/* Mobile header (.header-mobile): always stuck to the top, no slide effect.
   The template part wrapper is flattened so sticky works across the whole page. */
.wp-site-blocks > .wp-block-template-part:has(.header-mobile) {
  display: contents;
}

body:not(.editor-styles-wrapper) .ma-header.header-mobile {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 100;
}

@media (max-width: 600px) {
  .admin-bar .ma-header.header-mobile {
    top: 0;
  }
}

/* Sticky header: a second header (.header-sticky) slides down from the top on scroll. */
body:not(.editor-styles-wrapper) .ma-header.header-sticky {
  position: fixed;
  top: var(--wp-admin--admin-bar--height, 0px);
  left: 0;
  right: 0;
  z-index: 100;
  margin: 0 !important;
  /* White background spans the viewport; content keeps the wide width. */
  max-width: none;
  padding-left: max(
    var(--wp--style--root--padding-left, 2rem),
    calc(
      (100% - var(--wp--style--global--wide-size, 1286px)) / 2 +
        var(--wp--style--root--padding-left, 2rem)
    )
  ) !important;
  padding-right: max(
    var(--wp--style--root--padding-right, 2rem),
    calc(
      (100% - var(--wp--style--global--wide-size, 1286px)) / 2 +
        var(--wp--style--root--padding-right, 2rem)
    )
  ) !important;
  transform: translateY(calc(-100% - var(--wp-admin--admin-bar--height, 0px)));
  visibility: hidden;
  transition:
    transform 0.35s ease,
    visibility 0s linear 0.35s;
  box-shadow: 0 2px 12px rgb(4 1 4 / 0.08);
}

.ma-scrolled body:not(.editor-styles-wrapper) .ma-header.header-sticky {
  transform: translateY(0);
  visibility: visible;
  transition:
    transform 0.35s ease,
    visibility 0s;
}

/* Below 600px the admin bar scrolls away with the page. */
@media (max-width: 600px) {
  .admin-bar .ma-header.header-sticky {
    top: 0;
  }
}

/* While the mobile menu is open, the fixed header must not trap the overlay. */
.ma-header.header-sticky:has(.is-menu-open) {
  transform: none;
  transition: none;
}

/* Logo hidden at the top, fades in once the page scrolls (.ma-scrolled from header.js). */
.header-logo,
.header-mobile-logo {
  transition: opacity 0.3s ease;
}

html:not(.ma-scrolled) .header-mobile-logo {
  opacity: 0;
  pointer-events: none;
}

/* Mobile menu toggles: icons from the design (rounded strokes). */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
  width: 44px;
  height: 44px;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.wp-block-navigation__responsive-container-open svg,
.wp-block-navigation__responsive-container-close svg {
  display: none;
}

.wp-block-navigation__responsive-container-open::before,
.wp-block-navigation__responsive-container-close::before {
  content: "";
  display: block;
  background-color: var(--wp--preset--color--coral);
  -webkit-mask: var(--ma-toggle-icon) center / contain no-repeat;
  mask: var(--ma-toggle-icon) center / contain no-repeat;
}

.wp-block-navigation__responsive-container-open::before {
  width: 28px;
  height: 23px;
  --ma-toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 17'%3E%3Cpath d='M1.5 1.5H19.5M1.5 8.5H19.5M1.5 15.5H19.5' stroke='%23000' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}

.wp-block-navigation__responsive-container-close::before {
  width: 22px;
  height: 22px;
  --ma-toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Cpath d='M1.5 1.5L15.5 15.5M15.5 1.5L1.5 15.5' stroke='%23000' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}

.wp-block-navigation__responsive-container-open:hover::before,
.wp-block-navigation__responsive-container-close:hover::before {
  background-color: var(--wp--preset--color--navy);
}

/* Back to top button (created by header.js). */
.ma-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--wp--preset--color--coral);
  color: var(--wp--preset--color--ink);
  box-shadow: 0 2px 10px rgb(4 1 4 / 0.15);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0s linear 0.3s,
    background-color 0.2s ease;
}

.ma-show-top .ma-to-top {
  opacity: 0.85;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0s,
    background-color 0.2s ease;
}

.ma-to-top:hover,
.ma-to-top:focus-visible {
  opacity: 1;
  background: var(--wp--preset--color--teal);
  color: var(--wp--preset--color--ink);
}

/* ---------- Sticky footer: short pages still push the footer to the bottom ---------- */

.wp-site-blocks {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
  min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}

.wp-site-blocks > :last-child {
  margin-top: auto;
}

/* ---------- Hero ---------- */

/* Logo sits at the bottom of the band (constrained + bottom alignment is not available in the editor). */
.ma-hero__band {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.ma-hero__band > .ma-hero__logo {
  width: 100%;
  position: relative;
  z-index: 1;
}

.ma-hero__logo img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- Sections ---------- */

.ma-section {
  position: relative;
}

.ma-kicker a {
  text-decoration: none;
}

.ma-kicker a:hover,
.ma-kicker a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.ma-illustration {
  line-height: 0;
  pointer-events: none;
}

.ma-illustration__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* ---------- About ---------- */

/* The circle is a regular Image block; the character sits on its edge. */
.ma-about__art {
  position: relative;
  aspect-ratio: 485 / 507;
}

.ma-about__art .ma-illustration--anim-1 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  margin: 0 !important;
}

.ma-about__art .wp-block-image {
  width: 95.05%; /* 461 / 485: same box as the original ring */
  margin: 9.4% 0 0 !important; /* 45.6 / 485 */
}

.ma-about__art .wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
}

/* ---------- CTA ---------- */

.ma-cta__text h2 {
  max-width: 620px;
}

.ma-cta .ma-btn-light .wp-block-button__link:hover {
  background: var(--wp--preset--color--navy) !important;
  color: var(--wp--preset--color--base) !important;
}

/* ---------- Collaborations ---------- */

.ma-collabs__cols {
  justify-content: space-between;
}

.ma-collabs__text {
  position: relative;
}

.ma-collabs__art {
  position: absolute;
  top: -32px;
  left: 369px;
  width: 205px;
  margin: 0 !important;
}

.ma-collabs__list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ma-collab {
  --ma-collab-logo-w: 141px;
  --ma-collab-logo-h: 112px;
  position: relative;
  /* Padding/border are tied to the absolute logo (top/left 8px). */
  border: 1px solid var(--ma-collab-soft);
  border-radius: 6px;
  padding: 8px !important;
  margin: 0 !important;
  overflow: hidden;
}

/* The logo sits over the summary so the open panel can span the full card width. */
.ma-collab__logo {
  position: absolute;
  top: 8px;
  left: 8px;
  margin: 0;
  pointer-events: none;
}

.ma-collab__logo img {
  display: block;
  width: var(--ma-collab-logo-w);
  height: var(--ma-collab-logo-h);
  object-fit: contain;
  background: var(--wp--preset--color--base);
  border-radius: 6px;
  padding: 6px;
  box-sizing: border-box;
}

.ma-collab__details {
  flex: 1;
  margin: 0;
}

.ma-collab__details summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-height: var(--ma-collab-logo-h);
  padding: 0 3.5rem 0 calc(var(--ma-collab-logo-w) + 1.3rem);
  font-size: var(--wp--preset--font-size--m);
  line-height: 1.4;
  color: var(--wp--preset--color--ink);
}

.ma-collab__details summary::-webkit-details-marker {
  display: none;
}

.ma-collab__details summary br {
  display: none;
}

.ma-collab__details summary strong {
  font-size: var(--wp--preset--font-size--ml);
  line-height: 1.25;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

/* Plus icon that turns into a minus when the panel is open. */
.ma-collab__details summary::before,
.ma-collab__details summary::after {
  content: "";
  position: absolute;
  right: 1.6rem;
  top: 50%;
  width: 30px;
  height: 3px;
  margin-top: -1.5px;
  background: currentColor;
  color: var(--ma-collab-accent);
  transition: transform 0.2s ease;
}

.ma-collab__details summary::after {
  transform: rotate(90deg);
}

.ma-collab__details[open] summary::after {
  transform: rotate(0deg);
}

.ma-collab--teal {
  --ma-collab-accent: var(--wp--preset--color--teal);
  --ma-collab-soft: var(--wp--preset--color--teal-soft);
}

.ma-collab--coral {
  --ma-collab-accent: var(--wp--preset--color--coral);
  --ma-collab-soft: var(--wp--preset--color--peach);
}

/* Open panel: light band under the header, full card width. */
.ma-collab__details[open] {
  margin-bottom: -8px;
}

.ma-collab__details[open] summary {
  margin-bottom: 8px;
}

.ma-collab__details > :not(summary) {
  margin: 0 -8px;
  padding: 1rem 1.25rem 0.25rem;
  background: var(--wp--preset--color--base);
  color: var(--wp--preset--color--ink);
  line-height: 1.6;
}

.ma-collab__details > :not(summary):last-child {
  padding-bottom: 1.5rem;
}

.ma-collab__details > :not(summary) a {
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* ---------- Projects ---------- */

.ma-projects {
  overflow-x: clip;
}

.ma-projects__art {
  position: absolute;
  top: 0;
  right: 0;
  width: min(798px, 55vw);
  margin: 0 !important;
  max-width: none !important;
}

.ma-projects__intro {
  position: relative;
}

.ma-projects__grid {
  position: relative;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(17rem, 100%), 1fr)
  ) !important;
}

.ma-project {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--wp--preset--color--base);
  border: 2px solid var(--wp--preset--color--teal);
  border-radius: 12px;
  box-shadow: var(--wp--custom--shadow--card);
  padding: 14px 14px 12px;
}

/* Query Loop cards: equal heights; characters only on card 1 (party) and card 3 (bulb). */
.ma-projects__grid > .wp-block-post > .ma-project {
  height: 100%;
}

.ma-projects__grid
  > .wp-block-post:not(:nth-child(1))
  .ma-project__head
  .ma-illustration--anim-7,
.ma-projects__grid > .wp-block-post:not(:nth-child(3)) .ma-project__art {
  display: none;
}

.ma-project__media img {
  display: block;
  width: 100%;
}

.ma-project > * {
  margin-block: 0;
}

.ma-project__media {
  aspect-ratio: 342 / 210;
  background: var(--wp--preset--color--placeholder);
  border-radius: 8px;
}

.ma-project__head {
  gap: 0.75rem;
  margin-top: 1rem !important;
}

.ma-project__logo {
  flex: 0 0 auto;
  margin: 0;
}

.ma-project__logo img {
  width: auto;
  max-width: 100px;
  height: 72px;
  object-fit: contain;
  display: block;
}

.ma-project__title a {
  text-underline-offset: 0.12em;
}

.ma-project__titles > * {
  margin: 0;
}

.ma-project__title {
  color: var(--wp--preset--color--ink);
  line-height: 1.3;
}

.ma-project__text {
  margin-top: 1rem !important;
  flex-grow: 1;
}

.ma-project__link {
  margin-top: 1.3rem !important;
  font-weight: 700;
}

/* Whole card is clickable: the "Ver proyecto" link stretches over the card. */
a.ma-project__link::after,
.ma-project__link a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}

.ma-project {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ma-project:has(.ma-project__link:hover),
.ma-project:has(.ma-project__link a:hover) {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(20, 65, 119, 0.22);
}

/* Keyboard focus outlines the whole card. */
.ma-project__link:focus-visible,
.ma-project__link a:focus-visible {
  outline: none;
}

.ma-project:has(.ma-project__link:focus-visible),
.ma-project:has(.ma-project__link a:focus-visible) {
  outline: 3px solid var(--wp--preset--color--navy);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .ma-project:has(.ma-project__link:hover),
  .ma-project:has(.ma-project__link a:hover) {
    transform: none;
  }
}

/* Party character (anim-7): sits at the end of the logo + title row. */
.ma-project__head .ma-illustration--anim-7 {
  flex: 0 0 65px;
  width: 65px;
  margin: -0.5rem 2rem 0 auto !important;
}

.ma-project__art {
  position: absolute;
  right: -30px;
  bottom: -26px;
  width: 91px;
  margin: 0 !important;
}

/* ---------- Contact ---------- */

.ma-contact__cols {
  justify-content: space-between;
}

.ma-contact__art {
  width: 75px;
  margin: -0.5rem 0 0 !important;
}

.ma-social--lg .wp-social-link svg {
  width: 55px;
  height: 55px;
}

.ma-social--sm .wp-social-link svg {
  width: 32px;
  height: 32px;
}

.ma-social .wp-social-link a {
  padding: 0;
}

.ma-social .wp-social-link:hover {
  transform: translateY(-2px);
}

.ma-contact__form {
  position: relative;
}

.ma-contact__peek {
  position: absolute;
  top: 30px;
  left: calc(100% + 10px);
  width: 73px;
  margin: 0 !important;
}

/* ---------- Footer ---------- */

.ma-footer__logo {
  margin: 0;
}

.ma-footer__logo img {
  max-width: 100%;
  height: auto;
}

.ma-footer__about > * {
  max-width: 560px;
}

.ma-footer__menu a,
.ma-footer__legal a {
  text-underline-offset: 0.15em;
}

.ma-footer__menu a:hover,
.ma-footer__legal a:hover {
  text-decoration: none !important;
}

.footer-email-icon,
.footer-email-icon svg {
  width: 38px !important;
  height: 38px !important;
}

.ma-footer__rule {
  width: 100%;
  border: 0;
  height: 2px;
  opacity: 1;
}

/* Proyects: phone screenshots overlap the big image on tablet and desktop only. */
@media (min-width: 782px) {
  .proyecto-mobile-image {
    position: absolute;
    z-index: 1;
  }
  .proyecto-mobile-image.right {
    right: 0;
    bottom: -10%;
  }
  .proyecto-mobile-image.left {
    left: 0;
    bottom: -5%;
  }
}

/* Mobile: phone screenshots centered. */
@media (max-width: 781px) {
  .proyecto-mobile-image {
    width: fit-content;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .ma-collabs__art {
    left: auto;
    right: 0;
  }
}

@media (max-width: 781px) {
  .ma-hero__band {
    min-height: 300px !important;
  }

  .ma-hero__logo img {
    width: 70vw !important;
  }

  .ma-about__art {
    max-width: 340px;
    width: 100%;
  }

  .ma-collabs__list {
    padding-top: 0 !important;
  }

  .ma-contact__peek {
    display: none;
  }

  .ma-hero__role {
    letter-spacing: 0.15em !important;
  }

  .ma-project__art {
    right: -6px;
    width: 72px;
  }

  .ma-contact__text {
    margin-bottom: 2rem;
  }

  .ma-collab {
    --ma-collab-logo-w: 96px;
    --ma-collab-logo-h: 80px;
  }

  .ma-collab__details summary {
    padding-right: 3rem;
    font-size: var(--wp--preset--font-size--s);
  }

  .ma-collab__details summary strong {
    font-size: var(--wp--preset--font-size--m);
  }

  .ma-collab__details summary::before,
  .ma-collab__details summary::after {
    right: 1rem;
    width: 24px;
  }
}

/* Respect users who prefer less motion (animations will hook in here). */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
