/* SW page shell — page container, page header and footer for pages migrated to
   the SW design system. Tokens only (load /design-system/styles.css first).
   Pairs with sw-sidebar.css (navigation) and views/shared/sw-footer.js. */

body.sw-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--body-leading);
}

body.sw-shell *,
body.sw-shell *::before,
body.sw-shell *::after { box-sizing: border-box; }

/* The hidden attribute must win over component display rules */
body.sw-shell [hidden] { display: none; }

/* ── Page container ─────────────────────────────────────── */
.sw-page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) var(--space-10);
}

/* ── Page header ────────────────────────────────────────── */
.sw-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
}
.sw-page-header__main { flex: 1 1 24rem; min-width: 0; }
.sw-page-header__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  font-size: var(--text-2xl);
  line-height: 1.2;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.sw-page-header__description {
  max-width: 60ch;
  margin: var(--space-1-5) 0 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.sw-page-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2-5);
}
.sw-page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ── Breadcrumb (detail pages; replaces "Back to…" buttons) ─ */
.sw-breadcrumb { margin-bottom: var(--space-1-5); font-size: var(--text-xs); }
.sw-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1-5); margin: 0; padding: 0; list-style: none; }
.sw-breadcrumb li { display: inline-flex; align-items: center; gap: var(--space-1-5); color: var(--text-subtle); }
.sw-breadcrumb li + li::before { content: "/"; color: var(--border-strong); }
.sw-breadcrumb a { color: var(--text-link); text-decoration: none; border-radius: var(--radius-xs); }
.sw-breadcrumb a:hover { text-decoration: underline; }
.sw-breadcrumb a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.sw-breadcrumb [aria-current="page"] { color: var(--text-secondary); font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────── */
.sw-footer {
  flex: 0 0 auto;
  margin-top: auto;
  border-top: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}
.sw-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
}
.sw-footer__id { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.sw-footer__name { color: var(--text-primary); font-weight: 650; }
.sw-footer__cif { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; }
.sw-footer__links { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); margin: 0; padding: 0; list-style: none; }
.sw-footer__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-1) 0;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-xs);
}
.sw-footer__link:hover { color: var(--accent-text); text-decoration: underline; }
.sw-footer__link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.sw-footer__link .sw-icon { width: var(--icon-sm); height: var(--icon-sm); color: var(--text-subtle); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sw-page { padding: var(--space-5) var(--space-4) var(--space-8); }
  .sw-footer__inner { padding: var(--space-4); }
}
@media (max-width: 640px) {
  .sw-page-header { align-items: stretch; }
  .sw-page-header__title { font-size: var(--text-xl); }
  .sw-page-header__actions { justify-content: flex-start; }
  .sw-footer__link { min-height: var(--hit-min); }
}

/* ── Print: usable on paper (Export PDF uses the browser print dialog) ─ */
@media print {
  .sw-sidebar, .sw-mobilebar, .sw-sidebar-scrim, .sw-footer, .sw-cookie, .c-feedback-button, .sw-toasts { display: none !important; }
  body.sw-shell { padding: 0 !important; background: Canvas; color: CanvasText; }
}
