/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL DE TRANSPARÈNCIA — page-specific styles.
   Builds on shared/styles-v3.css + shared/page-kit.css (toolbar / chips /
   search / count are reused from there).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Masthead ─────────────────────────────────────────────────────────────── */
.tp-hero {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding: 168px 0 70px;
}
.tp-hero__title {
  font-family: var(--ff-display);
  font-size: clamp(40px, 6vw, 78px);
  line-height: 1.02; letter-spacing: -0.02em; font-weight: 600;
  margin: 18px 0 0; color: var(--ink); text-wrap: balance;
}
.tp-hero__title em { font-style: italic; font-weight: 400; color: var(--burgundy); }
.tp-hero__lead {
  font-family: var(--ff-body);
  font-size: clamp(17px, 1.5vw, 20px); line-height: 1.65;
  color: var(--mute); max-width: 62ch; margin: 28px 0 0; text-wrap: pretty;
}
.tp-hero__meta {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 34px;
  font-family: var(--ff-mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute);
}
.tp-hero__meta strong { color: var(--burgundy); font-weight: 500; }
.tp-hero__dot { width: 4px; height: 4px; border-radius: 50%; background: color-mix(in oklch, var(--burgundy) 55%, transparent); }

/* ─── Featured Estatuts (founding document) ────────────────────────────────── */
.tp-estatuts {
  background: var(--burgundy-dark);
  color: #fff;
  border-bottom: 1px solid var(--line);
  padding: 76px 0;
  position: relative;
}
.tp-estatuts::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(to right, transparent, rgba(245,213,166,.4), transparent);
}
.tp-estatuts__inner {
  display: grid; grid-template-columns: auto 1fr; gap: 56px; align-items: center;
}

/* Stylized 3D book — the founding document, built from real CSS-3D faces.
   GSAP poses it (resting tilt) and swings the cover open on hover/focus. */
.tp-book {
  width: 200px; height: 270px; flex-shrink: 0;
  perspective: 1800px; perspective-origin: 56% 46%;
}
.tp-book__inner {
  position: relative; display: block; margin: 4px auto 0;
  width: 196px; height: 260px;
  transform-style: preserve-3d;
  text-decoration: none; cursor: pointer; will-change: transform;
}
.tp-book__back,
.tp-book__cover,
.tp-book__leaf,
.tp-book__spine,
.tp-book__foredge { position: absolute; top: 0; left: 0; }

/* Back board */
.tp-book__back {
  width: 100%; height: 100%;
  background: linear-gradient(150deg, #ede2cf, #d9c8ab);
  transform: translateZ(-13px);
  box-shadow: 0 34px 60px rgba(0,0,0,.46);
  border-radius: 2px 4px 4px 2px;
}
/* Spine (left edge, standing back into depth) */
.tp-book__spine {
  width: 26px; height: 100%;
  transform-origin: left center; transform: rotateY(-90deg);
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 4px),
    linear-gradient(90deg, #5e1620, #7e2030 55%, #6b1a26);
  border-radius: 1px;
}
/* Fore-edge: the visible stack of page edges on the right */
.tp-book__foredge {
  left: auto; right: 0; width: 26px; height: 96%; top: 2%;
  transform-origin: right center; transform: rotateY(90deg);
  background: repeating-linear-gradient(to bottom, #fbf6ec 0 1.5px, #e6dac2 1.5px 3px);
  border-radius: 0 2px 2px 0;
}
/* Inner leaves (fan out on open) */
.tp-book__leaf {
  width: 95%; height: 96%; top: 2%;
  background: linear-gradient(95deg, #fffdf8 0%, #f4ecdc 90%, #e7dcc6 100%);
  transform-origin: left center;
  box-shadow: inset -2px 0 3px rgba(170,140,80,.22);
  border-radius: 1px 3px 3px 1px;
}
/* Cover (two faces: printed front + plain inside) */
.tp-book__cover {
  width: 100%; height: 100%;
  transform-style: preserve-3d; transform-origin: left center;
}
.tp-book__face {
  position: absolute; inset: 0;
  backface-visibility: visible; -webkit-backface-visibility: visible;
  border-radius: 2px 5px 5px 2px;
}
.tp-book__face--front {
  transform: translateZ(6px);
  background: linear-gradient(150deg, #fcf8f2, #efe4d2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 34px 26px;
  box-shadow: inset 14px 0 22px -14px rgba(94,22,32,.35);
}
.tp-book__face--front::before {
  content: ""; position: absolute; inset: 11px;
  border: 1px solid rgba(199,154,58,.55); pointer-events: none;
}
.tp-book__face--back {
  transform: rotateY(180deg) translateZ(6px);
  background: linear-gradient(150deg, #efe4d2, #e1d4ba);
  box-shadow: inset -14px 0 22px -14px rgba(94,22,32,.25);
}
.tp-book__crest { width: 96px; height: auto; opacity: .92; }
.tp-book__rule { width: 34px; height: 1px; background: rgba(139,35,50,.4); }
.tp-book__title {
  font-family: var(--ff-display); font-weight: 600; font-size: 19px;
  letter-spacing: .05em; text-transform: uppercase; color: var(--burgundy);
}
.tp-book__year {
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: .18em; color: var(--mute);
}

/* Simulated body text on the interior pages + inside cover (revealed on open).
   Real child elements (pseudo-elements get culled in this nested 3D context),
   lifted a hair in Z so they paint above the page. Faint ruled rows over a soft
   vertical rhythm read as paragraphs at this scale — not legible, just not empty. */
.tp-book__lines {
  position: absolute; inset: 16% 15% 16% 18%;
  transform: translateZ(0.6px);
  pointer-events: none; opacity: .44;
  background:
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(58,38,24,.55) 5px 6.4px),
    repeating-linear-gradient(90deg, rgba(58,38,24,.16) 0 12px, transparent 12px 16px);
}
.tp-book__lines--inside { inset: 15% 16% 16% 17%; opacity: .38; }
.tp-book__leaf:nth-child(5) .tp-book__lines { background-position: 0 2px, 6px 0; }
.tp-book__leaf:nth-child(6) .tp-book__lines { background-position: 0 1px, -7px 0; }

/* Text + CTA */
.tp-estatuts__body .eyebrow { margin-bottom: 0; }
.tp-estatuts__title {
  font-family: var(--ff-display); font-weight: 600;
  font-size: clamp(34px, 4.6vw, 58px); line-height: 1.02; letter-spacing: -0.02em;
  margin: 16px 0 0; color: #fff; text-wrap: balance;
}
.tp-estatuts__lead {
  font-family: var(--ff-body); font-size: clamp(16px, 1.4vw, 19px); line-height: 1.65;
  color: rgba(255,255,255,.82); max-width: 56ch; margin: 22px 0 0; text-wrap: pretty;
}
.tp-estatuts__actions {
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap; margin-top: 36px;
}
.tp-estatuts__actions .btn { margin: 0; display: inline-flex; align-items: center; gap: 10px; }
.tp-estatuts__meta {
  font-family: var(--ff-mono); font-size: 11.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold-soft);
}
@media (max-width: 760px) {
  .tp-estatuts { padding: 56px 0; }
  .tp-estatuts__inner { grid-template-columns: 1fr; gap: 38px; justify-items: start; }
}

/* ─── Archive section ──────────────────────────────────────────────────────── */
.tp-archive { background: var(--bone); padding: 76px 0 120px; }
.tp-toolbar { align-items: center; justify-content: flex-end; }

/* Right-side tools cluster: year select + search */
.tp-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tp-year { position: relative; }
.tp-year select {
  appearance: none; -webkit-appearance: none;
  font-family: var(--ff-ui); font-size: 13px; font-weight: 500;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line);
  padding: 13px 40px 13px 16px; cursor: pointer;
  transition: border-color .25s ease;
}
.tp-year select:focus { outline: none; border-color: var(--burgundy); }
.tp-year__chev {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--mute); pointer-events: none;
}

.tp-count { margin-bottom: 26px; }

/* ─── Document grid + cards ────────────────────────────────────────────────── */
.tp-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
@media (max-width: 920px) { .tp-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tp-grid { grid-template-columns: 1fr; } }

/* Card grid inside an accordion group (browse mode) */
.tp-acc__docs { padding: 4px 0 44px; }

.doc-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line);
  padding: 26px 26px 22px; min-height: 248px;
  text-decoration: none; color: var(--ink);
  transition: border-color .35s ease, transform .35s ease, box-shadow .35s ease;
}
.doc-card:hover {
  border-color: color-mix(in oklch, var(--burgundy) 42%, var(--line));
  transform: translateY(-4px);
  box-shadow: 0 18px 42px rgba(60, 12, 25, .10);
}
.doc-card__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 26px;
}
.doc-card__ext {
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em;
  color: var(--burgundy); border: 1px solid color-mix(in oklch, var(--burgundy) 35%, var(--line));
  padding: 4px 8px; line-height: 1;
}
.doc-card__year {
  font-family: var(--ff-display); font-style: italic; font-weight: 500;
  font-size: 30px; line-height: .9; color: var(--burgundy);
}
.doc-card__main { flex: 1; }
.doc-card__title {
  font-family: var(--ff-display); font-size: 21px; line-height: 1.2;
  letter-spacing: -0.01em; font-weight: 600; color: var(--ink); margin: 0;
  text-wrap: pretty;
}
.doc-card__date {
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--mute); margin-top: 9px;
}
.doc-card__desc {
  font-family: var(--ff-body); font-size: 14.5px; line-height: 1.6;
  color: var(--mute); margin: 12px 0 0; text-wrap: pretty;
}
.doc-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
}
.doc-card__cat {
  font-family: var(--ff-ui); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--mute);
}
.doc-card__dl {
  font-family: var(--ff-ui); font-size: 12.5px; font-weight: 600;
  color: var(--burgundy); display: inline-flex; align-items: center; gap: 7px;
}
.doc-card__dl svg { transition: transform .3s ease; }
.doc-card:hover .doc-card__dl svg { transform: translateY(3px); }

/* Closing note */
.tp-footnote {
  margin: 48px 0 0; padding-top: 28px; border-top: 1px solid var(--line);
  font-family: var(--ff-body); font-size: 14px; line-height: 1.6;
  color: var(--mute); max-width: 80ch;
}

@media (max-width: 700px) {
  .tp-hero { padding: 132px 0 56px; }
  .tp-archive { padding: 60px 0 90px; }
  .tp-tools { width: 100%; }
  .pk-search { flex: 1 1 auto; }
}
