/*
  Homepage only. Loaded after style.css and ui.css.
  Layout: framed "street" intro (houses rise in a wave, title + rotating line drop in, a pin lands on a home)
  → "All of Ireland" dot map with county pings and stats → feature cards with cursor glow → CTA.
  Theme comes from theme.js (data-theme on <html>, from the device setting; light by default).
*/

/* ---------- homepage-only tokens: street scene and map ---------- */
:root {
  /* street scene — day */
  --s-sky-top: #5fb2ff;
  --s-sky-bot: #d6ecff;
  --s-sun: #fff2c4;
  --s-wall-a: #f2ede4;
  --s-wall-b: #e6eef8;
  --s-wall-c: #dde6f0;
  --s-roof: #31507d;
  --s-win: #9fc3e6;
  --s-win-lit: #fff8dc;
  --s-ground: #3d6b4a;
  --s-title: #0b2346;
  --s-star: 0;
  /* map dots */
  --m-dot: #1f7fe0;
  --m-hit: #17a673;
  --m-pin: #e0861f;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --s-sky-top: #0b1f3d;
  --s-sky-bot: #2c4f86;
  --s-sun: #ff9d6b;
  --s-wall-a: #13284a;
  --s-wall-b: #1a3460;
  --s-wall-c: #0f2240;
  --s-roof: #0a172b;
  --s-win: #20365a;
  --s-win-lit: #ffcf6b;
  --s-ground: #07101d;
  --s-title: #ffffff;
  --s-star: 0.75;
  --m-dot: #eef4fb;
  --m-hit: #3ee69a;
  --m-pin: #ffcf6b;
}

/* ---------- street intro ---------- */
.street { padding: 20px 0 0; }
.street-frame {
  position: relative; overflow: hidden; border-radius: 28px; border: 1px solid rgba(255,255,255,.08);
  min-height: 520px; height: min(78vh, 640px);
  background: radial-gradient(70% 60% at 50% 100%, var(--s-sun), transparent 70%), linear-gradient(var(--s-sky-top), var(--s-sky-bot));
  transition: background .8s;
}
.street-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.street-head { position: absolute; z-index: 2; inset: 8% 16px auto; text-align: center; color: var(--s-title); transition: color .8s; }
.street-logo { font-family: var(--font-display); font-weight: 800; font-size: clamp(52px, 10vw, 128px); line-height: .92; letter-spacing: -0.035em; }
.street-logo span { display: inline-block; }
.street-logo .spot { color: var(--h-blue); }
.street-slogan { font-size: clamp(18px, 2.4vw, 27px); font-weight: 600; margin-top: 12px; }
/* inline-block (not inline-grid) so a copy reads as one line: "Find your next home in Galway." */
.rot { display: inline-block; position: relative; vertical-align: bottom; color: var(--h-blue); text-align: left; white-space: nowrap; transition: width .5s cubic-bezier(.2,.8,.2,1); }
:root[data-theme="dark"] .rot { color: #7cc2ff; }
.rot > span { display: inline-block; white-space: nowrap; transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .6s; }
.rot > span:not(.on) { transform: translateY(60%); opacity: 0; }
.rot > span.gone { position: absolute; left: 0; top: 0; transform: translateY(-60%); opacity: 0; user-select: none; }
.street-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.street-actions .btn-primary { box-shadow: 0 12px 30px -12px rgba(31,127,224,.9); }
.btn-glass { background: color-mix(in srgb, var(--s-title) 10%, transparent); color: var(--s-title); border: 1.5px solid color-mix(in srgb, var(--s-title) 30%, transparent); backdrop-filter: blur(6px); }
.btn-glass:hover { background: color-mix(in srgb, var(--s-title) 18%, transparent); }

.house { transform-box: fill-box; transform-origin: 50% 100%; }
.wall-a { fill: var(--s-wall-a); } .wall-b { fill: var(--s-wall-b); } .wall-c { fill: var(--s-wall-c); }
.roof { fill: var(--s-roof); }
.win { fill: var(--s-win); transition: fill .8s; }
.win.lit { fill: var(--s-win-lit); }
.ground { fill: var(--s-ground); }
.door-1 { fill: #d7263d; } .door-2 { fill: #1b998b; } .door-3 { fill: #f4b400; } .door-4 { fill: #2e5bdc; } .door-5 { fill: #7b2cbf; }
.star { fill: #fff; opacity: var(--s-star); transition: opacity .8s; }

.street-pin { position: absolute; z-index: 3; transform: translate(-50%, -100%); pointer-events: none; }
.street-pin svg { display: block; width: 34px; height: 44px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.street-pin::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 14px; height: 6px; margin-left: -7px; border-radius: 50%; background: rgba(47,155,255,.6); animation: sr-ring 1.8s ease-out infinite; }
@keyframes sr-ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(4); opacity: 0; } }
.street-note { position: absolute; z-index: 3; transform: translateY(-100%); background: rgba(8,18,31,.88); border: 1px solid #1d3350; color: #eef4fb; border-radius: 14px; padding: 9px 12px; font-size: 13px; white-space: nowrap; backdrop-filter: blur(6px); box-shadow: 0 16px 40px -16px rgba(0,0,0,.6); }
.street-note b { display: block; font-weight: 600; }
.street-note small { color: #93a7c0; }
.street-note .price { color: #3ee69a; font-weight: 600; }

/* intro: only runs while .play is on the frame; without JS or with reduced motion everything is simply visible */
.play .house { animation: sr-rise .75s cubic-bezier(.34,1.56,.64,1) both; animation-delay: var(--d); }
@keyframes sr-rise { from { transform: translateY(105%) scaleY(.6); } to { transform: none; } }
.play .win.lit { animation: sr-light .5s ease-out both; animation-delay: var(--wd); }
@keyframes sr-light { from { fill: var(--s-win); } to { fill: var(--s-win-lit); } }
.play .star { animation: sr-tw 3s ease-in-out infinite; animation-delay: var(--sd); }
@keyframes sr-tw { 50% { opacity: calc(var(--s-star) * .2); } }
.play .street-logo span { animation: sr-drop .7s cubic-bezier(.2,.9,.3,1.2) both; animation-delay: calc(var(--t0) + var(--i) * 55ms); }
@keyframes sr-drop { from { transform: translateY(-50px) rotate(-8deg); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }
.play .street-slogan, .play .street-actions { animation: sr-fade .8s ease-out both; animation-delay: calc(var(--t0) + .55s); }
.play .street-actions { animation-delay: calc(var(--t0) + .8s); }
@keyframes sr-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* the pin cycles between houses (home.js adds .drop/.show, then .lift before moving on) */
.street-pin, .street-note { opacity: 0; }
.street-pin.drop { opacity: 1; animation: sr-pin .7s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes sr-pin { from { transform: translate(-50%, -260%); opacity: 0; } to { transform: translate(-50%, -100%); opacity: 1; } }
.street-note.show { opacity: 1; animation: sr-note .5s ease-out .45s both; }
@keyframes sr-note { from { opacity: 0; transform: translate(0, calc(-100% + 12px)); } to { opacity: 1; transform: translateY(-100%); } }
/* leaving: the pin floats up and fades, the alert just fades (home.js waits 450ms before the next drop) */
.street-pin.lift { animation: sr-pin-out .45s ease-in forwards; }
@keyframes sr-pin-out { from { transform: translate(-50%, -100%); opacity: 1; } to { transform: translate(-50%, -230%); opacity: 0; } }
.street-note.lift { animation: sr-note-out .3s ease-out forwards; }
@keyframes sr-note-out { from { opacity: 1; transform: translateY(-100%); } to { opacity: 0; transform: translateY(-100%); } }
.house.picked .win { fill: var(--s-win-lit); }

/* splash: shown only when JS is on (theme.js sets .has-splash), fades out right before the intro */
.splash { display: none; }
.has-splash .splash { display: grid; place-items: center; position: fixed; inset: 0; z-index: 500; background: var(--h-bg); transition: opacity .55s ease; animation: sr-splash-failsafe .5s ease 5s forwards; }
.splash img { width: 76px; height: 76px; animation: sr-breathe 1.4s ease-in-out infinite; }
@keyframes sr-breathe { 50% { transform: scale(.92); opacity: .75; } }
.splash.out { opacity: 0; pointer-events: none; }
@keyframes sr-splash-failsafe { to { opacity: 0; visibility: hidden; } }

/* ---------- all of Ireland ---------- */
.ireland-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.ireland-copy { display: grid; gap: 16px; }
.ireland-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.ireland-stats div { border: 1px solid var(--h-line); background: var(--h-surface); border-radius: 16px; padding: 16px; }
.ireland-stats b { display: block; font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 3.4vw, 40px); line-height: 1; font-variant-numeric: tabular-nums; }
.ireland-stats span { color: var(--h-muted); font-size: 14px; }
.ireland-map { position: relative; max-width: 460px; width: 100%; margin-inline: auto; }
.ireland-map canvas { width: 100%; aspect-ratio: 4 / 5; display: block; }
.ireland-ticker { display: grid; gap: 6px; width: min(320px, 100%); min-height: 156px; margin: 8px auto 0; font-size: 13px; align-content: start; }
.ireland-ticker div { background: var(--h-surface); color: var(--h-fg); border: 1px solid var(--h-line); border-left: 4px solid var(--h-ok); border-radius: 10px; padding: 7px 10px; box-shadow: 0 10px 24px -14px rgba(0,0,0,.4); animation: sr-tick .5s cubic-bezier(.2,.8,.2,1) both; }
.ireland-ticker small { display: block; color: var(--h-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
@keyframes sr-tick { from { transform: translateX(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.map-note { position: absolute; right: 0; top: 0; display: inline-flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--h-muted); }
.map-note[hidden] { display: none; }
.map-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--h-ok); animation: live-dot 1.6s ease-out infinite; }
@keyframes live-dot { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--h-ok) 60%, transparent); } to { box-shadow: 0 0 0 8px transparent; } }
.ireland-ticker div.live { border-left-color: var(--h-blue); }

/* ---------- AI analysis ---------- */
.ai-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 56px; align-items: center; }
.ai-copy { display: grid; gap: 16px; justify-items: start; }
.ai-points { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 12px; }
.ai-points li { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; font-size: 15.5px; line-height: 1.5; color: var(--h-muted); }
.ai-points li i { font-style: normal; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--h-blue) 11%, transparent); }
.ai-points b { color: var(--h-fg); font-weight: 700; }
.ai-demo { position: relative; display: grid; justify-items: end; gap: 8px; min-width: 0; }
.ai-phone {
  width: min(380px, 100%); border-radius: 30px; overflow: hidden; border: 1px solid var(--h-line);
  box-shadow: 0 40px 80px -40px rgba(8, 18, 31, .55);
  --tg-bg: #dfe8f0; --tg-bubble: #ffffff; --tg-bar: #ffffff; --tg-text: #1c1c1e; --tg-muted: #6b7a8c; --tg-accent: #2481cc;
  background: var(--tg-bg); color: var(--tg-text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
}
:root[data-theme="dark"] .ai-phone { --tg-bg: #0e1621; --tg-bubble: #182533; --tg-bar: #17212b; --tg-text: #e8eef5; --tg-muted: #8ea2b8; --tg-accent: #5eb5f7; }
.ai-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--tg-bar); border-bottom: 1px solid rgba(127,127,127,.15); }
.ai-top img { width: 32px; height: 32px; border-radius: 50%; }
.ai-top b { display: block; font-size: 14.5px; line-height: 1.2; }
.ai-top small { font-size: 12px; color: var(--tg-accent); }
.ai-chat { display: grid; gap: 8px; padding: 14px 12px 16px; }
.ai-msg { justify-self: start; max-width: 94%; background: var(--tg-bubble); border-radius: 16px 16px 16px 4px; padding: 9px 12px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.ai-btn { display: block; margin-top: 8px; padding: 8px; border-radius: 10px; text-align: center; font-weight: 600; color: var(--tg-accent); background: color-mix(in srgb, var(--tg-accent) 12%, transparent); }
.ai-btn.press { animation: ai-press .5s ease; }
@keyframes ai-press { 40% { transform: scale(.95); background: color-mix(in srgb, var(--tg-accent) 26%, transparent); } }
.ai-line { margin: 0 0 7px; }
.ai-line:last-child { margin-bottom: 0; }
.ai-line b { font-weight: 700; }
.ai-note { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--h-muted); }
/* the sequence (home.js adds .anim; without JS everything is simply shown) */
.anim .ai-result { opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .35s ease; }
.anim .ai-result.on { opacity: 1; transform: none; }
.anim .ai-line { opacity: 0; transform: translateY(5px); transition: opacity .35s ease, transform .35s ease; }
.anim .ai-line.on { opacity: 1; transform: none; }

/* ---------- why ---------- */
.why-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.why-card { grid-column: span 2; padding: 26px; display: grid; gap: 10px; align-content: start; }
.why-card:nth-child(4), .why-card:nth-child(5) { grid-column: span 3; }
.why-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--h-blue); }
.why-tag i { font-style: normal; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--h-blue) 12%, transparent); font-size: 18px; }
.why-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -0.01em; }
.why-card p { color: var(--h-muted); font-size: 15px; line-height: 1.6; }


@media (max-width: 900px) {
  .ireland-grid { grid-template-columns: 1fr; }
  .ai-grid { grid-template-columns: 1fr; gap: 32px; }
  .ai-demo { justify-items: center; }
  .why-grid { grid-template-columns: 1fr 1fr; }
  .why-card, .why-card:nth-child(4), .why-card:nth-child(5) { grid-column: span 1; }
  .why-card:nth-child(5) { grid-column: span 2; }
}
@media (max-width: 640px) {
  .street-frame { min-height: 540px; height: 82vh; max-height: 640px; border-radius: 20px; }
  .street-actions { flex-direction: column; align-items: center; }
  .why-grid { grid-template-columns: 1fr; }
  .why-card:nth-child(5) { grid-column: span 1; }
  .ireland-stats div { padding: 12px; }
  .street-note { font-size: 12px; }
  .rot { display: block; text-align: center; margin-inline: auto; }
  .rot > span.gone { left: 50%; translate: -50% 0; }
}
/* Reduced motion: the same sequence, but things fade in place instead of moving or bouncing. */
@keyframes sr-calm { from { opacity: 0; } to { opacity: 1; } }
@keyframes sr-calm-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .play .house { animation-name: sr-calm; animation-duration: .6s; animation-timing-function: ease-out; }
  .play .street-logo span, .play .street-slogan, .play .street-actions { animation-name: sr-calm; }
  .street-pin.drop, .street-note.show, .ireland-ticker div { animation-name: sr-calm; }
  .street-pin.lift, .street-note.lift { animation-name: sr-calm-out; }
  .play .star, .street-pin::after, .splash img, .map-note i { animation: none; }
  .rot > span { transition: opacity .6s; }
  .rot > span:not(.on), .rot > span.gone { transform: none; }
  .anim .ai-result, .anim .ai-line { transform: none; }
  .ai-btn.press { animation: none; }
}
