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

:root {
  --navy: #0f2a45;
  --navy-2: #173a57;
  --slate: #3e5a6b;
  --terra: #c4623f;
  --terra-soft: #f2e0d4;
  --gold: #d8a447;
  --cream: #fbf6ef;
  --cream-2: #f5ede0;
  --paper: #fffaf4;
  --shadow: 0 18px 48px rgba(15, 42, 69, 0.1);
  --shadow-soft: 0 12px 32px rgba(15, 42, 69, 0.08);
  --serif: "Playfair Display", Georgia, serif;
  --body: "DM Sans", system-ui, sans-serif;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(211, 122, 90, 0.12), transparent 28rem),
    radial-gradient(circle at 86% 2%, rgba(216, 164, 71, 0.13), transparent 24rem),
    linear-gradient(180deg, var(--cream), #f8f0e6 64%, #f2e7d8);
  color: var(--navy);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 42, 69, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 42, 69, 0.022) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 80%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

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

:focus-visible {
  outline: 3px solid rgba(196, 98, 63, 0.42);
  outline-offset: 4px;
}

.library-shell {
  color: var(--navy);
  min-height: 100vh;
}

.page-shell {
  margin: 0 auto;
  width: min(1180px, calc(100% - 40px));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(15, 42, 69, 0.08);
  background: rgba(251, 246, 239, 0.9);
  backdrop-filter: blur(16px);
}

.header-inner {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto;
  min-height: 76px;
  width: min(1180px, calc(100% - 40px));
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 12px;
  min-width: 0;
}

.brand > img {
  height: auto;
  width: 178px;
}

.brand-mark {
  background: var(--paper);
  border: 1px solid rgba(15, 42, 69, 0.09);
  border-radius: 16px;
  display: none;
  height: 42px;
  padding: 8px;
  width: 42px;
}

.brand-mark img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.avatar {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 42, 69, 0.12);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15, 42, 69, 0.07);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.library-auth-page {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 32px 20px;
}

.auth-shell {
  width: 100%;
}

.auth-card {
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid rgba(15, 42, 69, 0.12);
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 520px;
  padding: clamp(28px, 5vw, 44px);
  width: 100%;
}

.brand-link {
  display: inline-flex;
  margin-bottom: 28px;
}

.brand-link img {
  height: auto;
  width: 188px;
}

.auth-card h1 {
  color: var(--navy);
  font-family: var(--serif);
  font-size: clamp(34px, 6vw, 52px);
  letter-spacing: 0;
  line-height: 1.04;
  margin: 8px 0 18px;
}

.auth-card p {
  color: var(--slate);
  font-size: 1rem;
  line-height: 1.65;
}

.auth-tabs {
  background: rgba(15, 42, 69, 0.07);
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 999px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  margin-top: 26px;
  padding: 4px;
}

.auth-tab {
  background: transparent;
  border-radius: 999px;
  color: rgba(15, 42, 69, 0.72);
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
}

.auth-tab.is-active {
  background: #fffaf4;
  box-shadow: 0 10px 28px rgba(15, 42, 69, 0.12);
  color: var(--navy);
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.auth-form[hidden],
[data-auth-panel][hidden],
[data-product-content][hidden],
.access-alert[hidden],
.empty-card[hidden] {
  display: none;
}

.auth-panel-copy {
  font-size: 0.96rem !important;
  margin: 0 0 4px;
}

.auth-form label {
  color: var(--navy);
  font-weight: 800;
}

.auth-form input {
  background: #fffaf4;
  border: 1px solid rgba(15, 42, 69, 0.18);
  border-radius: 18px;
  color: var(--navy);
  min-height: 54px;
  padding: 0 18px;
}

.password-hint {
  font-size: 0.9rem !important;
  line-height: 1.45 !important;
}

.auth-link-button {
  align-self: center;
  background: transparent;
  color: var(--terra);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 800;
  margin-top: 2px;
  padding: 4px 8px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.auth-link-button:hover {
  color: #a84f31;
}

.auth-message {
  border-radius: 18px;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 18px;
  padding: 14px 16px;
}

.auth-message.success {
  background: #ecf7ec;
  color: #2f6f42;
}

.auth-message.notice {
  background: #fff3df;
  color: #8a5420;
}

.auth-message.error {
  background: #ffe7e7;
  color: #9f2d2d;
}

.auth-note {
  font-size: 0.94rem !important;
  margin-top: 22px;
}

.auth-note a {
  color: var(--terra);
  font-weight: 800;
}

.hero-card {
  position: relative;
  overflow: hidden;
  margin: 34px 0;
  min-height: 286px;
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(15, 42, 69, 0.94), rgba(15, 42, 69, 0.78) 45%, rgba(15, 42, 69, 0.24)),
    url("/porta-hero.png") center right / cover no-repeat;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(570px, 100%);
  padding: clamp(30px, 5vw, 58px);
}

.eyebrow {
  align-items: center;
  color: #f4d7c7;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 10px;
  letter-spacing: 0.13em;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.eyebrow::before,
.content-label::before {
  background: currentColor;
  border-radius: 2px;
  content: "";
  height: 1.5px;
  width: 28px;
}

.hero-title,
.page-title,
.detail-hero h1,
.section-heading h2,
.product-body h3,
.resource-card h3,
.access-alert h2,
.empty-card h3 {
  color: var(--navy);
  font-family: var(--serif);
  letter-spacing: 0;
  line-height: 1.12;
}

.hero-title {
  color: #fff;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  margin-bottom: 16px;
}

.hero-copy {
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
  max-width: 480px;
}

.intro-row {
  align-items: end;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  margin: 34px 0 26px;
}

.section-kicker {
  color: var(--terra);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-title {
  font-size: clamp(32px, 4vw, 48px);
  margin-top: 8px;
}

.page-copy {
  color: var(--slate);
  margin-top: 8px;
  max-width: 560px;
}

.continue-card {
  background: rgba(255, 250, 244, 0.76);
  border: 1px solid rgba(15, 42, 69, 0.09);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  padding: 20px;
}

.continue-card strong {
  font-size: 17px;
}

.progress-line {
  background: rgba(15, 42, 69, 0.1);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}

.progress-line span {
  background: var(--terra);
  border-radius: inherit;
  display: block;
  height: 100%;
  width: var(--progress, 0%);
}

.muted {
  color: var(--slate);
  font-size: 14px;
}

.section,
.content-section {
  padding: 30px 0;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(28px, 3vw, 38px);
}

.section-heading p {
  color: var(--slate);
  font-size: 14px;
  max-width: 420px;
}

.library-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-card {
  background: rgba(255, 250, 244, 0.86);
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 26px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 22px;
  grid-template-columns: 170px minmax(0, 1fr);
  min-height: 238px;
  overflow: hidden;
  padding: 22px;
  position: relative;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.product-card:hover {
  border-color: rgba(196, 98, 63, 0.26);
  box-shadow: 0 24px 58px rgba(15, 42, 69, 0.13);
  transform: translateY(-3px);
}

.product-card.placeholder {
  align-content: center;
  background: rgba(245, 237, 224, 0.72);
  border-style: dashed;
  grid-template-columns: 1fr;
}

.cover-frame {
  align-items: center;
  background: var(--cream-2);
  border: 1px solid rgba(15, 42, 69, 0.08);
  border-radius: 18px;
  display: flex;
  justify-content: center;
  min-height: 194px;
  overflow: hidden;
}

.cover-frame img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.product-body {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.collection {
  color: var(--terra);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-body h3 {
  font-size: clamp(24px, 3vw, 34px);
  margin-top: 8px;
}

.product-body p {
  color: var(--slate);
  font-size: 15px;
  margin: 10px 0 18px;
}

.status-pill {
  align-items: center;
  background: var(--terra-soft);
  border-radius: 999px;
  color: #773b29;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  margin-bottom: 18px;
  padding: 7px 12px;
}

.status-pill::before {
  background: var(--terra);
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.btn,
.library-button,
.resource-action {
  align-items: center;
  border: 1px solid rgba(15, 42, 69, 0.13);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn,
.library-button-primary {
  background: var(--navy);
  box-shadow: 0 12px 24px rgba(15, 42, 69, 0.15);
  color: #fff;
}

.btn:hover,
.library-button-primary:hover {
  background: var(--terra);
  transform: translateY(-1px);
}

.btn.secondary,
.library-button-secondary {
  background: #fff;
  box-shadow: none;
  color: var(--navy);
}

.btn.secondary:hover,
.library-button-secondary:hover {
  background: #fff;
  border-color: rgba(196, 98, 63, 0.34);
  color: var(--terra);
}

.library-button:disabled,
.resource-action:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.detail-hero {
  align-items: center;
  background:
    radial-gradient(circle at 90% 10%, rgba(216, 164, 71, 0.18), transparent 20rem),
    linear-gradient(135deg, #fffaf4, #f5ede0);
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 30px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) 280px;
  margin: 34px 0 26px;
  padding: clamp(24px, 4vw, 44px);
}

.detail-hero h1 {
  font-size: clamp(36px, 5vw, 58px);
  margin-top: 8px;
}

.detail-cover {
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(15, 42, 69, 0.14);
  overflow: hidden;
}

.content-label {
  align-items: center;
  color: var(--terra);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 10px;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.resource-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resource-card {
  align-items: flex-start;
  background: rgba(255, 250, 244, 0.9);
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(15, 42, 69, 0.07);
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 20px;
}

.resource-card.featured {
  background:
    linear-gradient(115deg, rgba(15, 42, 69, 0.92), rgba(30, 63, 90, 0.78)),
    url("/inglesnaescola/cover-watercolor.png") center / cover;
  color: #fff;
  grid-column: span 2;
}

.resource-card h3 {
  font-size: 21px;
}

.resource-card p {
  color: var(--slate);
  font-size: 14px;
  margin: 8px 0 16px;
}

.resource-card.featured h3 {
  color: #fff;
}

.resource-card.featured p {
  color: rgba(255, 255, 255, 0.78);
}

.resource-type {
  background: rgba(15, 42, 69, 0.08);
  border-radius: 999px;
  color: var(--slate);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding: 5px 9px;
  text-transform: uppercase;
}

.resource-card.featured .resource-type {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
}

.resource-action {
  background: transparent;
  border: 0;
  color: var(--terra);
  margin-top: auto;
  min-height: auto;
  padding: 0;
}

.resource-action:hover {
  color: var(--navy);
}

.resource-card.featured .resource-action {
  color: #f4d7c7;
}

.download-status {
  color: var(--slate);
  font-size: 13px;
  font-weight: 700;
  margin-top: 12px;
}

.audio-mock {
  align-items: center;
  background: var(--paper);
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 22px;
  display: grid;
  gap: 16px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 18px;
}

.play {
  align-items: center;
  background: var(--terra);
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(196, 98, 63, 0.2);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.play::before {
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
  border-top: 8px solid transparent;
  content: "";
  height: 0;
  transform: translateX(2px);
  width: 0;
}

.audio-title {
  font-weight: 800;
}

.audio-bar {
  background: rgba(15, 42, 69, 0.1);
  border-radius: 999px;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
}

.audio-bar span {
  background: var(--gold);
  border-radius: inherit;
  display: block;
  height: 100%;
  width: 38%;
}

.access-alert,
.empty-card {
  background: rgba(255, 250, 244, 0.92);
  border: 1px solid rgba(15, 42, 69, 0.1);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  margin: 24px auto;
  max-width: 760px;
  padding: 24px;
}

.access-alert h2,
.empty-card h3 {
  font-size: 28px;
}

.access-alert p,
.empty-card p {
  color: var(--slate);
  margin: 8px 0 18px;
}

.footer-note {
  color: var(--slate);
  font-size: 13px;
  margin: 42px 0 26px;
  text-align: center;
}

@media (max-width: 900px) {
  .intro-row,
  .detail-hero {
    grid-template-columns: 1fr;
  }

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

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

  .resource-card.featured {
    grid-column: span 1;
  }

  .detail-cover {
    max-width: 260px;
  }
}

@media (max-width: 680px) {
  .page-shell,
  .header-inner {
    width: min(100% - 28px, 1180px);
  }

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

  .brand > img {
    display: none;
  }

  .brand-mark {
    display: block;
  }

  .avatar {
    font-size: 14px;
    height: 38px;
    width: 38px;
  }

  .hero-card {
    background-position: center;
    border-radius: 24px;
    margin: 22px 0 24px;
    min-height: 310px;
  }

  .hero-content {
    padding: 30px 24px;
  }

  .intro-row {
    margin: 28px 0 18px;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 8px;
  }

  .product-card {
    border-radius: 22px;
    gap: 14px;
    grid-template-columns: 120px minmax(0, 1fr);
    padding: 16px;
  }

  .cover-frame {
    border-radius: 16px;
    min-height: 158px;
  }

  .product-body h3 {
    font-size: 24px;
  }

  .product-body p {
    font-size: 14px;
  }

  .btn,
  .library-button {
    width: 100%;
  }

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

  .audio-mock {
    grid-template-columns: auto 1fr;
  }

  .audio-time {
    grid-column: 2;
  }
}

@media (max-width: 420px) {
  .product-card {
    grid-template-columns: 1fr;
  }

  .cover-frame {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }
}
