/* ─── Library Hero ─── */
.lib-hero {
  background: var(--surface);
  padding: 9rem 3rem 5rem;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.lib-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 79px,
    rgba(201, 168, 76, 0.025) 79px,
    rgba(201, 168, 76, 0.025) 80px
  );
  pointer-events: none;
}

.lib-hero-inner {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.lib-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

.lib-headline {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  color: var(--cream);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.lib-sub {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 2.5rem;
  max-width: 580px;
}

/* ─── Search ─── */
.lib-search-wrap {
  position: relative;
  max-width: 480px;
}

.lib-search {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.lib-search::placeholder { color: var(--text-muted); }

.lib-search:focus {
  border-color: var(--gold-muted);
}

.lib-search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

/* ─── Body ─── */
.lib-body {
  padding: 4rem 3rem;
}

.lib-body-inner {
  max-width: 1100px;
  margin: 0 auto;
}

/* ─── Filters ─── */
.lib-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.filter-btn:hover {
  border-color: var(--gold-muted);
  color: var(--cream);
}

.filter-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
  font-weight: 500;
}

.lib-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* ─── Grid ─── */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .lib-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .lib-grid { grid-template-columns: 1fr; }
}

/* ─── Resource Card ─── */
.res-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.25s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.res-card:hover {
  border-color: var(--gold-muted);
  transform: translateY(-3px);
}

.res-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.res-card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.res-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.res-card-badge {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  margin-bottom: 0.85rem;
  font-weight: 500;
}

.badge-article {
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
}

.badge-case_study {
  background: rgba(100, 180, 130, 0.12);
  color: #6bbf8a;
}

.badge-video {
  background: rgba(90, 140, 200, 0.12);
  color: #6aa3d4;
}

.res-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--cream);
  line-height: 1.3;
  margin-bottom: 0.6rem;
}

.res-card-excerpt {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.65;
  flex: 1;
}

.res-card-locked {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--gold-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ─── Empty ─── */
.lib-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* ─── Pagination ─── */
.lib-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.page-btn {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover { border-color: var(--gold-muted); color: var(--cream); }
.page-btn.current { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 500; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.modal-close:hover { color: var(--cream); }

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.modal-sub {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

/* ─── Forms ─── */
.auth-form-wrap { width: 100%; }

.form-field {
  margin-bottom: 1.1rem;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  letter-spacing: 0.03em;
}

.form-hint {
  font-weight: 300;
  color: var(--text-muted);
}

.form-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.form-field input::placeholder { color: var(--text-muted); }

.form-field input:focus { border-color: var(--gold-muted); }

.form-error {
  padding: 0.65rem 1rem;
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.3);
  color: #e88080;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ─── Buttons ─── */
.btn-primary {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: var(--gold);
  border: none;
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.btn-primary:hover { background: #d4b258; }

.nav-auth-btn {
  padding: 0.4rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-auth-btn:hover {
  border-color: var(--gold-muted);
  color: var(--cream);
}

/* ─── Auth switch ─── */
.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

.auth-switch a {
  color: var(--gold);
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

/* ─── Auth success ─── */
.auth-form-wrap .auth-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(107, 191, 138, 0.12);
  border: 1px solid rgba(107, 191, 138, 0.3);
  color: #6bbf8a;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

/* ─── Loading spinner ─── */
.res-loading-inner {
  text-align: center;
  padding: 6rem 2rem;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Resource detail: locked ─── */
.res-locked { padding: 5rem 3rem; }

.res-locked-inner {
  max-width: 680px;
  margin: 0 auto;
}

.res-locked-type {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

.res-locked-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--cream);
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.res-locked-excerpt {
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.8;
  font-style: italic;
}

.res-locked-divider {
  width: 60px;
  height: 1px;
  background: var(--gold);
  margin: 3rem 0;
}

.res-locked-cta { text-align: center; }

.res-locked-cta-headline {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--cream);
  margin-bottom: 0.85rem;
}

.res-locked-cta-sub {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

.btn-locked {
  max-width: 280px;
  margin: 0 auto 1rem;
}

.res-locked-signin {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.res-locked-signin a { color: var(--gold); text-decoration: none; }

/* ─── Resource detail: full content ─── */
.res-content { padding: 5rem 3rem; }

.res-content-inner {
  max-width: 720px;
  margin: 0 auto;
}

.res-back {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.res-back:hover { color: var(--gold); }

.res-type-badge {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}

.res-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--cream);
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.res-byline {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-style: italic;
}

.res-body {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--text-dim);
  line-height: 1.9;
}

.res-body h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--cream);
  margin: 2.5rem 0 1rem;
}

.res-body h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--cream);
  margin: 2rem 0 0.75rem;
}

.res-body p { margin-bottom: 1.25rem; }

.res-body blockquote {
  border-left: 2px solid var(--gold);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--cream);
}

.res-body ul, .res-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.res-body li { margin-bottom: 0.5rem; }

.res-video-wrap {
  margin-top: 2.5rem;
  aspect-ratio: 16 / 9;
  background: var(--bg);
}

.res-video-wrap iframe {
  width: 100%;
  height: 100%;
}

/* ─── Nav links ─── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
}

.nav-link {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.nav-link:hover { color: var(--gold); }

.nav-user {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Responsive ─── */
@media (max-width: 700px) {
  .nav { padding: 1rem 1.5rem; }
  .lib-hero { padding: 7rem 1.5rem 4rem; }
  .lib-body { padding: 3rem 1.5rem; }
  .res-locked, .res-content { padding: 3rem 1.5rem; }
  .nav-links { gap: 0.75rem; }
  .nav-user { display: none !important; }
  .lib-filters { gap: 0.4rem; }
  .lib-count { margin-left: 0; margin-top: 0.5rem; width: 100%; }
  .modal-card { padding: 2rem 1.5rem; }
}