/* ================================================================
   EL TECOLOTE — ESTILOS DEL CATÁLOGO
   Cambia los colores principales en :root.
   ================================================================ */

:root {
  --paper: #f6f0e5;
  --paper-deep: #eee5d6;
  --ink: #17241f;
  --forest: #17352d;
  --forest-soft: #31584c;
  --yellow: #f3c951;
  --coral: #e46e50;
  --white: #fffdf8;
  --line: rgba(23, 36, 31, 0.16);
  --muted: #6d746f;
  --shadow: 0 18px 55px rgba(23, 36, 31, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shell: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 9%, rgba(243, 201, 81, 0.2), transparent 22rem),
    var(--paper);
  font-family: Inter, Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  width: min(calc(100% - 40px), var(--shell));
  margin-inline: auto;
}

.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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

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

.shipping-bar {
  display: grid;
  min-height: 34px;
  padding: 6px 20px;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.shipping-bar p {
  margin: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(23, 36, 31, 0.1);
  background: rgba(246, 240, 229, 0.9);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 47px;
  height: 47px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  place-items: center;
  background: var(--white);
  font-size: 1.45rem;
  transform: rotate(-4deg);
}

.brand-copy {
  display: grid;
  line-height: 1;
}

.brand-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

.brand-copy small {
  margin-top: 7px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.main-nav a {
  position: relative;
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
}

.main-nav a::after {
  position: absolute;
  right: 0;
  bottom: -6px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.main-nav a:hover::after,
.main-nav a:focus-visible::after {
  transform: scaleX(1);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: clamp(40px, 8vw, 120px);
  align-items: end;
  padding-block: clamp(62px, 9vw, 118px) clamp(54px, 7vw, 92px);
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.eyebrow::before,
.section-kicker::before {
  width: 29px;
  height: 3px;
  content: "";
  background: var(--coral);
}

.intro h1,
.catalog-heading h2,
.purchase-title h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.94;
}

.intro h1 {
  max-width: 740px;
  margin-top: 22px;
  font-size: clamp(3.6rem, 8.4vw, 7.6rem);
}

.intro h1 em {
  position: relative;
  z-index: 0;
  font-weight: 500;
}

.intro h1 em::after {
  position: absolute;
  right: -2%;
  bottom: 0.08em;
  left: -1%;
  z-index: -1;
  height: 0.21em;
  content: "";
  background: var(--yellow);
  transform: rotate(-1deg);
}

.intro-copy > p {
  max-width: 570px;
  margin: 28px 0 0;
  color: #44514b;
  font-size: clamp(1rem, 1.7vw, 1.16rem);
}

.intro-note {
  position: relative;
  min-height: 235px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}

.intro-note::after {
  position: absolute;
  right: -34px;
  bottom: -50px;
  width: 170px;
  height: 170px;
  border: 34px solid var(--yellow);
  border-radius: 50%;
  content: "";
  opacity: 0.72;
}

.note-number {
  color: var(--coral);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.intro-note p {
  position: relative;
  z-index: 1;
  margin: 45px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.22rem, 2.2vw, 1.7rem);
  line-height: 1.23;
}

.handwritten {
  position: absolute;
  right: 25px;
  bottom: 20px;
  z-index: 2;
  font-family: "Segoe Print", "Bradley Hand", cursive;
  font-size: 0.86rem;
  transform: rotate(-6deg);
}

.catalog-section {
  padding-bottom: clamp(78px, 10vw, 140px);
}

.catalog-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.catalog-heading h2 {
  margin-top: 13px;
  font-size: clamp(2.7rem, 5vw, 4.8rem);
}

.result-count {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-top: 40px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 58px;
  padding-inline: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: 0 8px 25px rgba(23, 36, 31, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-field:focus-within {
  border-color: var(--forest-soft);
  box-shadow: 0 0 0 4px rgba(49, 88, 76, 0.12);
}

.search-field svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1rem;
}

.search-field input::placeholder {
  color: #89908c;
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 16px 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 750;
}

.sort-field span {
  color: var(--muted);
}

.sort-field select {
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 750;
  cursor: pointer;
}

.category-filters {
  display: flex;
  gap: 9px;
  margin: 18px 0 34px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip.is-active {
  color: var(--white);
  border-color: var(--forest);
  background: var(--forest);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 22px;
}

.book-card {
  display: flex;
  overflow: hidden;
  min-width: 0;
  flex-direction: column;
  border: 1px solid rgba(23, 36, 31, 0.11);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 10px 28px rgba(23, 36, 31, 0.08);
  animation: card-in 420ms backwards;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.book-card:hover {
  border-color: rgba(23, 53, 45, 0.24);
  box-shadow: 0 20px 42px rgba(23, 36, 31, 0.13);
  transform: translateY(-5px);
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--paper-deep);
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #ded9cd;
  transition: transform 280ms ease;
}

.book-card:hover .book-cover {
  transform: scale(1.018);
}

.book-cover-fallback {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 34px 24px;
  align-items: center;
  justify-content: center;
  color: #fffdf8;
  background:
    linear-gradient(155deg, hsla(var(--cover-hue), 45%, 54%, 0.9), transparent 56%),
    hsl(var(--cover-hue), 28%, 25%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.05;
  text-align: center;
  text-wrap: balance;
}

.book-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  max-width: calc(100% - 28px);
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 4px 14px rgba(23, 36, 31, 0.14);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.book-badge.sold-out {
  color: var(--white);
  background: var(--ink);
}

.book-info {
  display: flex;
  padding: 18px;
  flex: 1;
  flex-direction: column;
}

.book-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.book-category {
  overflow: hidden;
  max-width: 58%;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(23, 53, 45, 0.07);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.book-status i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3f7a60;
  box-shadow: 0 0 0 3px rgba(63, 122, 96, 0.12);
}

.book-status.is-last-copy i {
  background: #c88428;
  box-shadow: 0 0 0 3px rgba(200, 132, 40, 0.13);
}

.book-status.is-sold-out i {
  background: #8b8f8c;
  box-shadow: 0 0 0 3px rgba(139, 143, 140, 0.13);
}

.book-title {
  margin: 14px 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 1.8vw, 1.43rem);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

.book-author {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 600;
}

.book-publisher {
  display: flex;
  margin: 8px 0 0;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.book-publisher span {
  color: var(--ink);
  font-weight: 800;
}

.book-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.book-price {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
}

.book-action {
  display: inline-flex;
  min-height: 40px;
  padding: 9px 13px;
  align-items: center;
  gap: 7px;
  justify-content: center;
  border: 1px solid var(--forest);
  border-radius: 11px;
  color: var(--white);
  background: var(--forest);
  font-size: 0.75rem;
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.book-action:not([aria-disabled="true"])::after {
  content: "→";
  font-size: 0.95rem;
  line-height: 0;
}

.book-action:hover {
  color: var(--forest);
  background: transparent;
  transform: translateY(-1px);
}

.book-action[aria-disabled="true"] {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
  cursor: not-allowed;
}

.empty-state {
  padding: 70px 20px;
  border: 1px dashed rgba(23, 36, 31, 0.28);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.5);
  text-align: center;
}

.empty-state > span {
  display: block;
  font-family: Georgia, serif;
  font-size: 3rem;
}

.empty-state h3 {
  margin: 10px 0 4px;
  font-family: Georgia, serif;
  font-size: 1.8rem;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--muted);
}

.empty-state button {
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  color: var(--white);
  background: var(--forest);
  font-weight: 800;
  cursor: pointer;
}

.purchase-section {
  padding-block: clamp(74px, 9vw, 120px);
  color: var(--white);
  background: var(--forest);
}

.purchase-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(50px, 8vw, 120px);
}

.section-kicker.light {
  color: #d9e5e0;
}

.purchase-title h2 {
  max-width: 570px;
  margin-top: 18px;
  font-size: clamp(2.8rem, 5.3vw, 5rem);
}

.purchase-steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.purchase-steps li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 20px;
  padding-block: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.purchase-steps li:first-child {
  padding-top: 4px;
}

.purchase-steps > li > span {
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  place-items: center;
  color: var(--yellow);
  font-family: Georgia, serif;
  font-size: 1.1rem;
}

.purchase-steps h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.35rem;
}

.purchase-steps p {
  margin: 4px 0 0;
  color: #cbd9d4;
}

.site-footer {
  padding-block: 34px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--white);
  background: #10251f;
}

.footer-inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}

.footer-inner strong {
  font-family: Georgia, serif;
  letter-spacing: 0.06em;
}

.footer-inner p {
  margin: 5px 0 0;
  color: #b8c9c3;
  font-size: 0.82rem;
}

.footer-details {
  text-align: right;
}

.floating-contact {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: inline-flex;
  min-height: 51px;
  padding: 10px 18px 10px 11px;
  align-items: center;
  gap: 9px;
  border: 2px solid var(--white);
  border-radius: 999px;
  color: var(--white);
  background: var(--coral);
  box-shadow: 0 12px 34px rgba(23, 36, 31, 0.28);
  font-size: 0.85rem;
  font-weight: 850;
  text-decoration: none;
  transition: transform 180ms ease;
}

.floating-contact > span:first-child {
  display: grid;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  place-items: center;
  color: var(--ink);
  background: var(--yellow);
}

.floating-contact:hover {
  transform: translateY(-3px) rotate(-1deg);
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .intro-note {
    max-width: 540px;
    min-height: 200px;
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .purchase-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(calc(100% - 28px), var(--shell));
  }

  .shipping-bar {
    font-size: 0.65rem;
    letter-spacing: 0.045em;
  }

  .header-inner {
    min-height: 70px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand-copy strong {
    font-size: 0.95rem;
  }

  .main-nav a:not(#instagramLink) {
    display: none;
  }

  .intro {
    padding-block: 58px 64px;
  }

  .intro h1 {
    font-size: clamp(3.25rem, 16vw, 5.4rem);
  }

  .catalog-heading {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .catalog-toolbar {
    grid-template-columns: 1fr;
  }

  .sort-field {
    justify-content: space-between;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 27px 13px;
  }

  .book-bottom {
    align-items: stretch;
    flex-direction: column;
  }

  .book-action {
    width: 100%;
  }

  .footer-inner {
    align-items: start;
    flex-direction: column;
  }

  .footer-details {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .book-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .book-card {
    display: grid;
    grid-template-columns: clamp(108px, 32vw, 126px) minmax(0, 1fr);
    border-radius: 17px;
  }

  .book-cover-wrap {
    height: 100%;
    min-height: 202px;
    aspect-ratio: auto;
  }

  .book-info {
    min-width: 0;
    padding: 14px;
  }

  .book-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .book-category {
    max-width: 100%;
    padding: 4px 7px;
  }

  .book-title {
    margin-top: 10px;
    font-size: 1.16rem;
  }

  .book-author {
    font-size: 0.82rem;
  }

  .book-publisher {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
  }

  .book-publisher span {
    display: block;
  }

  .book-bottom {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
  }

  .book-price {
    font-size: 1.08rem;
  }

  .book-action {
    width: auto;
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.7rem;
  }

  .book-badge {
    top: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
    padding: 6px 8px;
    font-size: 0.57rem;
    letter-spacing: 0.06em;
  }
}

@media (max-width: 360px) {
  .book-bottom {
    align-items: stretch;
    flex-direction: column;
  }

  .book-action {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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