/* Página de portafolio v2 — estilos aislados para no afectar el resto del sitio. */
.portfolio-page-v2 {
  --pf-bg: #04111d;
  --pf-surface: rgba(10, 29, 46, 0.86);
  --pf-surface-strong: #0a2032;
  --pf-soft: rgba(255, 255, 255, 0.05);
  --pf-line: rgba(205, 224, 238, 0.15);
  --pf-line-strong: rgba(53, 180, 181, 0.34);
  --pf-text: #f6f8fa;
  --pf-muted: #aab7c4;
  --pf-accent: #35b4b5;
  --pf-accent-2: #5f8cff;
  --pf-gold: #d7bb82;
  --pf-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

html[data-theme="light"] .portfolio-page-v2 {
  --pf-bg: #f4f7f9;
  --pf-surface: rgba(255, 255, 255, 0.9);
  --pf-surface-strong: #ffffff;
  --pf-soft: rgba(14, 58, 90, 0.055);
  --pf-line: rgba(14, 58, 90, 0.14);
  --pf-line-strong: rgba(14, 116, 124, 0.32);
  --pf-text: #071827;
  --pf-muted: #536978;
  --pf-accent: #0e747c;
  --pf-accent-2: #445fbf;
  --pf-shadow: 0 28px 80px rgba(14, 58, 90, 0.14);
}

.portfolio-page-v2 main { overflow: clip; }
.portfolio-page-v2 .section { position: relative; }

/* Hero */
.pf-hero {
  position: relative;
  isolation: isolate;
  min-height: 720px;
  display: grid;
  align-items: center;
  padding: clamp(9rem, 14vw, 11.5rem) 0 clamp(5rem, 8vw, 7rem);
  overflow: hidden;
  color: #f6f8fa;
  background:
    radial-gradient(circle at 80% 18%, rgba(53, 180, 181, 0.2), transparent 26rem),
    radial-gradient(circle at 8% 82%, rgba(95, 140, 255, 0.16), transparent 28rem),
    linear-gradient(145deg, #020b13 0%, #071827 50%, #0a2032 100%);
}

html[data-theme="light"] .pf-hero {
  color: #071827;
  background:
    radial-gradient(circle at 80% 18%, rgba(53, 180, 181, 0.18), transparent 28rem),
    radial-gradient(circle at 8% 82%, rgba(95, 140, 255, 0.12), transparent 30rem),
    linear-gradient(145deg, #eef6f8 0%, #f7fafb 55%, #eaf2f6 100%);
}

.pf-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: -2;
  height: 180px;
  background: linear-gradient(to bottom, transparent, var(--pf-bg));
}

.pf-hero-grid {
  position: absolute;
  inset: 0;
  z-index: -4;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(115, 202, 210, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(115, 202, 210, 0.15) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 94%);
}

.pf-glow {
  position: absolute;
  z-index: -1;
  width: 340px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.22;
  pointer-events: none;
}
.pf-glow-one { top: 12%; right: 7%; background: var(--pf-accent); }
.pf-glow-two { bottom: 4%; left: 2%; background: var(--pf-accent-2); }

.pf-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(330px, 0.72fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

.pf-hero-copy { max-width: 850px; }
.pf-hero .breadcrumb { margin-bottom: 2rem; }
.pf-hero h1 {
  max-width: 920px;
  margin: 0;
  color: inherit;
  font-size: clamp(2.9rem, 6vw, 5.9rem);
  line-height: 0.99;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.pf-gradient-text {
  display: block;
  margin-top: 0.13em;
  color: transparent;
  background: linear-gradient(105deg, #ffffff 0%, #62d8dc 52%, #91a6ff 100%);
  background-clip: text;
  -webkit-background-clip: text;
}
html[data-theme="light"] .pf-gradient-text {
  background: linear-gradient(105deg, #0a3148 0%, #0e747c 52%, #485fc0 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.pf-hero-lead {
  max-width: 760px;
  margin: 1.9rem 0 0;
  color: #b9c9d3;
  font-size: clamp(1.03rem, 1.6vw, 1.22rem);
  line-height: 1.78;
}
html[data-theme="light"] .pf-hero-lead { color: #4f6877; }

.pf-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2.1rem;
}
.pf-hero-actions .button { min-height: 50px; }

.pf-trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.4rem;
  margin: 2rem 0 0;
  padding: 0;
  color: #b6c8d3;
  list-style: none;
  font-size: 0.9rem;
}
html[data-theme="light"] .pf-trust-list { color: #536978; }
.pf-trust-list li { display: inline-flex; align-items: center; gap: 0.5rem; }
.pf-check {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid rgba(53, 180, 181, 0.4);
  border-radius: 50%;
  color: #52d9d9;
  background: rgba(53, 180, 181, 0.1);
  font-size: 0.7rem;
  font-weight: 900;
}

.pf-summary {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  border: 1px solid rgba(115, 202, 210, 0.24);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(22px);
}
html[data-theme="light"] .pf-summary {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(237, 247, 249, 0.88));
  box-shadow: 0 34px 100px rgba(14, 58, 90, 0.15);
}
.pf-summary::before {
  content: "";
  position: absolute;
  top: -92px;
  right: -92px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(53, 180, 181, 0.15);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(53, 180, 181, 0.04), 0 0 0 76px rgba(53, 180, 181, 0.022);
}
.pf-summary-status { display: flex; align-items: center; gap: 0.65rem; color: #b9cdd8; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
html[data-theme="light"] .pf-summary-status { color: #526a78; }
.pf-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #45e49f; box-shadow: 0 0 0 6px rgba(69, 228, 159, 0.1); }
.pf-summary-total { display: flex; align-items: baseline; gap: 0.9rem; margin-top: 2rem; }
.pf-summary-total strong { color: #fff; font-size: clamp(4.2rem, 8vw, 6.5rem); line-height: 0.85; letter-spacing: -0.07em; }
html[data-theme="light"] .pf-summary-total strong { color: #071827; }
.pf-summary-total span { max-width: 120px; color: #a9bec9; line-height: 1.35; }
html[data-theme="light"] .pf-summary-total span { color: #596f7c; }
.pf-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 2rem; }
.pf-summary-grid > div { padding: 1rem; border: 1px solid rgba(205, 224, 238, 0.14); border-radius: 16px; background: rgba(255, 255, 255, 0.035); }
html[data-theme="light"] .pf-summary-grid > div { background: rgba(14, 58, 90, 0.035); }
.pf-summary-grid strong, .pf-summary-grid span { display: block; }
.pf-summary-grid strong { margin-bottom: 0.22rem; color: #edf7fa; font-size: 1rem; }
html[data-theme="light"] .pf-summary-grid strong { color: #0a3046; }
.pf-summary-grid span { color: #90a7b4; font-size: 0.78rem; line-height: 1.45; }
html[data-theme="light"] .pf-summary-grid span { color: #637986; }
.pf-summary-focus { margin-top: 0.85rem; padding: 1rem; border: 1px solid rgba(215, 187, 130, 0.2); border-radius: 16px; background: rgba(215, 187, 130, 0.06); }
.pf-summary-focus span, .pf-summary-focus strong { display: block; }
.pf-summary-focus span { margin-bottom: 0.24rem; color: #b5a27c; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; }
.pf-summary-focus strong { color: #ecd39f; font-size: 0.9rem; }
html[data-theme="light"] .pf-summary-focus strong { color: #76591f; }

/* Explorer */
.pf-explorer, .pf-method { background: var(--pf-bg); }
.pf-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 0.55fr); gap: 2rem; align-items: end; margin-bottom: 2.2rem; }
.pf-heading h2 { max-width: 820px; margin: 0; color: var(--pf-text); font-size: clamp(2rem, 4.4vw, 3.55rem); line-height: 1.08; letter-spacing: -0.04em; text-wrap: balance; }
.pf-heading > p { margin: 0; color: var(--pf-muted); line-height: 1.75; }

.pf-toolbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.pf-search { position: relative; display: flex; flex: 1 1 560px; align-items: center; max-width: 720px; }
.pf-search > svg { position: absolute; left: 1.05rem; width: 19px; height: 19px; color: var(--pf-muted); pointer-events: none; }
.pf-search input { width: 100%; min-height: 54px; padding: 0.85rem 3.2rem 0.85rem 3rem; border: 1px solid var(--pf-line); border-radius: 17px; outline: none; color: var(--pf-text); background: var(--pf-surface); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); transition: border-color .18s ease, box-shadow .18s ease; }
.pf-search input::placeholder { color: var(--pf-muted); opacity: 0.72; }
.pf-search input:focus { border-color: var(--pf-accent); box-shadow: 0 0 0 4px rgba(53, 180, 181, 0.11); }
.pf-search button { position: absolute; right: 0.68rem; display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 50%; color: var(--pf-muted); background: transparent; cursor: pointer; font-size: 1.45rem; }
.pf-search button:hover { color: var(--pf-text); background: var(--pf-soft); }
.pf-result-count { display: inline-flex; align-items: center; min-height: 42px; padding: 0.65rem 0.9rem; border: 1px solid var(--pf-line); border-radius: 999px; color: var(--pf-muted); background: var(--pf-surface); white-space: nowrap; font-size: 0.86rem; }

.pf-filters { display: flex; gap: 0.62rem; overflow-x: auto; margin: 0 -0.25rem 2rem; padding: 0.25rem 0.25rem 0.75rem; scrollbar-width: thin; overscroll-behavior-inline: contain; }
.pf-filter { flex: 0 0 auto; min-height: 42px; padding: 0.68rem 1rem; border: 1px solid var(--pf-line); border-radius: 999px; color: var(--pf-muted); background: var(--pf-soft); cursor: pointer; font: inherit; font-size: 0.86rem; transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease; }
.pf-filter:hover { transform: translateY(-1px); color: var(--pf-text); border-color: var(--pf-line-strong); }
.pf-filter.is-active { color: #04161f; border-color: transparent; background: linear-gradient(135deg, #4dd7d8, #54acd3); box-shadow: 0 10px 28px rgba(53, 180, 181, 0.2); font-weight: 800; }

.pf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.45rem); }
.pf-card { position: relative; display: flex; min-width: 0; overflow: hidden; flex-direction: column; border: 1px solid var(--pf-line); border-radius: 22px; background: var(--pf-surface); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.09); transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; }
.pf-card:hover { transform: translateY(-6px); border-color: var(--pf-line-strong); box-shadow: var(--pf-shadow); }
.pf-card-media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; background: linear-gradient(135deg, rgba(53, 180, 181, 0.12), rgba(95, 140, 255, 0.12)), var(--pf-surface-strong); }
.pf-card-media::after { content: ""; position: absolute; inset: auto 0 0; height: 46%; background: linear-gradient(to bottom, transparent, rgba(2, 16, 25, 0.58)); pointer-events: none; }
.pf-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .55s cubic-bezier(.2,.7,.2,1); }
.pf-card:hover .pf-card-media img { transform: scale(1.045); }
.pf-card-index { position: absolute; top: 0.88rem; left: 0.88rem; z-index: 1; display: inline-flex; min-width: 36px; height: 28px; align-items: center; justify-content: center; padding: 0 .55rem; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #eaf8fb; background: rgba(5,22,33,.64); backdrop-filter: blur(12px); font-size: .72rem; font-weight: 800; letter-spacing: .07em; }
.pf-card-open { position: absolute; right: .88rem; bottom: .88rem; z-index: 2; display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; color: #fff; background: rgba(5,22,33,.7); backdrop-filter: blur(12px); cursor: pointer; transition: transform .18s ease, background .18s ease; }
.pf-card-open:hover { transform: translateY(-2px) rotate(-4deg); background: rgba(14, 116, 124, .94); }
.pf-card-open svg { width: 18px; height: 18px; }
.pf-card-body { display: flex; flex: 1; flex-direction: column; padding: 1.25rem; }
.pf-category { display: inline-flex; width: fit-content; align-items: center; min-height: 26px; padding: .3rem .58rem; border: 1px solid rgba(53,180,181,.2); border-radius: 999px; color: var(--pf-accent); background: rgba(53,180,181,.065); font-size: .69rem; font-weight: 800; letter-spacing: .045em; line-height: 1.25; text-transform: uppercase; }
.pf-card h3 { margin: .88rem 0 .55rem; color: var(--pf-text); font-size: clamp(1.15rem, 1.6vw, 1.42rem); line-height: 1.2; letter-spacing: -.025em; }
.pf-card-description { display: -webkit-box; overflow: hidden; margin: 0; color: var(--pf-muted); line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.pf-tags { display: flex; flex-wrap: wrap; gap: .42rem; }
.pf-card .pf-tags { margin-top: 1rem; }
.pf-tag { display: inline-flex; align-items: center; min-height: 25px; padding: .3rem .55rem; border-radius: 8px; color: var(--pf-muted); background: var(--pf-soft); font-size: .71rem; }
.pf-card-footer { display: flex; gap: .8rem; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 1.15rem; }
.pf-detail-button { display: inline-flex; align-items: center; gap: .45rem; border: 0; padding: 0; color: var(--pf-text); background: transparent; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 800; }
.pf-detail-button::after { content: "→"; color: var(--pf-accent); transition: transform .18s ease; }
.pf-detail-button:hover::after { transform: translateX(4px); }
.pf-external { display: inline-flex; align-items: center; gap: .4rem; color: var(--pf-muted); font-size: .79rem; text-decoration: none; }
.pf-external:hover { color: var(--pf-accent); }
.pf-external svg { width: 15px; height: 15px; }

.pf-more { display: flex; justify-content: center; margin-top: 2rem; }
.pf-more .button { min-width: 210px; }
.pf-empty { max-width: 560px; margin: 2.5rem auto 0; padding: 2.4rem; border: 1px dashed var(--pf-line-strong); border-radius: 22px; text-align: center; background: var(--pf-soft); }
.pf-empty-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 1rem; place-items: center; border-radius: 18px; color: var(--pf-accent); background: rgba(53,180,181,.09); }
.pf-empty-icon svg { width: 24px; height: 24px; }
.pf-empty h3 { margin: 0; color: var(--pf-text); }
.pf-empty p { margin: .65rem 0 1.2rem; color: var(--pf-muted); }

/* Método */
.pf-method { padding-top: clamp(4.5rem, 8vw, 7rem); }
.pf-method-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.pf-method-card { min-height: 230px; padding: 1.35rem; border: 1px solid var(--pf-line); border-radius: 22px; background: linear-gradient(145deg, var(--pf-surface), var(--pf-soft)); }
.pf-method-card > span { display: inline-grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--pf-accent); background: rgba(53,180,181,.09); font-size: .79rem; font-weight: 900; }
.pf-method-card h3 { margin: 1.2rem 0 .55rem; color: var(--pf-text); font-size: 1.24rem; }
.pf-method-card p { margin: 0; color: var(--pf-muted); line-height: 1.7; }
.pf-proposal { border-color: rgba(53,180,181,.25); }

/* Modal */
.pf-modal[hidden] { display: none; }
.pf-modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 1rem; }
.pf-modal-backdrop { position: absolute; inset: 0; background: rgba(1,10,17,.8); backdrop-filter: blur(12px); animation: pf-fade .18s ease both; }
.pf-modal-dialog { position: relative; z-index: 1; display: grid; overflow: hidden; width: min(1040px, 100%); max-height: min(88vh, 820px); grid-template-columns: minmax(0,.92fr) minmax(0,1.08fr); border: 1px solid var(--pf-line-strong); border-radius: 26px; outline: none; background: var(--pf-surface-strong); box-shadow: 0 36px 120px rgba(0,0,0,.46); animation: pf-modal-in .22s cubic-bezier(.2,.75,.2,1) both; }
.pf-modal-close { position: absolute; top: .85rem; right: .85rem; z-index: 3; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; color: #fff; background: rgba(4,20,31,.74); backdrop-filter: blur(10px); cursor: pointer; font-size: 1.5rem; }
.pf-modal-media { min-height: 470px; background: #071827; }
.pf-modal-media img { width: 100%; height: 100%; object-fit: cover; }
.pf-modal-content { overflow-y: auto; padding: clamp(1.7rem, 4vw, 3rem); }
.pf-modal-content h2 { margin: 1rem 0 .75rem; color: var(--pf-text); font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; letter-spacing: -.045em; }
.pf-modal-description { margin: 0; color: var(--pf-muted); font-size: 1.01rem; line-height: 1.75; }
.pf-modal-details { display: grid; gap: .8rem; margin-top: 1.5rem; }
.pf-modal-details > div { padding: 1rem; border: 1px solid var(--pf-line); border-radius: 15px; background: var(--pf-soft); }
.pf-modal-details > div > span { display: block; margin-bottom: .45rem; color: var(--pf-accent); font-size: .7rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.pf-modal-details p { margin: 0; color: var(--pf-muted); line-height: 1.65; }
.pf-modal-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }
body.pf-modal-open { overflow: hidden; }

@keyframes pf-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pf-modal-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .pf-hero-layout { grid-template-columns: minmax(0,1fr) minmax(310px,.62fr); gap: 2.4rem; }
  .pf-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pf-method-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  .pf-hero { min-height: auto; padding-top: 8.5rem; }
  .pf-hero-layout, .pf-heading { grid-template-columns: 1fr; }
  .pf-hero-copy { max-width: none; }
  .pf-summary { max-width: 620px; }
  .pf-heading { gap: 1rem; align-items: start; }
  .pf-modal-dialog { overflow-y: auto; max-height: 92vh; grid-template-columns: 1fr; }
  .pf-modal-media { min-height: 260px; max-height: 340px; }
  .pf-modal-content { overflow: visible; }
}

@media (max-width: 640px) {
  .pf-hero { padding-top: 7.5rem; }
  .pf-hero h1 { font-size: clamp(2.4rem, 13vw, 4rem); }
  .pf-hero-actions { align-items: stretch; flex-direction: column; }
  .pf-hero-actions .button { width: 100%; }
  .pf-trust-list { display: grid; grid-template-columns: 1fr; }
  .pf-summary-grid { grid-template-columns: 1fr; }
  .pf-toolbar { align-items: stretch; flex-direction: column; }
  .pf-search { flex-basis: auto; max-width: none; }
  .pf-result-count { align-self: flex-end; }
  .pf-grid, .pf-method-grid { grid-template-columns: 1fr; }
  .pf-card-body { padding: 1.1rem; }
  .pf-card-description { -webkit-line-clamp: 4; }
  .pf-method-card { min-height: auto; }
  .pf-modal { align-items: end; padding: 0; }
  .pf-modal-dialog { width: 100%; max-height: 94vh; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 24px 24px 0 0; }
  .pf-modal-media { min-height: 220px; max-height: 250px; }
  .pf-modal-content { padding: 1.35rem; }
  .pf-modal-actions { align-items: stretch; flex-direction: column; }
  .pf-modal-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-card, .pf-card-media img, .pf-filter, .pf-card-open, .pf-detail-button::after { transition: none !important; }
  .pf-modal-backdrop, .pf-modal-dialog { animation: none !important; }
}

@media print {
  .pf-toolbar, .pf-filters, .pf-more, .pf-card-open, .pf-card-footer, .pf-modal { display: none !important; }
  .pf-grid { grid-template-columns: repeat(2,1fr); }
  .pf-card { break-inside: avoid; box-shadow: none; }
}
