/* Resources page styles */
.res-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2em 0.7em;
  border-radius: 2px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.res-type-chip--ebook,
.type-badge--ebook   { background: rgba(74,114,196,0.12);  color: #4a72c4; }

.res-type-chip--pdf,
.type-badge--pdf     { background: rgba(140,58,28,0.12);   color: var(--sienna); }

.res-type-chip--document,
.type-badge--document { background: rgba(92,84,73,0.10);   color: var(--ink); }

.res-type-chip--audio,
.type-badge--audio   { background: rgba(122,158,126,0.15); color: var(--sage-lo); }

.res-type-chip--video,
.type-badge--video   { background: rgba(212,137,90,0.15);  color: #b86a1a; }

.res-type-chip--photo_collection,
.type-badge--photo_collection { background: rgba(49,44,37,0.08); color: var(--graphite); }

.res-type-chip--book,
.type-badge--book    { background: rgba(74,114,196,0.12);  color: #4a72c4; }

.res-type-chip--article,
.type-badge--article { background: rgba(92,84,73,0.10);    color: var(--ink); }

/* formats count pill (hero) */
.res-formats-count {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sienna);
  background: color-mix(in srgb, var(--sienna) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--sienna) 25%, transparent);
  border-radius: 20px;
}


/* ─────────────────────────────────────────────────────────────
   2. FILTER TABS  .res-tab
   ───────────────────────────────────────────────────────────── */

.resources-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.res-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.res-tab:hover {
  border-color: var(--sienna);
  color: var(--sienna);
}
.res-tab--active {
  background: var(--sienna);
  border-color: var(--sienna);
  color: #fff;
}
.res-tab--active:hover {
  background: var(--sienna-hi);
  border-color: var(--sienna-hi);
  color: #fff;
}

.res-tab-icon { font-size: 0.9em; }

.res-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(0,0,0,0.1);
  color: inherit;
}
.res-tab--active .res-tab-count { background: rgba(255,255,255,0.25); }

[data-theme="dark"] .res-tab                { border-color: var(--void-border); color: var(--ink); }
[data-theme="dark"] .res-tab:hover          { border-color: var(--sienna); color: var(--sienna); }
[data-theme="dark"] .res-tab--active        { color: #fff; }


/* ─────────────────────────────────────────────────────────────
   3. SEARCH BAR
   ───────────────────────────────────────────────────────────── */

.resources-search-wrap {
  max-width: 900px;
  margin: 0 0 1.5rem;
  align-self: center;
  justify-self: center;

}

.resources-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.resources-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--ink);
  pointer-events: none;
  line-height: 1;
}

.resources-search-input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 2.4rem;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.97rem;
  color: var(--ink);
  background: var(--ghost);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
.resources-search-input::placeholder { color: var(--ink); opacity: 0.75; }
.resources-search-input:focus {
  border-color: var(--sienna);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sienna) 15%, transparent);
  background: #fff;
}

[data-theme="dark"] .resources-search-input {
  background: color-mix(in srgb, var(--void) 92%, white 8%);
  border-color: var(--border);
  color: var(--parchment);
}
[data-theme="dark"] .resources-search-input:focus {
  background: color-mix(in srgb, var(--void) 85%, white 15%);
}

.resources-search-clear {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink);
  padding: 0.25rem;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.15s;
}
.resources-search-clear:hover { color: var(--sienna); }


/* ─────────────────────────────────────────────────────────────
   4. RESOURCE CARD
   ───────────────────────────────────────────────────────────── */

.resource-card {
  background: var(--ghost);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out);
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .resource-card {
  background: var(--void-2);
  border-color: var(--void-border);
}
.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08);
  border-color: var(--border);
}

.resource-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

/* Cover */
.resource-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--ghost-2);
  flex-shrink: 0;
}
[data-theme="dark"] .resource-card-cover { background: var(--void-3); }

.resource-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
  display: block;
}
.resource-card:hover .resource-card-cover img { transform: scale(1.04); }

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-placeholder-icon { font-size: 3.5rem; opacity: 0.6; }

.cover-placeholder--audio          { background: linear-gradient(135deg, #e8f4e8, #c8dfc8); }
.cover-placeholder--video          { background: linear-gradient(135deg, #fdf0e8, #f4d4b8); }
.cover-placeholder--pdf            { background: linear-gradient(135deg, #fdf0eb, #f0cdc0); }
.cover-placeholder--document       { background: linear-gradient(135deg, #f0f0f0, #dcdcdc); }
.cover-placeholder--ebook          { background: linear-gradient(135deg, #e8eef8, #c4d0e8); }
.cover-placeholder--photo_collection { background: linear-gradient(135deg, #e8e4dc, #ccc8c0); }
.cover-placeholder--book           { background: linear-gradient(135deg, #e8eef8, #c4d0e8); }
.cover-placeholder--article        { background: linear-gradient(135deg, #f0f0f0, #dcdcdc); }

[data-theme="dark"] .cover-placeholder--audio          { background: linear-gradient(135deg, #1a261a, #0e180e); }
[data-theme="dark"] .cover-placeholder--video          { background: linear-gradient(135deg, #261e14, #1a100a); }
[data-theme="dark"] .cover-placeholder--pdf            { background: linear-gradient(135deg, #261a16, #1a100c); }
[data-theme="dark"] .cover-placeholder--ebook          { background: linear-gradient(135deg, #161e2a, #0e141e); }
[data-theme="dark"] .cover-placeholder--document       { background: linear-gradient(135deg, #1e1e1e, #141414); }
[data-theme="dark"] .cover-placeholder--photo_collection { background: linear-gradient(135deg, #201e1a, #161410); }

.resource-card-type-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 1;
}

/* Body */
.resource-card-body {
  padding: 1rem 1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.resource-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.25rem;
  color: var(--ink);
}
[data-theme="dark"] .resource-title { color: var(--parchment); }

.resource-author {
  font-size: 0.8rem;
  color: var(--parchment);
  margin-bottom: 0.4rem;
}
[data-theme="dark"] .resource-author { color: var(--ink); }

.resource-description {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--graphite);
  margin-bottom: 0.75rem;
  flex: 1;
}
[data-theme="dark"] .resource-description { color: var(--parchment); }

.resource-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: auto;
}
[data-theme="dark"] .resource-card-footer { border-top-color: var(--void-border); }

.resource-date { color: var(--sienna); font-weight: 600;font-family: "Barlow Condensed", sans-serif; }
.resource-cta  { color: var(--sienna); font-weight: 600; transition: transform 0.2s; }
.resource-card:hover .resource-cta { transform: translateX(3px); }


/* ─────────────────────────────────────────────────────────────
   5. RESOURCES GRID  (category page)
   ───────────────────────────────────────────────────────────── */

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
  margin: 0 auto 4rem;
  padding: 0 var(--gutter);
  max-width: calc(var(--col-max) + var(--gutter) * 2);
}

.resources-empty,
.resources-no-results {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--ink);
  font-family: "EB Garamond", serif;
  font-size: 1.1rem;
  font-style: italic;
}

/* Toolbar wrapper (search + tabs) */
.resources-toolbar {
  max-width: calc(var(--col-max) + var(--gutter) * 2);
  margin: 0 auto 0.5rem;
  padding: 0 var(--gutter);
}


/* ─────────────────────────────────────────────────────────────
   6. HUB PAGE
   ───────────────────────────────────────────────────────────── */

.hub-header {
  background: var(--parchment);
  border-bottom: 1px solid var(--border-light);
  padding: 5rem var(--gutter) 3rem;
  text-align: center;
}
[data-theme="dark"] .hub-header { background: var(--parchment); }

.hub-header-inner {
  max-width: 720px;
  margin: 0 auto;
}

.hub-header h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.8rem, 7vw, 4.5rem);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

.hub-header p {
  font-family: "EB Garamond", serif;
  font-size: 1.2rem;
  color: var(--ink);
  font-style: italic;
  margin: 0;
}

.hub-categories {
  max-width: calc(var(--col-max) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 3rem var(--gutter) 5rem;
}

.hub-category {
  margin-bottom: 4rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-light);
}
.hub-category:last-child { border-bottom: none; }

.hub-category-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.hub-category-header h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.hub-view-all {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sienna);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
.hub-view-all:hover { color: var(--sienna-hi); border-bottom-color: var(--sienna); }

.hub-category-desc {
  font-family: "EB Garamond", serif;
  font-size: 0.95rem;
  color: var(--ink);
  font-style: italic;
  margin: 0 0 1.8rem;
  max-width: 70ch;
}
[data-theme="dark"] .hub-category-desc { color: var(--ink); }



/* Hub preview grid — inherits .resource-card base styles */
.hub-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 0; /* no extra padding — parent .hub-categories handles it */
}

.hub-empty {
  font-family: "EB Garamond", serif;
  font-style: italic;
  color: var(--ink);
  padding: 2rem 0;
  text-align: center;
}
[data-theme="dark"] .hub-empty { color: var(--ink); }


/* ─────────────────────────────────────────────────────────────
   7. CATEGORY PAGE HEADER
   ───────────────────────────────────────────────────────────── */

.category-header {
  background: var(--parchment);
  border-bottom: 1px solid var(--border-light);
  padding: 4rem var(--gutter) 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
}
[data-theme="dark"] .category-header { background: var(--parchment); }

.category-header-inner {
  max-width: 720px;
  margin: 0 auto;
}

.category-header h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.5rem, 6vw, 3.8rem);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

.category-header p {
  font-family: "EB Garamond", serif;
  font-size: 1.1rem;
  color: var(--ink);
  font-style: italic;
  margin: 0;
}


/* ─────────────────────────────────────────────────────────────
   8. RESOURCE DETAIL — HERO
   ───────────────────────────────────────────────────────────── */

.resource-nav-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem var(--gutter) 1.5rem;
}

.resource-nav-header .resource-back-link {
  display: inline-block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sienna);
  text-decoration: none;
  padding: 0.4rem 1.2rem;
  border: 1px solid var(--border-light);
  background: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.resource-nav-header .resource-back-link:hover {
  background: var(--sienna);
  color: #fff;
  border-color: var(--sienna);
}

.resource-detail {
  max-width: 100%;
  padding: 0;
}

.resource-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
  padding: 2rem var(--gutter);
  max-width: var(--col-max);
  margin: 0 auto;
}

.resource-hero-cover {
  flex-shrink: 0;
  width: 500px;
}
.resource-hero-cover img {
  width: 100%;
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 24px rgba(0,0,0,0.07);
  display: block;
}

.resource-type-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.resource-hero .resource-title {
  font-family: "vollkorn", serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 0.4rem;
  color: var(--ink);
}
[data-theme="dark"] .resource-hero .resource-title { color: var(--ink); }

.resource-hero .resource-author {
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.resource-hero .resource-date {
  font-size: 0.82rem;
  color: var(--ink);
  margin-bottom: 1rem;
}
.resource-hero .resource-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--graphite);
  max-width: 55ch;
  margin-bottom: 1.5rem;
  font-family: "EB Garamond", serif;
}
[data-theme="dark"] .resource-hero .resource-description { color: var(--ink); }

.resource-hero-actions { margin-top: 0.5rem; }

/* Download button */
.btn-resource-dl {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.65rem 1.4rem;
  background: var(--sienna);
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  border: 1px solid var(--sienna);
  transition: background 0.18s, border-color 0.18s;
  cursor: pointer;
}
.btn-resource-dl:hover { background: var(--sienna-hi); border-color: var(--sienna-hi); color: #fff; }

.btn-resource-dl--ghost {
  background: transparent;
  color: var(--sienna);
}
.btn-resource-dl--ghost:hover { background: var(--sienna); color: #fff; }

.btn-resource-dl--sm   { padding: 0.35rem 0.8rem; font-size: 0.78rem; }

.dl-ext {
  font-size: 0.7em;
  background: rgba(255,255,255,0.25);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  letter-spacing: 0;
}

.resource-footer {
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}


/* ─────────────────────────────────────────────────────────────
   9. RESOURCE DETAIL — VIEWER
   ───────────────────────────────────────────────────────────── */

.resource-viewer {
  max-width: var(--col-max);
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
}

/* Format tabs (viewer switcher) */
.res-format-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}
[data-theme="dark"] .res-format-tabs { border-bottom-color: var(--void-border); }

.res-format-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.res-format-tab:hover           { border-color: var(--sienna); color: var(--sienna); }
.res-format-tab--active         { background: var(--sienna); border-color: var(--sienna); color: #fff; }

[data-theme="dark"] .res-format-tab       { border-color: var(--void-border); color: var(--ink); }
[data-theme="dark"] .res-format-tab:hover { border-color: var(--sienna); color: var(--sienna); }
[data-theme="dark"] .res-format-tab--active { color: #fff; }

.res-format-viewer {
  animation: res-fadeIn 0.22s ease;
}
@keyframes res-fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Divider between audio player and other formats */
.res-formats-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0 1.5rem;
  color: var(--ink);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.res-formats-divider::before,
.res-formats-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
[data-theme="dark"] .res-formats-divider::before,
[data-theme="dark"] .res-formats-divider::after { background: var(--void-border); }


/* ─────────────────────────────────────────────────────────────
   10. VIEWERS
   ───────────────────────────────────────────────────────────── */

/* — Video — */
.resource-video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--void);
  border-radius: 2px;
  overflow: hidden;
}
.resource-video-wrap iframe,
.resource-video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.resource-video-wrap--native video { object-fit: contain; }

.resource-media-dl { margin-top: 1rem; }

/* — Audio (legacy single file) — */
.resource-audio-embed { margin: 1rem 0; border-radius: 2px; overflow: hidden; }

.resource-audio-player {
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  background: var(--ghost);
}
[data-theme="dark"] .resource-audio-player {
  background: var(--void-2);
  border-color: var(--void-border);
}

.audio-player-inner    { display: flex; gap: 1.5rem; align-items: flex-start; }

.audio-player-art {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.audio-player-art img { width: 100%; height: 100%; object-fit: cover; }

.audio-player-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--ink);
}

.audio-player-controls { flex: 1; min-width: 0; }

.audio-player-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.2rem;
}
.audio-player-artist { font-size: 0.85rem; color: var(--ink); margin: 0; }
.audio-player-controls audio { width: 100%; margin-top: 0.75rem; display: block; }

[data-theme="dark"] .audio-player-title,
[data-theme="dark"] .audio-player-artist { color: var(--parchment); }

/* — PDF — */
.resource-pdf-viewer { border: 1px solid var(--border-light); }

.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--ghost);
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
}
[data-theme="dark"] .pdf-toolbar {
  background: var(--void-3);
  border-bottom-color: var(--void-border);
}

.pdf-toolbar-label {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.8rem;
  color: var(--parchment);
  letter-spacing: 0.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-desktop-viewer { display: block; }

.pdf-responsive-container {
  width: 100%;
  height: min(80vh, 900px);
  background: var(--void);
}
.pdf-responsive-container iframe { width: 100%; height: 100%; border: none; display: block; }

.pdf-mobile-open {
  display: none;   /* shown via @media below */
  text-align: center;
  padding: 2rem 1rem;
  background: var(--ghost);
  border: 1px solid var(--border-light);
}
.pdf-mobile-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--sienna);
  color: #fff;
  text-decoration: none;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 4px;
  transition: background 0.2s;
}
.pdf-mobile-btn:hover { background: var(--sienna-hi); }
.pdf-mobile-icon      { font-size: 2rem; }
.pdf-mobile-btn small { font-size: 0.7rem; opacity: 0.8; font-family: inherit; }

.pdf-fallback {
  display: none;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink);
}

/* — Download card (ebook, doc…) — */
.resource-download-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  border: 1px solid var(--border-light);
  background: var(--ghost);
  flex-wrap: wrap;
}
[data-theme="dark"] .resource-download-card {
  background: var(--void-2);
  border-color: var(--void-border);
}
.resource-download-card--ebook { border-left: 3px solid #4a72c4; }
.resource-download-card--doc   { border-left: 3px solid var(--ink); }

.dl-card-icon { font-size: 3rem; flex-shrink: 0; }
.dl-card-body { flex: 1; min-width: 0; }

.dl-card-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--ink);
}
[data-theme="dark"] .dl-card-title { color: var(--parchment); }

.dl-card-author { font-size: 0.85rem; color: var(--ink); margin: 0 0 0.4rem; }
.dl-card-note   { font-size: 0.85rem; color: var(--ink);  margin: 0; }

/* — Photo gallery — */
.photo-gallery-header {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.78rem;
  color: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin: 0 0 2rem;
}

.gallery-item {
  overflow: hidden;
  background: var(--ghost-2);
  aspect-ratio: 4 / 3;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out), opacity 0.3s;
  display: block;
}
.gallery-item:hover img { transform: scale(1.04); }

/* Empty viewer state */
.resource-empty-viewer { padding: 4rem 2rem; text-align: center; color: var(--ink); }
.resource-empty-icon   { font-size: 3rem; display: block; margin-bottom: 1rem; }


/* ─────────────────────────────────────────────────────────────
   11. AUDIOBOOK CHAPTER PLAYER  .audiobook-player / .abp-*
   ───────────────────────────────────────────────────────────── */

.audiobook-player {
  border: 1px solid var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  background: var(--ghost);
  margin: 0.5rem 0;
}
[data-theme="dark"] .audiobook-player {
  background: var(--void-2);
  border-color: var(--void-border);
}

.abp-header {
  display: flex;
  gap: 1.5rem;
  padding: 1.75rem;
  align-items: flex-start;
}

.abp-art {
  flex-shrink: 0;
  width: 130px;
  height: 130px;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
[data-theme="dark"] .abp-art { border-color: var(--void-border); }

.abp-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.abp-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--parchment);
}
[data-theme="dark"] .abp-art-placeholder { background: var(--amber-hi); }

.abp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.abp-book-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 0;
}
[data-theme="dark"] .abp-book-title { color: var(--parchment); }

.abp-author { font-size: 0.83rem; color: var(--ink); margin: 0.2rem 0 0; }

.abp-now-playing {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0.9rem 0 0.4rem;
  flex-wrap: wrap;
}

.abp-chapter-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sienna);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.abp-chapter-counter {
  font-size: 0.75rem;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.abp-audio {
  width: 100%;
  margin-top: 0.6rem;
  accent-color: var(--sienna);
  display: block;
}

/* Chapter list */
.abp-chapters { border-top: 1px solid var(--border-light); }
[data-theme="dark"] .abp-chapters { border-color: var(--void-border); }

.abp-chapters-header {
  padding: 0.55rem 1.75rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
  font-family: "Barlow Condensed", sans-serif;
}

.abp-chapters-hint {
  display: block;
  font-family: "EB Garamond", serif;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--sienna);
  letter-spacing: 0;
  text-transform: none;
  margin-top: 0.2rem;
  opacity: 0.8;
}

.abp-chapter-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.75rem;
  max-height: 340px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.abp-chapter-list::-webkit-scrollbar       { width: 3px; }
.abp-chapter-list::-webkit-scrollbar-track { background: transparent; }
.abp-chapter-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.abp-chapter-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 1.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
  user-select: none;
}
.abp-chapter-item:hover { background: var(--ghost-2); }
[data-theme="dark"] .abp-chapter-item:hover { background: var(--void-3); }

.abp-chapter-item--active {
  background: rgba(140,58,28,0.06);
  border-left-color: var(--sienna);
}
[data-theme="dark"] .abp-chapter-item--active { background: rgba(140,58,28,0.12); }

.abp-ch-num {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--ghost-2);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, color 0.15s;
}
[data-theme="dark"] .abp-ch-num { background: var(--void-3); color: var(--fog); }
.abp-chapter-item--active .abp-ch-num { background: var(--sienna); color: #fff; }

.abp-ch-label {
  flex: 1;
  font-size: 0.88rem;
  color: var(--graphite);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.abp-chapter-item--active .abp-ch-label { color: var(--ink); font-weight: 500; }
[data-theme="dark"] .abp-ch-label { color: var(--parchment); }

.abp-ch-playing-icon {
  font-size: 0.65rem;
  color: var(--sienna);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.abp-chapter-item--active .abp-ch-playing-icon { opacity: 1; }


/* ─────────────────────────────────────────────────────────────
   12. LIGHTBOX
   ───────────────────────────────────────────────────────────── */

.res-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(10,8,6,0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.res-lightbox.open { opacity: 1; pointer-events: all; }

.res-lightbox-img-wrap {
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.res-lightbox-img { max-width: 100%; max-height: 88vh; object-fit: contain; display: block; }

.res-lightbox-close,
.res-lightbox-prev,
.res-lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
  transition: color 0.15s;
  padding: 0.5rem;
}
.res-lightbox-close:hover,
.res-lightbox-prev:hover,
.res-lightbox-next:hover { color: #fff; }

.res-lightbox-close  { top: 1.2rem; right: 1.5rem; font-size: 1.2rem; }
.res-lightbox-prev   { left: 1.5rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; }
.res-lightbox-next   { right: 1.5rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; }

.res-lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.1em;
}


/* ─────────────────────────────────────────────────────────────
   13. SOURCE BANNER  .pd-banner
   ───────────────────────────────────────────────────────────── */

.pd-banner {
  background: var(--amber-hi);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--sienna);
  border-radius: 0 4px 4px 0;
  padding: 1rem 1.5rem;
  margin: 1.75rem auto 2rem;
  max-width: 820px;
  font-family: "EB Garamond", Georgia, serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="dark"] .pd-banner {
  background: var(--ink);
  border-color: var(--void-border);
  border-left-color: var(--sienna);
}

.pd-banner-content { display: flex; gap: 1rem; align-items: flex-start; }
.pd-banner-icon    { font-size: 1.5rem; line-height: 1.3; flex-shrink: 0; opacity: 0.85; }
.pd-banner-text    { flex: 1; min-width: 0; }

.pd-banner-title {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.pd-banner-body {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--graphite);
  opacity: 0.9;
  font-family: "EB Garamond", serif;
}
.pd-banner-body strong { color: var(--ink); font-weight: 600; opacity: 1; }
[data-theme="dark"] .pd-banner-title,
[data-theme="dark"] .pd-banner-body,
[data-theme="dark"] .pd-banner-body strong { color: var(--parchment); }


/* ─────────────────────────────────────────────────────────────
   14. ADMIN — FORMAT ROWS & SECTIONS
   ───────────────────────────────────────────────────────────── */

.formats-section {
  margin: 2rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--ghost);
}
[data-theme="dark"] .formats-section {
  background: var(--void-2);
  border-color: var(--void-border);
}

.formats-section--audio {
  border-top: 2px solid var(--sienna);
}
.formats-section--audio .formats-section-title { color: var(--sienna); }

.formats-section--other {
  border-top: 1px solid var(--border-light);
  margin-top: 1.5rem;
}
[data-theme="dark"] .formats-section--other { border-top-color: var(--void-border); }

.formats-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.formats-section-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-family: "Cormorant Garamond", serif;
  color: var(--ink);
}
[data-theme="dark"] .formats-section-title { color: var(--parchment); }

.formats-section-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink);
  max-width: 55ch;
}

/* Format row */
.format-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.9rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  background: var(--parchment);
  animation: res-slideRowIn 0.18s ease;
}
[data-theme="dark"] .format-row {
  background: var(--void-3);
  border-color: var(--void-border);
}
@keyframes res-slideRowIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.format-row--audio { border-left: 2px solid color-mix(in srgb, var(--sienna) 40%, transparent); }
.format-row--other { border-left: 2px solid var(--border-light); }

.format-row-fields {
  display: grid;
  grid-template-columns: 130px 1fr 2fr;
  gap: 0.75rem;
  align-items: start;
}

.format-field label {
  display: block;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.format-field select,
.format-field input[type="text"],
.format-field input[type="url"] { width: 100%; box-sizing: border-box; }

.fmt-url-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fmt-url-display {
  font-size: 0.8rem;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fmt-file-link { color: var(--sienna); text-decoration: none; }
.fmt-file-link:hover { text-decoration: underline; }

.fmt-embed-input {
  flex: 1;
  min-width: 180px;
  font-size: 0.82rem;
}

/* Row actions (reorder + remove) */
.fmt-row-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding-left: 0.5rem;
  flex-shrink: 0;
}

.fmt-reorder-btns { display: flex; flex-direction: column; gap: 2px; }

.fmt-up-btn,
.fmt-down-btn {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  width: 26px;
  height: 22px;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}
.fmt-up-btn:hover,
.fmt-down-btn:hover     { background: var(--ghost-2); color: var(--ink); }
.fmt-up-btn:disabled,
.fmt-down-btn:disabled  { opacity: 0.25; cursor: default; }

.fmt-remove-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  margin-top: 1.5rem;
}
.fmt-remove-btn:hover {
  background: rgba(200,60,40,0.15);
  border-color: rgba(200,60,40,0.4);
  color: #e05040;
}

/* Legacy file section */
.legacy-file-section {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--border-light);
  border-radius: 5px;
  color: var(--ink);
}
.legacy-file-section summary {
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.25rem 0;
  list-style: none;
  user-select: none;
}
.legacy-file-section summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s;
}
.legacy-file-section[open] summary::before { transform: rotate(90deg); }

/* Bulk audio upload */
.bulk-audio-upload {
  display: none;
  background: var(--ghost);
  border: 2px dashed var(--border-light);
  border-radius: 4px;
  padding: 1rem 1.5rem;
  margin: 0.75rem 0 0.5rem;
  transition: border-color 0.2s;
}
.bulk-audio-upload--visible    { display: block; }
.bulk-audio-upload:focus-within { border-color: var(--sienna); }
[data-theme="dark"] .bulk-audio-upload {
  background: var(--void-3);
  border-color: var(--void-border);
}

.bulk-audio-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
[data-theme="dark"] .bulk-audio-label { color: var(--parchment); }

.bulk-audio-hint {
  font-size: 0.8rem;
  color: var(--ink);
  line-height: 1.5;
}
.bulk-audio-hint code {
  font-family: monospace;
  background: var(--ghost-2);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 0.78rem;
}
.bulk-audio-status { font-size: 0.8rem; color: var(--ink); min-width: 120px; }

/* Utility sizes */
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-xs { padding: 0.2rem 0.5rem;   font-size: 0.75rem; }


/* ─────────────────────────────────────────────────────────────
   15. RESPONSIVE
   ───────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .pdf-responsive-container { height: 70vh; }
}

/* Mobile landscape */
@media (max-width: 768px) {
  .hub-header                { padding: 3.5rem var(--gutter) 2rem; }
  .hub-header h1             { font-size: 2.4rem; }
  .hub-header p              { font-size: 1rem; }
  .hub-categories            { padding: 2rem var(--gutter) 3rem; }
  .hub-category-header h2    { font-size: 1.5rem; }
  .hub-preview-grid          { grid-template-columns: 1fr; gap: 1.5rem; }
  .hub-category-desc         { font-size: 0.9rem; }

  .category-header           { padding: 3rem var(--gutter) 2rem; }
  .category-header h1        { font-size: 2rem; }
  .resources-toolbar         { padding: 0 1rem; }

  .resource-nav-header       { padding: 1.5rem var(--gutter) 1rem; }

  .resource-hero {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 1.5rem var(--gutter) 1.25rem;
  }
  .resource-hero-cover {
    width: auto;
    max-width: 180px;
    order: -1;
    margin: 0 auto 1.25rem;
  }
  .resource-hero-content     { text-align: center; }
  .resource-hero .resource-description { text-align: left; margin-left: auto; margin-right: auto; }
  .resource-hero-actions     { display: flex; justify-content: center; }
  .resource-type-label       { justify-content: center; }

  .audio-player-inner        { flex-direction: column; }
  .audio-player-art          { width: 80px; height: 80px; }

  .resource-download-card    { flex-direction: column; text-align: center; }

  .pdf-desktop-viewer        { display: none; }
  .pdf-mobile-open           { display: block; }

  .abp-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem;
    gap: 1rem;
  }
  .abp-art               { width: 100px; height: 100px; }
  .abp-now-playing       { justify-content: center; }
  .abp-chapter-list      { max-height: 260px; }
  .abp-chapter-item      { padding: 0.6rem 1rem; }
  .abp-chapters-header   { padding: 0.5rem 1rem; }

  .res-format-tabs       { gap: 0.25rem; }
  .res-format-tab        { font-size: 0.78rem; padding: 0.35rem 0.75rem; }

  .res-lightbox-prev     { left: 0.5rem; }
  .res-lightbox-next     { right: 0.5rem; }

  .formats-section-header { flex-direction: column; align-items: stretch; }
  .format-row-fields     { grid-template-columns: 1fr; }

  .pd-banner             { padding: 0.85rem 1rem; margin: 1.25rem 0 1.5rem; }
  .pd-banner-content     { gap: 0.65rem; }
  .pd-banner-icon        { font-size: 1.2rem; margin-top: 0.1rem; }
  .pd-banner-title       { font-size: 0.82rem; }
  .pd-banner-body        { font-size: 0.79rem; }
}

/* Mobile portrait */
@media (max-width: 480px) {
  .resources-grid        { grid-template-columns: 1fr; }
  .photo-gallery         { grid-template-columns: 1fr; }
  .pdf-responsive-container { height: 60vh; }
  .resource-hero-cover   { max-width: 300px; }
  .resources-search-wrap { max-width: 100%; }
  .resources-search-input { font-size: 16px; } /* prevents iOS zoom */
  .hub-preview-grid      { grid-template-columns: 1fr; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .hub-preview-grid      { grid-template-columns: repeat(2, 1fr); }
}
/* ════════════════════════════════════════════════════════════════════════════
   resource-form-v2.css
   Stiluri per il form admin multi-categoria (media, articoli, guide, ecc.)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Wrap principale ── */
.rf2-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  font-family: var(--font-body, system-ui, sans-serif);
  color: var(--text, #1a1a1a);
}

/* ── Header ── */
.rf2-back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: .85rem;
  color: var(--accent, #8c3a1c);
  text-decoration: none;
  opacity: .8;
  transition: opacity .15s;
}
.rf2-back:hover { opacity: 1; }
.rf2-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  line-height: 1.2;
  color: var(--ink);
}
[data-theme="dark"] .rf2-title { color: var(--ink); 
}
.rf2-subtitle {
  color: var(--ink);
  margin: 0 0 2rem;
  font-size: .95rem;
}

/* ── Error banner ── */
.rf2-error-banner {
  background: #fff0f0;
  border: 1px solid #f5c6c6;
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: 1.5rem;
  color: #c0392b;
  font-size: .9rem;
}

/* ── Sezione ── */
.rf2-section {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.rf2-section-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.rf2-section-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
[data-theme="dark"] .rf2-section-header h2 { color: var(--ink); }
.rf2-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent, #8c3a1c);
  color: #fff;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Sottosezione ── */
.rf2-subsection-header {
  margin-bottom: 1rem;
}
.rf2-subsection-header h3 {
  font-size: .95rem;
  font-weight: 600;
  margin: 0 0 .2rem;
}

/* ════════════════════════════════════════════════════════
   CATEGORIA CARDS
   ════════════════════════════════════════════════════════ */
.rf2-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}
.rf2-category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .3rem;
  padding: 1rem .75rem;
  border: 2px solid var(--border, #e5e5e5);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  position: relative;
  user-select: none;
}
[data-theme="dark"] .rf2-category-card {
  border-color: var(--void-border);
  background: var(--parchment);
  color: var(--ink);
}

.rf2-category-card--active {
  border-color: var(--accent, #8c3a1c);
  background: var(--amber-hi);
}
[data-theme="dark"] .rf2-category-card--active {
  border-color: var(--accent, #8c3a1c);
  background: var(--sienna);
  color: var(--ink);
}
.rf2-category-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.rf2-cat-icon { font-size: 1.75rem; line-height: 1; }
.rf2-cat-name { font-weight: 600; font-size: .9rem;color: var(--ink); }
[data-theme="dark"] .rf2-cat-name { color: var(--ink); }
.rf2-cat-desc { font-size: .72rem; color: var(--ink); line-height: 1.3; }
[data-theme="dark"] .rf2-cat-desc { color: var(--ink); }

/* ════════════════════════════════════════════════════════
   TIPO PILLS
   ══════════════════════════════════════════════════════ */
.rf2-type-row {

  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.rf2-type-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .9rem;
  border: 1.5px solid var(--border, #e5e5e5);
  border-radius: 20px;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  user-select: none;
  color: var(--ink);

}
.rf2-type-pill:hover { border-color: var(--accent, #8c3a1c);background: var(--ink);color: var(--parchment); }
.rf2-type-pill--active {
  border-color: var(--accent, #8c3a1c);
  background: var(--amber-hi);
  color: var(--ink);
  font-weight: 600;

}
[data-theme="dark"] .rf2-type-pill--active {
  border-color: var(--void-border);
  background: var(--sienna-hi);
  color: var(--parchment);
}
.rf2-type-pill input { display: none; }

/* ════════════════════════════════════════════════════════
   CAMPI FORM
   ════════════════════════════════════════════════════════ */
.rf2-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.rf2-field { display: flex; flex-direction: column; gap: .35rem; }
.rf2-field--full  { grid-column: 1 / -1; }
.rf2-field--half  { grid-column: span 1; }

.rf2-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .01em;
}
.rf2-required { color: var(--accent, #8c3a1c); margin-left: 2px; }
.rf2-optional { font-weight: 400; color: var(--ink); font-size: .8em; }
.rf2-hint     { font-size: .78rem; color: var(--ink); margin: .25rem 0 0; }

.rf2-input,
.rf2-textarea,
.rf2-select {
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .75rem;
  border: 1.5px solid var(--border, #ddd);
  border-radius: 7px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface, #fff);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  background-color: var(--surface, #fff);
}

[data-theme="dark"] .rf2-input,
[data-theme="dark"] .rf2-textarea,
[data-theme="dark"] .rf2-select {
  border-color: var(--void-border);
  background: var(--amber-hi);
  color: var(--parchment);
}

.rf2-input:focus,
.rf2-textarea:focus,
.rf2-select:focus {
  border-color: var(--accent, #8c3a1c);
  box-shadow: 0 0 0 3px rgba(140, 58, 28, .1);
}
.rf2-textarea { resize: vertical; min-height: 80px; }
.rf2-select--sm { width: auto; min-width: 120px; }

/* Cover preview */
.rf2-img-preview {
  margin-top: .4rem;
  min-height: 0;
}
.rf2-img-preview img {
  max-width: 140px;
  max-height: 140px;
  border-radius: 6px;
  border: 1px solid var(--border, #ddd);
  object-fit: cover;
}

/* ════════════════════════════════════════════════════════
   UPLOAD ZONE
   ════════════════════════════════════════════════════════ */
.rf2-upload-zone {
  position: relative;
  border: 2px dashed var(--border, #ccc);
  border-radius: 8px;
  background: var(--amber-hi);
  transition: border-color .15s, background .15s;
  overflow: hidden;
  cursor: pointer;
}
[data-theme="dark"] .rf2-upload-zone {
  border-color: var(--void-border);
  background: var(--sienna-hi);
}

.rf2-upload-zone .rf2-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  color:var(--parchment);
}
.rf2-upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: 1.25rem 1rem;
  pointer-events: none;
  color: var(--ink);
}
.rf2-upload-icon { font-size: 1.5rem; }
.rf2-upload-text { font-size: .9rem; font-weight: 500;color: var(--ink); }
.rf2-upload-sub  { font-size: .78rem; color: var(--ink); }
.rf2-upload-status {
  font-size: .82rem;
  margin-top: .4rem;
  min-height: 1.2em;
}
.rf2-existing-file {
  font-size: .8rem;
  margin-top: .4rem;
  color: var(--ink);
}

/* Bulk upload */
.rf2-bulk-upload {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: var(--surface-alt, #f7f7f7);
  border-radius: 8px;
  border: 1px solid var(--border, #e5e5e5);
}
.rf2-bulk-upload .rf2-file-input {
  font-size: .85rem;
}

/* ════════════════════════════════════════════════════════
   CAPITOLI AUDIO
   ════════════════════════════════════════════════════════ */
.rf2-chapters-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .75rem;
}
.rf2-chapter-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .75rem;
  background: var(--surface-alt, #f9f9f9);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
}
.rf2-chapter-handle {
  cursor: grab;
  color: var(--ink);
  font-size: 1.1rem;
  padding-top: .3rem;
  flex-shrink: 0;
}
.rf2-chapter-num {
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 20px;
  padding-top: .5rem;
  flex-shrink: 0;
}
.rf2-chapter-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.rf2-chapter-file {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.rf2-chapter-file .rf2-file-input {
  font-size: .8rem;
}
.rf2-chapter-actions {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   ALTRI FORMATI
   ════════════════════════════════════════════════════════ */
.rf2-formats-other-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .75rem;
}
.rf2-other-format-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .5rem;
  padding: .75rem;
  background: var(--surface-alt, #f9f9f9);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
}
.rf2-other-format-row .rf2-select--sm { flex-shrink: 0; }
.rf2-other-format-row .rf2-input { flex: 1; min-width: 140px; }
.rf2-other-format-file { display: flex; flex-direction: column; gap: .3rem; flex: 2; min-width: 160px; }
.rf2-other-format-file .rf2-file-input { font-size: .8rem; }
.rf2-other-format-embed { flex: 2; min-width: 160px; }
.rf2-other-format-actions { display: flex; gap: .3rem; flex-shrink: 0; align-self: center; }

/* ════════════════════════════════════════════════════════
   STEPS (tutorial)
   ════════════════════════════════════════════════════════ */
#rf2-steps-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .75rem;
}
.rf2-step-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .75rem;
  background: var(--surface-alt, #f9f9f9);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
}
.rf2-step-num-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--accent, #8c3a1c);
  color: #fff;
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .35rem;
}
.rf2-step-fields { flex: 1; display: flex; flex-direction: column; gap: .4rem; }

/* ════════════════════════════════════════════════════════
   BOTTONI
   ════════════════════════════════════════════════════════ */
.rf2-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
}
.rf2-btn:active { transform: translateY(1px); }
.rf2-btn--primary {
  background: var(--accent, #8c3a1c);
  color: #fff;
}
.rf2-btn--primary:hover { background: #7a3218; box-shadow: 0 2px 8px rgba(140,58,28,.25); }
.rf2-btn--secondary {
  background: var(--surface, #fff);
  color: var(--accent, #8c3a1c);
  border: 1.5px solid var(--accent, #8c3a1c);
}
.rf2-btn--secondary:hover { background: #fdf3ef; }
.rf2-btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--border, #ddd);
}
.rf2-btn--ghost:hover { background: var(--surface-alt, #f5f5f5); }
.rf2-btn--sm { padding: .4rem .85rem; font-size: .82rem; }

.rf2-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border, #ddd);
  border-radius: 5px;
  background: var(--surface, #fff);
  cursor: pointer;
  font-size: .8rem;
  transition: background .12s, border-color .12s;
}
.rf2-btn-icon:hover:not(:disabled) { background: var(--surface-alt, #f5f5f5); border-color: #bbb; }
.rf2-btn-icon:disabled { opacity: .35; cursor: not-allowed; }
.rf2-btn-danger { color: #c0392b; border-color: #f5c6c6; }
.rf2-btn-danger:hover:not(:disabled) { background: #fff0f0; border-color: #c0392b; }

/* ── Actions bar ── */
.rf2-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border, #e5e5e5);
  flex-wrap: wrap;
}

/* ── Links ── */
.rf2-link {
  color: var(--accent, #8c3a1c);
  font-size: .82rem;
  word-break: break-all;
}
.rf2-no-file { font-size: .8rem; color: var(--ink); font-style: italic; }
.rf2-empty-hint { font-size: .82rem; color: var(--ink); font-style: italic; margin: .5rem 0; }

/* ── Content blocks ── */
.rf2-content-block { margin-bottom: 1rem; }
.rf2-content-block + .rf2-content-block { padding-top: 1rem; border-top: 1px solid var(--border, #eee); }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .rf2-wrap { padding: 1.25rem 1rem 3rem; }
  .rf2-fields { grid-template-columns: 1fr; }
  .rf2-field--half { grid-column: 1 / -1; }
  .rf2-category-grid { grid-template-columns: repeat(2, 1fr); }
  .rf2-actions { justify-content: stretch; }
  .rf2-actions .rf2-btn { flex: 1; justify-content: center; }
  .rf2-other-format-row { flex-direction: column; }
  .rf2-other-format-file,
  .rf2-other-format-embed { min-width: 100%; }
  .rf2-chapter-row { flex-wrap: wrap; }
}


/* Contenitore editor */
.rf2-editor-wrap {
  position: relative;
  border: 1px solid var(--border-light, #d9cfc4);
  border-radius: 3px;
  overflow: hidden;
  background: var(--parchment, #faf7f2);
  box-shadow: inset 0 1px 3px rgba(49,44,37,0.04);
  transition: border-color 0.2s;
}
.rf2-editor-wrap:focus-within {
  border-color: var(--sienna, #8c3a1c);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sienna, #8c3a1c) 12%, transparent),
              inset 0 1px 3px rgba(49,44,37,0.04);
}

/* Toolbar CKEditor */
.rf2-editor-wrap .ck.ck-editor__top .ck-sticky-panel .ck-toolbar {
  background: color-mix(in srgb, var(--parchment, #faf7f2) 60%, var(--sienna, #8c3a1c) 6%) !important;
  border: none !important;
  border-bottom: 1px solid var(--border-light, #d9cfc4) !important;
  padding: 4px 6px !important;
}

/* Bottoni toolbar */
.rf2-editor-wrap .ck.ck-toolbar .ck-button {
  border-radius: 2px !important;
  color: var(--ink, #312c25) !important;
  min-width: 28px;
  min-height: 28px;
}
.rf2-editor-wrap .ck.ck-toolbar .ck-button:hover,
.rf2-editor-wrap .ck.ck-toolbar .ck-button.ck-on {
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 12%, transparent) !important;
  color: var(--sienna, #8c3a1c) !important;
}

/* Area di testo CKEditor */
.rf2-editor-wrap .ck.ck-editor__main .ck-editor__editable {
  background: var(--parchment, #faf7f2) !important;
  border: none !important;
  min-height: 320px !important;
  font-family: "EB Garamond", "Garamond", Georgia, serif !important;
  font-size: 1.05rem !important;
  line-height: 1.75 !important;
  color: var(--ink, #312c25) !important;
  padding: 1.25rem 1.5rem !important;
}
.rf2-editor-wrap .ck.ck-editor__main .ck-editor__editable:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Placeholder */
.rf2-editor-wrap .ck .ck-placeholder::before {
  color: var(--ink) !important;
  font-style: italic;
  font-family: "EB Garamond", serif !important;
}

/* Headings inside editor */
.rf2-editor-wrap .ck-editor__editable h2 { font-size: 1.35rem; margin: 1.2em 0 0.5em; color: var(--ink, #312c25); }
.rf2-editor-wrap .ck-editor__editable h3 { font-size: 1.15rem; margin: 1em 0 0.4em; color: var(--ink, #312c25); }
.rf2-editor-wrap .ck-editor__editable blockquote {
  border-left: 3px solid var(--sienna, #8c3a1c);
  margin: 1.2em 0;
  padding: 0.6em 1.2em;
  color: var(--graphite, #6b6057);
  font-style: italic;
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 4%, transparent);
}
.rf2-editor-wrap .ck-editor__editable a { color: var(--sienna, #8c3a1c); text-decoration: underline; }
.rf2-editor-wrap .ck-editor__editable figure.image { margin: 1.5em auto; text-align: center; }
.rf2-editor-wrap .ck-editor__editable figure.image img {
  max-width: 100%; border-radius: 3px;
  box-shadow: 0 2px 12px rgba(49,44,37,0.10);
}
.rf2-editor-wrap .ck-editor__editable figure.image figcaption {
  font-size: 0.82rem; color: var(--graphite, #6b6057);
  font-style: italic; margin-top: 0.4em;
}

/* Dropdown balloon (link, heading selector) */
.ck.ck-balloon-panel, .ck.ck-dropdown__panel {
  border-color: var(--border-light, #d9cfc4) !important;
  box-shadow: 0 4px 16px rgba(49,44,37,0.12) !important;
}
.ck.ck-list__item .ck-button.ck-on {
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 10%, transparent) !important;
  color: var(--sienna, #8c3a1c) !important;
}


/* ─────────────────────────────────────────────────────────────
   2. AUTOSAVE BAR (admin form)
   ───────────────────────────────────────────────────────────── */

.rf2-header-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.rf2-autosave-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.rf2-autosave-icon {
  font-size: 0.9rem;
  opacity: 0.6;
}
.rf2-autosave-status {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--graphite, #6b6057);
  transition: color 0.3s;
}
.rf2-autosave-status--saved {
  color: #4a8c5c;
}
.rf2-autosave-restore {
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--sienna, #8c3a1c) 30%, transparent);
  color: var(--sienna, #8c3a1c);
  border-radius: 2px;
  padding: 0.1rem 0.5rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.rf2-autosave-restore:hover { background: color-mix(in srgb, var(--sienna, #8c3a1c) 18%, transparent); }
.rf2-autosave-discard {
  background: transparent;
  border: 1px solid var(--border-light, #d9cfc4);
  color: var(--graphite, #6b6057);
  border-radius: 2px;
  padding: 0.1rem 0.5rem;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}


/* ─────────────────────────────────────────────────────────────
   3. COPY BUTTONS (admin form)
   ───────────────────────────────────────────────────────────── */

.rf2-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.rf2-input-wrap .rf2-input,
.rf2-input-wrap .rf2-textarea {
  flex: 1;
  min-width: 0;
  border-radius: 3px 0 0 3px !important;
  border-right: none !important;
}
.rf2-input-wrap .rf2-textarea {
  resize: vertical;
  border-radius: 3px 0 0 3px !important;
}

.rf2-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--parchment, #faf7f2) 80%, var(--sienna, #8c3a1c) 5%);
  border: 1px solid var(--border-light, #d9cfc4);
  border-radius: 0 3px 3px 0;
  color: var(--graphite, #6b6057);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-size: 0.85rem;
  user-select: none;
  align-self: stretch;
}
.rf2-copy-btn:hover {
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 10%, transparent);
  color: var(--sienna, #8c3a1c);
  border-color: color-mix(in srgb, var(--sienna, #8c3a1c) 40%, transparent);
}
.rf2-copy-btn--done {
  background: color-mix(in srgb, #4a8c5c 15%, transparent) !important;
  color: #4a8c5c !important;
  border-color: color-mix(in srgb, #4a8c5c 40%, transparent) !important;
}
.rf2-copy-btn--textarea {
  align-self: flex-start;
  height: 38px; /* allineato con la prima riga del textarea */
  border-radius: 0 3px 3px 0;
}


/* ─────────────────────────────────────────────────────────────
   4. BODY CONTENT — visualizzazione pubblica (resource.ejs)
   ───────────────────────────────────────────────────────────── */

/* Contenitore principale */
.resource-body-content {
  max-width: 72ch;
  margin: 2.5rem auto 3rem;
  padding: 0 var(--page-pad, 1.5rem);
}

/* Tipografia di base — lettura articoli */
.resource-body-content,
.resource-body-content.ck-content {
  font-family: "EB Garamond", "Garamond", Georgia, serif;
  font-size: clamp(1rem, 1.05vw + 0.6rem, 1.15rem);
  line-height: 1.82;
  color: var(--ink, #312c25);
}

/* Paragrafi */
.resource-body-content p {
  margin: 0 0 1.35em;
  font-family: "EB Garamond", "Garamond", serif;
  font-size: clamp(1rem, 1.05vw + 0.6rem, 1.15rem);
  line-height: 1.82;
  color: var(--ink);
}
[data-theme="dark"] .resource-body-content p { color: var(--parchment); }

.resource-body-content p:last-child { margin-bottom: 0; }

/* Headings */
.resource-body-content h2 {
  font-family: "vollkorn, serif";
  font-size: clamp(1.3rem, 1.5vw + 0.7rem, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink, #312c25);
  margin: 2.2em 0 0.7em;
  line-height: 1.2;
}
.resource-body-content h3 {
  font-family: "vollkorn, serif";
  font-size: clamp(1.1rem, 1vw + 0.65rem, 1.35rem);
  font-weight: 600;
  color: var(--ink, #312c25);
  margin: 1.8em 0 0.6em;
  line-height: 1.3;
}
.resource-body-content h4 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sienna, #8c3a1c);
  margin: 1.5em 0 0.5em;
}

/* Citazioni */
.resource-body-content blockquote {
  position: relative;
  margin: 1.8em 0;
  padding: 1em 1.5em 1em 2em;
  border-left: 3px solid var(--sienna, #8c3a1c);
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 4%, var(--parchment, #faf7f2) 96%);
  font-style: italic;
  color: var(--graphite, #6b6057);
  border-radius: 0 3px 3px 0;
}
.resource-body-content blockquote::before {
  content: '"';
  position: absolute;
  top: -0.2em;
  left: 0.5rem;
  font-family: "Cormorant Garamond", serif;
  font-size: 3rem;
  color: var(--sienna, #8c3a1c);
  opacity: 0.25;
  line-height: 1;
}

/* Link */
.resource-body-content a {
  color: var(--sienna, #8c3a1c);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.resource-body-content a:hover { color: color-mix(in srgb, var(--sienna, #8c3a1c) 70%, #000); }

/* Liste */
.resource-body-content ul,
.resource-body-content ol {
  margin: 1em 0 1.4em 1.5em;
  padding: 0;
}
.resource-body-content li { margin-bottom: 0.4em; }
.resource-body-content ul { list-style: disc; }
.resource-body-content ol { list-style: decimal; }

/* Tabelle */
.resource-body-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}
.resource-body-content th {
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 8%, var(--parchment, #faf7f2));
  color: var(--ink, #312c25);
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.8em;
  padding: 0.6em 1em;
  text-align: left;
  border: 1px solid var(--border-light, #d9cfc4);
}
.resource-body-content td {
  padding: 0.5em 1em;
  border: 1px solid var(--border-light, #d9cfc4);
  vertical-align: top;
}
.resource-body-content tr:nth-child(even) td {
  background: color-mix(in srgb, var(--parchment, #faf7f2) 60%, white 40%);
}

/* Immagini inline (da CKEditor) */
.resource-body-content figure.image {
  margin: 2em auto;
  text-align: center;
  max-width: 100%;
}
.resource-body-content figure.image img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 4px 20px rgba(49,44,37,0.12);
  display: block;
  margin: 0 auto;
}
.resource-body-content figure.image.image-style-side {
  float: right;
  max-width: 45%;
  margin: 0.5em 0 1.5em 2em;
}
.resource-body-content figure.image.image-style-side img {
  box-shadow: 0 2px 12px rgba(49,44,37,0.10);
}
.resource-body-content figure figcaption,
.resource-body-content .image > figcaption {
  font-size: 0.82rem;
  color: var(--graphite, #6b6057);
  font-style: italic;
  margin-top: 0.5em;
  text-align: center;
}

/* Video incorporati (CKEditor mediaEmbed) */
.resource-body-content .media {
  margin: 2em auto;
  max-width: 100%;
}
.resource-body-content .media .ck-media__wrapper,
.resource-body-content figure.media {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(49,44,37,0.12);
  margin: 0;
}
.resource-body-content .media iframe,
.resource-body-content figure.media iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* Codice inline e blocco */
.resource-body-content code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 6%, var(--parchment, #faf7f2));
  color: var(--sienna, #8c3a1c);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}
.resource-body-content pre {
  background: var(--ink, #312c25);
  color: #e8ddd4;
  padding: 1.2em 1.5em;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.6;
  margin: 1.5em 0;
}
.resource-body-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Separatore */
.resource-body-content hr {
  border: none;
  border-top: 1px solid var(--border-light, #d9cfc4);
  margin: 2.5em auto;
  width: 60%;
}

/* Clearfix per immagini float */
.resource-body-content::after {
  content: '';
  display: table;
  clear: both;
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  .resource-body-content {
    color: var(--ink-dark, #e8ddd4);
  }
  .resource-body-content blockquote {
    background: color-mix(in srgb, var(--sienna, #8c3a1c) 8%, #1a1612 92%);
    color: #b8a898;
  }
  .resource-body-content th {
    background: color-mix(in srgb, var(--sienna, #8c3a1c) 15%, #1a1612);
    color: #e8ddd4;
    border-color: #3a3228;
  }
  .resource-body-content td { border-color: #3a3228; }
  .resource-body-content tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
  .resource-body-content pre { background: #0e0c0a; }
  .resource-body-content code { background: rgba(140,58,28,0.15); }
}


/* ─────────────────────────────────────────────────────────────
   5. TOOL BADGES (pagina pubblica)
   ───────────────────────────────────────────────────────────── */

.resource-platform-badge,
.resource-license-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25em 0.7em;
  border-radius: 20px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.resource-platform-badge {
  background: rgba(92,84,73,0.1);
  color: var(--ink, #312c25);
  border: 1px solid rgba(92,84,73,0.2);
}
.resource-license-badge {
  background: color-mix(in srgb, var(--sienna, #8c3a1c) 8%, transparent);
  color: var(--sienna, #8c3a1c);
  border: 1px solid color-mix(in srgb, var(--sienna, #8c3a1c) 25%, transparent);
}

/* Bottone link esterno */
.btn-resource-dl--external {
  background: transparent !important;
  border: 1.5px solid var(--sienna, #8c3a1c) !important;
  color: var(--sienna, #8c3a1c) !important;
}
.btn-resource-dl--external:hover {
  background: var(--sienna, #8c3a1c) !important;
  color: white !important;
}

/* Articolo senza body — card link */
.resource-download-card--article .dl-card-icon { color: var(--graphite, #6b6057); }


/* ─────────────────────────────────────────────────────────────
   6. STEPS TUTORIAL (pagina pubblica)
   ───────────────────────────────────────────────────────────── */

.resource-steps {
  max-width: 72ch;
  margin: 3rem auto;
  padding: 0 var(--page-pad, 1.5rem);
}
.resource-steps-title {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.2rem, 1.4vw + 0.6rem, 1.6rem);
  font-weight: 600;
  color: var(--ink, #312c25);
  margin: 0 0 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-light, #d9cfc4);
}
.resource-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.resource-step-item {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  padding: 1.25rem 1.5rem;
  background: color-mix(in srgb, var(--parchment, #faf7f2) 80%, white 20%);
  border: 1px solid var(--border-light, #d9cfc4);
  border-radius: 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.resource-step-item:hover {
  border-color: color-mix(in srgb, var(--sienna, #8c3a1c) 30%, transparent);
  box-shadow: 0 2px 12px rgba(140,58,28,0.06);
}
.resource-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  background: var(--sienna, #8c3a1c);
  color: white;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 50%;
}
.resource-step-body { flex: 1; min-width: 0; }
.resource-step-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink, #312c25);
  margin: 0 0 0.4rem;
}
.resource-step-desc {
  font-family: "EB Garamond", serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--graphite, #6b6057);
  margin: 0;
}

@media (max-width: 640px) {
  .resource-body-content {
    padding: 0 1rem;
  }
  .resource-steps {
    padding: 0 1rem;
  }
  .resource-body-content figure.image.image-style-side {
    float: none;
    max-width: 100%;
    margin: 1.5em 0;
  }
  .rf2-copy-btn { width: 32px; }
  .rf2-header-meta { flex-direction: column; gap: 0.5rem; }
}

/* Toast notification */
.rf2-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink, #312c25);
  color: var(--parchment, #faf7f2);
  padding: 0.75rem 1.25rem;
  border-radius: 40px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 2000;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.rf2-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.rf2-toast--success {
  background: #2c5e3a;
  border-left: 3px solid #ffcd94;
}
.rf2-toast--info {
  background: var(--sienna, #8c3a1c);
}
.rf2-toast-icon {
  font-size: 1.1rem;
  font-weight: 700;
}
.rf2-toast-message {
  line-height: 1.3;
}

/* Carduri pentru ghiduri / tutoriale */
.resource-body-content--cards .resource-info-card {
  background: var(--amber-hi);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;

}
[data-theme="dark"] .resource-body-content--cards .resource-info-card {
  background: var(--cards);
  border: 1px solid var(--border-dark);
}


.resource-body-content--cards .resource-info-card__title h2 {
  margin-top: 0;
  border-left: 4px solid var(--sienna);
  padding-left: 1rem;
  font-size: 1.4rem;
}
[data-theme="dark"] .resource-body-content--cards .resource-info-card__title h2 {
  color: var(--parchment);
}
.resource-body-content--cards .resource-info-card__body {
  margin-top: 1rem;
  color: var(--ink);
}
[data-theme="dark"] .resource-body-content--cards .resource-info-card__body {
  color: var(--ink);
}
.resource-body-content--cards .resource-card-intro {
  background: color-mix(in srgb, var(--sienna) 8%, transparent);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  font-style: italic;
}
[data-theme="dark"] .resource-body-content--cards .resource-card-intro {
  background: color-mix(in srgb, var(--sienna) 12%, transparent);
  color: var(--ink);
}