/* ═══════════════════════════════════════════════════════════════════════
   /scrape/idealista — "One portal, three countries."
   Photo-gallery feed across Spain, Italy and Portugal. Distinct from
   /scrape/zillow (US map): a sticky hero where scrolling turns each listing
   PHOTO into its scraped JSON, a pan-European multi-country band, a EUR /m2
   bar chart. Purple-forward accents; warm text on purple bands. Chrome via
   _shared. Real DS CTA variants only.
   ═══════════════════════════════════════════════════════════════════════ */
@import "../../_ds/fonts.css";
@import "../../_ds/theme.css";
@import "../../_shared/chrome.css";
@import "../../_shared/components.css";
@import "../../_shared/audience-switcher.css";

.idl-main { position: relative; overflow-x: clip; }

[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity 640ms cubic-bezier(0.22,1,0.36,1), transform 640ms cubic-bezier(0.22,1,0.36,1); }
[data-reveal].is-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }

/* ═══════════════════════════════════════════════════════════════════════
   ACT 1 — sticky hero: scroll morphs each listing photo into its JSON
   ═══════════════════════════════════════════════════════════════════════ */
.idl-hero { position: relative; min-height: 230vh; --p: 0; }
.idl-hero-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; align-items: center; padding: 92px clamp(20px, 5vw, 80px) 48px; }
.idl-hero-grid { width: 100%; max-width: 1360px; margin-inline: auto; display: grid; grid-template-columns: 0.82fr 1.18fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.idl-hero-copy .eyebrow { margin-bottom: 16px; }
.idl-hero-h1 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-hero-xl); line-height: 0.98; letter-spacing: -0.03em; color: var(--text-primary); margin: 0; }
.idl-hero-h1 .l2 { display: block; }
.idl-hero-sub { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.5; color: var(--text-secondary); margin: 22px 0 0; max-width: 42ch; }
.idl-hero-cta { margin-top: 26px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.idl-hero-cta .link-cta { align-self: center; padding-top: 6px; }
.idl-scrollhint { margin: 26px 0 0; font-family: var(--font-code); font-size: 12px; letter-spacing: 0.06em; color: var(--text-quaternary); display: inline-flex; align-items: center; gap: 8px; opacity: calc(1 - var(--p, 0) * 2.4); }
.idl-scrollhint::after { content: "\2193"; }

/* the gallery: cards whose photo crossfades to code as --flip 0->1 */
.idl-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 1.4vw, 18px); }
.idl-card { position: relative; height: clamp(180px, 25vh, 244px); border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; --flip: 0; }
.idl-card-face { position: absolute; inset: 0; }
.idl-card-photo { opacity: calc(1 - var(--flip)); }
.idl-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idl-card-flag { position: absolute; top: 8px; left: 8px; font-family: var(--font-code); font-size: 10.5px; letter-spacing: 0.08em; color: #1D1612; background: rgba(255,255,255,0.9); border-radius: 6px; padding: 3px 7px; }
.idl-card-tag { position: absolute; left: 8px; bottom: 8px; display: inline-flex; gap: 8px; align-items: baseline; font-family: var(--font-code); font-size: 12px; color: #fff; background: rgba(0,0,0,0.55); border-radius: 8px; padding: 5px 9px; }
.idl-card-tag .m2 { color: #C9B6FF; }
.idl-card-code { opacity: var(--flip); background: var(--background); display: flex; align-items: center; padding: 14px 16px; }
.idl-code { font-family: var(--font-code); font-size: var(--mkt-body-xs); line-height: 1.65; color: var(--text-secondary); margin: 0; white-space: pre; }
.idl-code .k { color: #9B7BF0; }
.idl-code .s { color: var(--text-primary); }
.idl-code .n { color: #C9B6FF; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT 2 — one portal, three markets (SOLID purple band, white text)
   ═══════════════════════════════════════════════════════════════════════ */
.idl-markets { --rise: 0; position: relative; overflow: hidden; clip-path: circle(calc(var(--rise) * 155%) at 20% 0%); will-change: clip-path; background: #7C4FE8; padding: clamp(96px, 15vh, 190px) clamp(20px, 5vw, 80px); }
@media (prefers-reduced-motion: reduce) { .idl-markets { clip-path: none; } }
.idl-markets-inner { max-width: 1160px; margin-inline: auto; }
.idl-markets-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h2); line-height: 1.03; letter-spacing: -0.024em; color: #fff; margin: 0; max-width: 16ch; }
.idl-markets-lead { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.5; color: #F3ECFF; margin: 20px 0 0; max-width: 54ch; }
.idl-countries { list-style: none; margin: clamp(40px, 6vh, 68px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2vw, 28px); }
.idl-country { border-top: 1px solid rgba(255,255,255,0.85); padding-top: 18px; }
.idl-country .flag { font-family: var(--font-code); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #EBDDFF; }
.idl-country .dom { font-family: var(--font-display); font-size: var(--mkt-h4); color: #fff; margin: 10px 0 0; letter-spacing: -0.02em; }
.idl-country .stat { font-family: var(--font-code); font-size: 13px; color: #F3ECFF; margin: 10px 0 0; }
.idl-country .stat b { color: #fff; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT 3 — price per m2 by district (dark, animated purple bars)
   ═══════════════════════════════════════════════════════════════════════ */
.idl-perm2 { padding: clamp(100px, 16vh, 200px) clamp(20px, 5vw, 80px); max-width: 1080px; margin-inline: auto; }
.idl-perm2-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h2); line-height: 1.05; letter-spacing: -0.02em; color: var(--text-primary); margin: 0; max-width: 16ch; }
.idl-perm2-lead { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.55; color: var(--text-secondary); margin: 18px 0 0; max-width: 52ch; }
.idl-bars { margin: clamp(44px, 7vh, 80px) 0 0; display: flex; flex-direction: column; gap: 18px; }
.idl-bar { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 20px; }
.idl-bar-label { font-family: var(--font-base); font-size: 14px; color: var(--text-secondary); }
.idl-bar-track { display: block; height: 13px; border-radius: 999px; background: color-mix(in srgb, var(--border-subtle) 55%, transparent); overflow: hidden; }
/* Bars grow via the same proven data-reveal the rest of the page uses (not a
   separate observer): reliable, and it clearly animates from 0 to --pct.
   display:block is required, an inline <span> ignores width/height. */
.idl-bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: #7C4FE8; transition: width 900ms cubic-bezier(0.22,1,0.36,1); }
.idl-bars.is-revealed .idl-bar-fill { width: var(--pct, 0%); }
.idl-bar:nth-child(2) .idl-bar-fill { transition-delay: 80ms; }
.idl-bar:nth-child(3) .idl-bar-fill { transition-delay: 160ms; }
.idl-bar:nth-child(4) .idl-bar-fill { transition-delay: 240ms; }
.idl-bar:nth-child(5) .idl-bar-fill { transition-delay: 320ms; }
.idl-bar:nth-child(6) .idl-bar-fill { transition-delay: 400ms; }
.idl-bar-val { font-family: var(--font-code); font-size: 13.5px; color: var(--text-primary); white-space: nowrap; }
.idl-perm2-note { font-family: var(--font-base); font-size: 13px; color: var(--text-tertiary); margin: 26px 0 0; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT 4 — what stops a plain scraper (dark, 2x2 handled cards)
   ═══════════════════════════════════════════════════════════════════════ */
.idl-why { padding: clamp(100px, 16vh, 200px) clamp(20px, 5vw, 80px); max-width: 1160px; margin-inline: auto; }
.idl-why-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h2); line-height: 1.05; letter-spacing: -0.02em; color: var(--text-primary); margin: 0; max-width: 16ch; }
.idl-why-lead { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.55; color: var(--text-secondary); margin: 18px 0 0; max-width: 54ch; }
.idl-why-list { margin-top: clamp(40px, 6vh, 68px); display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-default, 12px); overflow: hidden; }
.idl-why-item { background: var(--background); padding: 26px 24px 28px; }
.idl-why-tag { display: inline-block; margin-bottom: 14px; }
.idl-why-t { font-family: var(--font-display); font-size: clamp(18px, 1.6vw, 22px); line-height: 1.15; color: var(--text-primary); margin: 0; }
.idl-why-d { font-family: var(--font-base); font-size: 13.5px; line-height: 1.55; color: var(--text-tertiary); margin: 10px 0 0; }
.idl-why-d b { color: var(--text-secondary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT 5 — closer (SOLID teal band). CTA = --purple variant (reads on teal).
   ═══════════════════════════════════════════════════════════════════════ */
.idl-closer { --rise: 0; position: relative; overflow: hidden; clip-path: circle(calc(var(--rise) * 155%) at 80% 0%); will-change: clip-path; background: #7ADAE6; padding: clamp(110px, 20vh, 240px) clamp(20px, 5vw, 80px); }
@media (prefers-reduced-motion: reduce) { .idl-closer { clip-path: none; } }
.idl-closer-inner { max-width: 1100px; margin-inline: auto; }
.idl-closer-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-hero); line-height: 0.96; letter-spacing: -0.03em; color: #1D1612; margin: 0; }
.idl-closer-sub { font-family: var(--font-base); font-size: var(--mkt-lead); line-height: 1.5; color: rgba(29,22,18,0.82); margin: 26px 0 0; max-width: 48ch; }
.idl-closer-cta { margin-top: 38px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.idl-closer-tagline { font-family: var(--font-code); font-size: 13px; letter-spacing: 0.04em; color: rgba(29,22,18,0.62); }
.idl-uses { margin: clamp(40px, 6vh, 64px) 0 0; padding-top: clamp(24px, 3vh, 36px); border-top: 1px solid rgba(29,22,18,0.24); }
.idl-uses-label { font-family: var(--font-code); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(29,22,18,0.62); margin: 0 0 14px; }
.idl-uses-list { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.idl-use { font-family: var(--font-base); font-size: 14px; color: #1D1612; border: 1px solid rgba(29,22,18,0.24); border-radius: 999px; padding: 8px 15px; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT — the feed never stops (dark, full-bleed marquee of listings)
   ═══════════════════════════════════════════════════════════════════════ */
.idl-feed { padding: clamp(88px, 13vh, 168px) 0; overflow: hidden; }
.idl-feed-head { max-width: 1160px; margin: 0 auto clamp(34px, 5vh, 52px); padding: 0 clamp(20px, 5vw, 80px); }
.idl-feed-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h2); line-height: 1.05; letter-spacing: -0.02em; color: var(--text-primary); margin: 0; max-width: 16ch; }
.idl-feed-lead { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.55; color: var(--text-secondary); margin: 18px 0 0; max-width: 54ch; }
.idl-marquee { display: flex; flex-direction: column; gap: 16px; }
.idl-track { display: flex; gap: 16px; width: max-content; will-change: transform; }
.idl-track.a { animation: idlMarqueeA 52s linear infinite; }
.idl-track.b { animation: idlMarqueeB 52s linear infinite; }
.idl-marquee:hover .idl-track { animation-play-state: paused; }
@keyframes idlMarqueeA { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes idlMarqueeB { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .idl-track { animation: none !important; } }
.idl-mcard { flex: 0 0 auto; width: clamp(216px, 20vw, 264px); border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; }
.idl-mcard-photo { position: relative; aspect-ratio: 16 / 11; overflow: hidden; }
.idl-mcard-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idl-mcard-scrape { position: absolute; inset: 0; display: grid; place-content: center; padding: 14px; background: color-mix(in srgb, var(--background) 91%, transparent); opacity: 0; transition: opacity 220ms ease; pointer-events: none; }
.idl-mcard-scrape pre { margin: 0; font-family: var(--font-code); font-size: 11.5px; line-height: 1.7; color: var(--text-secondary); white-space: pre; }
.idl-mcard:hover .idl-mcard-scrape { opacity: 1; }
.idl-mcard-scrape .k { color: #9B7BF0; } .idl-mcard-scrape .s { color: var(--text-primary); } .idl-mcard-scrape .b { color: #C9B6FF; }
.idl-mcard-meta { padding: 10px 13px 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.idl-mcard-price { font-family: var(--font-display); font-size: 16px; color: var(--text-primary); }
.idl-mcard-city { font-family: var(--font-code); font-size: 11.5px; color: #9B7BF0; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT — everything on a listing (dark, bento grid)
   ═══════════════════════════════════════════════════════════════════════ */
.idl-bento { padding: clamp(100px, 16vh, 200px) clamp(20px, 5vw, 80px); max-width: 1200px; margin-inline: auto; }
.idl-bento-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h2); line-height: 1.05; letter-spacing: -0.02em; color: var(--text-primary); margin: 0; max-width: 16ch; }
.idl-bento-lead { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.55; color: var(--text-secondary); margin: 18px 0 0; max-width: 54ch; }
.idl-bento-grid { margin-top: clamp(40px, 6vh, 68px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.idl-cell { border: 1px solid var(--border-subtle); border-radius: 14px; padding: 22px; min-width: 0; }
.idl-cell-k { font-family: var(--font-code); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-quaternary); margin: 0 0 14px; }
.idl-cell.big { grid-column: span 2; grid-row: span 2; }
.idl-cell.wide { grid-column: span 2; }
.idl-bento-json { font-family: var(--font-code); font-size: clamp(11px, 0.9vw, 12.5px); line-height: 1.7; color: var(--text-secondary); margin: 0; white-space: pre; overflow-x: auto; }
.idl-bento-json .k { color: #9B7BF0; } .idl-bento-json .s { color: var(--text-primary); } .idl-bento-json .n { color: #C9B6FF; }
.idl-bignum { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h3); line-height: 1; color: var(--text-primary); letter-spacing: -0.02em; }
.idl-bignum .u { color: #9B7BF0; font-size: 0.5em; }
.idl-energy { display: flex; gap: 5px; align-items: flex-end; }
.idl-energy span { font-family: var(--font-code); font-size: 12px; color: var(--text-quaternary); border: 1px solid var(--border-subtle); border-radius: 5px; padding: 4px 7px; }
.idl-energy span.on { color: #fff; background: #7C4FE8; border-color: #7C4FE8; }
.idl-feat { display: flex; flex-wrap: wrap; gap: 8px; }
.idl-feat span { font-family: var(--font-base); font-size: 13px; color: var(--text-secondary); border: 1px solid var(--border-subtle); border-radius: 999px; padding: 6px 12px; }
.idl-thumbs { display: flex; align-items: center; gap: 8px; }
.idl-thumbs img { width: 44px; height: 34px; object-fit: cover; border-radius: 6px; display: block; }
.idl-thumbs .more { font-family: var(--font-code); font-size: 13px; color: #9B7BF0; }
.idl-cell-txt { font-family: var(--font-base); font-size: 15px; color: var(--text-primary); }
.idl-cell-txt b { color: #9B7BF0; font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════════════
   ACT — search & operations (SOLID purple band)
   ═══════════════════════════════════════════════════════════════════════ */
.idl-ops { --rise: 0; position: relative; overflow: hidden; clip-path: circle(calc(var(--rise) * 155%) at 20% 0%); will-change: clip-path; background: #7C4FE8; padding: clamp(96px, 15vh, 190px) clamp(20px, 5vw, 80px); }
@media (prefers-reduced-motion: reduce) { .idl-ops { clip-path: none; } }
.idl-ops-inner { max-width: 1160px; margin-inline: auto; }
.idl-ops-h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--mkt-h2); line-height: 1.03; letter-spacing: -0.024em; color: #fff; margin: 0; max-width: 16ch; }
.idl-ops-lead { font-family: var(--font-base); font-size: var(--mkt-body); line-height: 1.5; color: #F3ECFF; margin: 20px 0 0; max-width: 54ch; }
.idl-ops-row { display: flex; flex-wrap: wrap; gap: 10px; margin: clamp(32px, 5vh, 52px) 0 0; align-items: center; }
.idl-ops-label { font-family: var(--font-code); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #EBDDFF; margin-right: 6px; }
.idl-op { font-family: var(--font-base); font-size: 14px; color: #fff; border: 1px solid rgba(255,255,255,0.34); border-radius: 999px; padding: 8px 15px; }
.idl-op.on { background: #fff; color: #7C4FE8; border-color: #fff; }
.idl-ops-ends { list-style: none; margin: clamp(28px, 4vh, 40px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.idl-ops-end { border: 1px solid rgba(255,255,255,0.28); border-radius: 12px; padding: 18px 18px 20px; }
.idl-ops-end .k { font-family: var(--font-code); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #EBDDFF; }
.idl-ops-end .u { font-family: var(--font-code); font-size: var(--mkt-body-xs); color: #fff; margin: 10px 0 0; word-break: break-all; }
.idl-ops-end .u b { color: #EBDDFF; }

/* is-on-* topbar inversion (floating topbar). On teal (light) bands the whole
   bar goes dark: logo, all nav links, burger, social. On purple (dark) bands
   the default white chrome already reads, only the CTA flips. */

/* ═══════════════════════════════════════════════════════════════════════
   Mobile / reduced-motion (<=900px)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .idl-hero { min-height: auto; }
  .idl-hero-stage { position: static; height: auto; overflow: visible; padding: 116px 20px 64px; }
  .idl-hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .idl-scrollhint { display: none; }
  /* Scroll-flip is off on mobile, so un-stack each card: show the photo
     ABOVE its JSON record, one property per row. */
  .idl-gallery { grid-template-columns: 1fr; gap: 20px; }
  .idl-card { height: auto; display: flex; flex-direction: column; }
  .idl-card-face { position: relative; inset: auto; opacity: 1; }
  .idl-card-photo { height: clamp(190px, 46vw, 260px); }
  .idl-card-code { background: var(--background); padding: 16px 18px; }
  .idl-code { white-space: pre; overflow-x: auto; max-width: 100%; }
  .idl-countries { grid-template-columns: 1fr; gap: 22px; }
  .idl-country { border-top-width: 1px; }
  .idl-bar { grid-template-columns: 92px 1fr auto; gap: 12px; }
  .idl-why-list { grid-template-columns: 1fr; }
  .idl-bento-grid { grid-template-columns: 1fr; }
  .idl-cell.big, .idl-cell.wide { grid-column: auto; grid-row: auto; }
  .idl-markets, .idl-closer, .idl-ops { clip-path: none !important; }
}
