/* ---------- Public pages (layouts/public): the report form and the legal pages ---------- */

.public {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.public-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border);
  background: var(--color-surface);

  .locale-switcher {
    margin: 0;
  }
}

.public-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  text-decoration: none;

  .brand-mark {
    width: 2rem;
    height: 2rem;
  }
}

.public-header__logo {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
}

.public-main {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.public-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-top: var(--border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);

  nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
  }
}

/* "¿Quieres ser casa de acogida?": a line of its own, above the town hall's name and the legal links */
.public-footer__foster {
  flex-basis: 100%;
  font-weight: var(--weight-medium);

  a {
    color: var(--color-primary-text);
  }
}

/* The report kinds as big tappable cards */
.kind-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: var(--space-2);
}

.kind-choice__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.kind-choice {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  height: 100%;
  padding: var(--space-3);
  border: var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  font-size: var(--text-sm);
}

.kind-choice__title {
  font-weight: var(--weight-semibold);
}

.kind-choice__hint {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.kind-choice__input:checked + .kind-choice {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
  background: var(--color-primary-subtle);
}

.kind-choice__input:focus-visible + .kind-choice {
  box-shadow: var(--focus-ring);
}

/* Robots fill in every field; people never see this one (PublicReportsController) */
.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Long text pages: privacy notice, accessibility statement */
.prose {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  line-height: var(--leading-relaxed, 1.6);

  h2 {
    margin-top: var(--space-4);
    font-size: var(--text-lg);
  }

  ul {
    padding-left: var(--space-5);
  }
}

.reference-box {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary-subtle);
  color: var(--color-primary-text);
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  text-align: center;
}

/* A checkbox with a sentence next to it (the privacy consent) */
.check-line {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);

  /* Level with the first line of the sentence (components/form.css draws the box) */
  input {
    margin-top: 0.125rem;
  }
}

/* ---------- The public section's navigation and pages ---------- */

.public-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  width: 100%;
  font-size: var(--text-sm);

  a {
    padding: var(--space-1) 0;
    color: var(--color-text-muted);
    text-decoration: none;
  }

  a:hover,
  a[aria-current="page"] {
    color: var(--color-text);
  }

  a[aria-current="page"] {
    font-weight: var(--weight-semibold);
    text-decoration: underline;
    text-underline-offset: 0.3em;
  }
}

.public-main--wide {
  max-width: 68rem;
}

.public-hero {
  max-width: 40rem;
}

/* The list's title, with "Recibir avisos" in the corner; below the title when there's no room for both */
.public-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}

.public-subscribe {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  max-width: 17rem;
  text-align: right;

  @media (max-width: 48rem) {
    flex: 1 1 100%;
    align-items: flex-start;
    max-width: none;
    text-align: left;
  }
}

.public-doors,
.public-cat-grid,
.public-cat__traits {
  margin: 0;
  padding: 0;
  list-style: none;
}

.public-doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-4);
}

.public-door {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-5);
  color: var(--color-text);
  text-decoration: none;

  &:hover {
    border-color: var(--color-primary);
  }

  .badge {
    margin-top: auto;
  }
}

.public-door__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--color-primary-subtle);
  color: var(--color-primary-text);

  svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

.public-door__title,
.public-cat-card__name {
  font-weight: var(--weight-semibold);
}

.public-door__title {
  font-size: var(--text-lg);
}

.public-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-4);
}

.public-cat-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  color: var(--color-text);
  text-decoration: none;

  &:hover {
    border-color: var(--color-primary);
  }
}

.public-cat-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.public-cat-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-primary-subtle);
}

.public-cat-photo--empty {
  display: grid;
  place-items: center;
  color: var(--color-primary-text);

  svg {
    width: 30%;
    max-width: 5rem;
  }
}

.public-cat {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-6);
  align-items: start;
  margin-top: var(--space-4);

  @media (max-width: 48rem) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.public-cat__photos {
  display: grid;
  gap: var(--space-3);

  > .public-cat-photo {
    border-radius: var(--radius-lg);
  }

  /* The whole photo here, whatever its shape: only the cards crop */
  > img.public-cat-photo {
    aspect-ratio: auto;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
  }
}

/* A cat's photos when it has several (gallery_controller.js). The frame has one shape for all of them, so the page
   doesn't jump from one photo to the next, and each photo shows whole inside it */
.public-gallery {
  display: grid;
  gap: var(--space-2);
}

.public-gallery__stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.public-gallery__track {
  display: flex;
  aspect-ratio: 4 / 3;
  width: 100%;
  max-height: 85vh;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }

  /* Only for scrolling asked for from code: a finger moves it as usual */
  @media (prefers-reduced-motion: no-preference) {
    scroll-behavior: smooth;
  }
}

.public-gallery__slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;

  .public-cat-photo {
    aspect-ratio: auto;
    height: 100%;
    object-fit: contain;
  }
}

/* Only where there's a mouse to hover with; a phone has the swipe and the thumbnails */
.public-gallery__arrow {
  display: none;
  position: absolute;
  top: 50%;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity var(--duration-normal), background-color var(--duration-fast);

  svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  &:hover {
    background: var(--color-surface-hover);
  }

  &:focus-visible {
    box-shadow: var(--focus-ring);
    opacity: 1;
  }

  @media (hover: hover) and (pointer: fine) {
    display: grid;
  }
}

.public-gallery__arrow--previous {
  left: var(--space-3);
}

.public-gallery__arrow--next {
  right: var(--space-3);
}

.public-gallery__stage:hover .public-gallery__arrow {
  opacity: 1;
}

/* No photo further that way. Still there for the keyboard: taking it away would lose the focus */
.public-gallery__stage .public-gallery__arrow[aria-disabled="true"] {
  cursor: default;
  opacity: 0;
  pointer-events: none;

  &:focus-visible {
    opacity: 0.5;
  }
}

.public-gallery__thumbs {
  display: flex;
  gap: var(--space-2);
  /* Room for the ring of the current one, which the scrolling row would cut off */
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.public-gallery__thumb {
  flex: none;
  width: 3rem;
  height: 3rem;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--duration-normal);

  .public-cat-photo {
    aspect-ratio: 1;
    height: 100%;
  }

  &[aria-current="true"] {
    box-shadow: 0 0 0 2px var(--color-primary);
    opacity: 1;
  }

  &:focus-visible {
    box-shadow: var(--focus-ring);
  }
}

.public-cat__traits {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.public-cat-summary {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  margin-top: var(--space-4);

  .public-cat-photo {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
  }
}

/* An address on the town hall's page and its "Copiar enlace" */
.public-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}
