/* Shared page hero (all standalone pages except the homepage). Layers: photo < scrim < text. */
.ph-hero { position: relative; display: flex; align-items: center; min-height: clamp(300px, 42svh, 500px); background: var(--grad-primary); color: #fff; overflow: hidden; }
.ph-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }

/* readability: dark on the text side whatever the photo, plus a soft gold glow for warmth */
.ph-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(circle at 92% 0%, rgba(217,164,65,.22), transparent 46%),
    linear-gradient(90deg, rgba(6,16,11,.90) 0%, rgba(6,16,11,.74) 40%, rgba(6,16,11,.34) 78%, rgba(6,16,11,.2) 100%),
    linear-gradient(0deg, rgba(6,16,11,.62) 0%, rgba(6,16,11,0) 45%);
}
.ph-in { position: relative; z-index: 2; width: 100%; padding-block: var(--sp-8) calc(var(--sp-8) + 40px); } /* full width: otherwise the flex hero shrinks and centres it */
.ph-in > * { max-width: 680px; }

.ph-hero h1 { color: #fff; font-size: var(--hero); line-height: var(--lh-tight); letter-spacing: -.01em; text-shadow: 0 2px 26px rgba(0,0,0,.55), 0 1px 3px rgba(0,0,0,.4); }
[data-lang="te"] .ph-hero h1 { font-size: calc(var(--hero) * .85); line-height: 1.25; }
.ph-hero h1::after { content: ""; display: block; width: 88px; height: 4px; border-radius: 2px; background: var(--grad-warm); margin-top: var(--sp-5); box-shadow: 0 0 18px rgba(217,164,65,.55); }
.ph-lead { margin-top: var(--sp-5); font-size: var(--lead); line-height: var(--lh-body); color: rgba(255,255,255,.96); text-shadow: 0 1px 14px rgba(0,0,0,.6); }
.ph-lead a { color: var(--gold-light); }
.ph-actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-6); }
.ph-actions .btn { min-height: 48px; }
.ph-actions .btn-outline { background: rgba(6,16,11,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ph-actions .btn-outline:hover { background: #fff; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes ph-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  @keyframes ph-pan  { from { transform: scale(1); } to { transform: scale(1.04); } }
  .ph-bg { animation: ph-pan 26s ease-in-out infinite alternate; }
  .ph-in > * { animation: ph-rise .85s cubic-bezier(.2, .7, .2, 1) both; }
  .ph-in > :nth-child(2) { animation-delay: .12s; }
  .ph-in > :nth-child(3) { animation-delay: .26s; }
}

@media (max-width: 959px) { .ph-hero::before { background: linear-gradient(180deg, rgba(6,16,11,.72) 0%, rgba(6,16,11,.62) 50%, rgba(6,16,11,.86) 100%); } }
@media (max-width: 640px) {
  .ph-hero { min-height: clamp(260px, 38svh, 420px); }
  .ph-in { padding-block: var(--sp-7); }
  .ph-actions { flex-direction: column; gap: var(--sp-3); }
  .ph-actions .btn { width: 100%; }
}

/* no empty band under the photo: the page content rises over the hero's bottom edge as a rounded sheet */
.ph-hero + main.standalone-page > :first-child,
.ph-hero + :not(main) { margin-top: -40px; border-radius: 28px 28px 0 0; }
.ph-hero + main.standalone-page > :first-child,
.ph-hero + :not(main):not(.yc-jump) { position: relative; z-index: 3; } /* the Community jump bar is sticky and already above */
.ph-hero + main.standalone-page > :first-child { background-color: var(--color-background); background-image: var(--pat-grid); padding-top: var(--sp-6); } /* sections with their own background keep it */
.ph-hero + .ys-sec { background-color: var(--color-background); background-image: var(--pat-grid); }
@media (max-width: 640px) {
  .ph-in { padding-block: var(--sp-7) calc(var(--sp-7) + 32px); }
  .ph-hero + main.standalone-page > :first-child, .ph-hero + :not(main) { margin-top: -32px; border-radius: 22px 22px 0 0; }
}

/* article heroes (blog posts, news items): a meta row above a calmer, shorter title */
.ph-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); }
.ph-back { flex: 0 0 100%; display: inline-flex; align-items: center; gap: var(--sp-2); width: fit-content; margin-bottom: var(--sp-2); color: rgba(255,255,255,.88); font-size: var(--small); font-weight: 700; text-decoration: none; transition: color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.ph-back:hover { color: var(--gold-light); transform: translateX(-3px); }
.ph-back .btn-ic { transform: scaleX(-1); }
.ph-meta .badge { background: var(--color-accent); color: var(--green-900); }
.ph-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); color: #fff; font-size: var(--xs); font-weight: 600; line-height: var(--lh-ui); }
.ph-chip .btn-ic { color: var(--gold-light); }
.ph-hero--article { min-height: clamp(260px, 36svh, 400px); }
.ph-hero--article h1 { font-size: var(--h1); }
[data-lang="te"] .ph-hero--article h1 { font-size: calc(var(--h1) * .85); }
.ph-hero--article .ph-in > * { max-width: 840px; }

/* short viewports (phones in landscape, small laptops): let content set the height so the hero never fills the frame */
@media (max-height: 500px) { .ph-hero, .ph-hero--article { min-height: 0; } .ph-in { padding-block: var(--sp-6) calc(var(--sp-6) + 32px); } }
.ph-lead, .ph-hero h1 { overflow-wrap: anywhere; }

/* Page heroes: drifting golden dust (fireflies) rising through the photo, plus a slow shimmer along the gold underline.
   Pure CSS on the photo layer; sits under the scrim and text, off for reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes ph-dust { to { background-position: 0 -520px, 0 -380px, 0 -300px; } }
  @keyframes ph-twinkle { from { opacity: .5; } to { opacity: 1; } }
  .ph-bg::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
      radial-gradient(circle, rgba(255,226,150,.95) 0 1.6px, transparent 2.4px),
      radial-gradient(circle, rgba(255,214,120,.8) 0 2.6px, rgba(255,214,120,.25) 3.5px, transparent 6px),
      radial-gradient(circle, rgba(255,240,200,.7) 0 1px, transparent 2px);
    background-size: 260px 260px, 380px 380px, 150px 150px;
    background-position: 30px 40px, 190px 120px, 70px 10px;
    animation: ph-dust 26s linear infinite, ph-twinkle 3.4s ease-in-out infinite alternate;
  }
  @keyframes ph-shimmer { 0%, 60% { background-position: 200% 0; } 100% { background-position: -100% 0; } }
  .ph-hero h1::after {
    background: linear-gradient(100deg, transparent 0 40%, rgba(255,246,216,.95) 50%, transparent 60% 100%) 200% 0 / 250% 100% no-repeat, var(--grad-warm);
    animation: ph-shimmer 4.5s ease-in-out infinite;
  }
}

/* Per-page hero effect, chosen to suit each page's subject. One layer on .ph-hero::after (under the text, over the scrim),
   transform/opacity/background-position only, off for reduced-motion. The class ph-fx-{slug} is added in template-parts/page-hero.php. */
@media (prefers-reduced-motion: no-preference) {
  [class*="ph-fx-"]::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; }

  /* About: slow drifting mist, like morning haze over the village */
  @keyframes fx-mist { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
  .ph-fx-about::after { inset: -10% -20%; background: radial-gradient(ellipse 40% 30% at 20% 70%, rgba(255,255,255,.16), transparent 70%), radial-gradient(ellipse 35% 25% at 65% 40%, rgba(255,255,255,.12), transparent 70%), radial-gradient(ellipse 30% 30% at 90% 80%, rgba(255,255,255,.14), transparent 70%); animation: fx-mist 22s ease-in-out infinite alternate; }

  /* Our Story: a warm band of light sweeping across, like a memory surfacing */
  @keyframes fx-sweep { 0%, 35% { transform: translateX(-120%) skewX(-18deg); } 100% { transform: translateX(120%) skewX(-18deg); } }
  .ph-fx-our-story::after { width: 38%; inset: 0 auto 0 0; background: linear-gradient(90deg, transparent, rgba(255,222,150,.20), transparent); animation: fx-sweep 9s ease-in-out infinite; }

  /* Village Administration: a faint governing grid that slowly drifts */
  @keyframes fx-grid { to { background-position: 48px 48px; } }
  .ph-fx-village-administration::after { background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: linear-gradient(90deg, transparent 10%, #000 90%); mask-image: linear-gradient(90deg, transparent 10%, #000 90%); animation: fx-grid 12s linear infinite; }

  /* Places: slowly turning rays of sun from the upper right, like a compass sweep */
  @keyframes fx-rays { to { transform: rotate(360deg); } }
  .ph-fx-places::after { inset: -60% -40% auto auto; width: 120%; aspect-ratio: 1; background: repeating-conic-gradient(from 0deg, rgba(255,226,150,.12) 0 6deg, transparent 6deg 18deg); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 62%); mask-image: radial-gradient(circle, #000 0, transparent 62%); animation: fx-rays 90s linear infinite; }

  /* Gallery: soft bokeh lights that breathe, like lens glints */
  @keyframes fx-bokeh { from { opacity: .35; transform: scale(.94); } to { opacity: 1; transform: scale(1.06); } }
  .ph-fx-gallery::after { background: radial-gradient(circle 70px at 82% 28%, rgba(255,236,190,.20), transparent 70%), radial-gradient(circle 110px at 66% 72%, rgba(255,214,140,.14), transparent 70%), radial-gradient(circle 50px at 92% 62%, rgba(255,255,255,.18), transparent 70%), radial-gradient(circle 90px at 48% 22%, rgba(255,226,170,.10), transparent 70%); animation: fx-bokeh 5s ease-in-out infinite alternate; }

  /* Community: warm glow orbs that slowly orbit, like people gathering */
  @keyframes fx-orbit { from { transform: rotate(0); } to { transform: rotate(360deg); } }
  .ph-fx-community::after { inset: -30%; background: radial-gradient(circle 120px at 70% 40%, rgba(217,164,65,.22), transparent 70%), radial-gradient(circle 90px at 30% 60%, rgba(168,81,45,.20), transparent 70%), radial-gradient(circle 100px at 55% 75%, rgba(255,226,150,.14), transparent 70%); animation: fx-orbit 60s linear infinite; }

  /* Events: festive confetti specks drifting down in marigold, terracotta and leaf green */
  @keyframes fx-confetti { to { background-position: 0 420px, 0 330px, 0 510px; } }
  .ph-fx-events::after { background-image: radial-gradient(circle, rgba(242,197,102,.9) 0 2.4px, transparent 3.2px), radial-gradient(circle, rgba(214,120,80,.8) 0 2px, transparent 3px), radial-gradient(circle, rgba(140,210,160,.8) 0 2px, transparent 3px); background-size: 210px 210px, 300px 300px, 250px 250px; background-position: 20px 0, 140px 90px, 80px 160px; animation: fx-confetti 24s linear infinite; }

  /* News: thin lines of light sliding across, like headlines scrolling */
  @keyframes fx-lines { to { background-position: 360px 0; } }
  .ph-fx-news::after { background: repeating-linear-gradient(180deg, transparent 0 46px, rgba(255,255,255,.10) 46px 47px), linear-gradient(90deg, transparent 0, rgba(255,226,150,.18) 50%, transparent 100%) 0 0 / 360px 100% repeat-x; animation: fx-lines 10s linear infinite; -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%); mask-image: linear-gradient(90deg, transparent, #000 40%); }

  /* Store: a glint of light crossing, like sunlight on a market stall */
  @keyframes fx-glint { 0%, 55% { transform: translateX(-130%) skewX(-22deg); } 100% { transform: translateX(260%) skewX(-22deg); } }
  .ph-fx-store::after { width: 14%; inset: 0 auto 0 0; background: linear-gradient(90deg, transparent, rgba(255,246,216,.30), transparent); animation: fx-glint 7s ease-in-out infinite; }

  /* Contact: calm signal rings spreading out, like a message being sent */
  @keyframes fx-ring { from { transform: scale(.2); opacity: .7; } to { transform: scale(1); opacity: 0; } }
  .ph-fx-contact::after { inset: auto -8% -45% auto; width: 70%; aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,226,150,.5); box-shadow: 0 0 0 40px rgba(255,226,150,.0); animation: fx-ring 6s ease-out infinite; }
  .ph-fx-contact .ph-in::before { content: ""; position: absolute; right: -8%; bottom: -45%; width: 70%; aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,226,150,.4); pointer-events: none; animation: fx-ring 6s ease-out 3s infinite; }

  /* Privacy Policy: a quiet, slow-breathing glow, calm and reassuring */
  @keyframes fx-breathe { from { opacity: .3; transform: scale(.96); } to { opacity: .9; transform: scale(1.04); } }
  .ph-fx-privacy-policy::after { background: radial-gradient(ellipse 45% 55% at 78% 45%, rgba(140,210,160,.22), transparent 70%); animation: fx-breathe 7s ease-in-out infinite alternate; }

  /* Blog: a slowly shifting aurora of gold and green, like ideas forming */
  @keyframes fx-aurora { from { transform: translate(-6%, 2%) scale(1); } to { transform: translate(6%, -3%) scale(1.12); } }
  .ph-fx-blog::after { inset: -15%; background: radial-gradient(ellipse 40% 35% at 30% 60%, rgba(217,164,65,.20), transparent 70%), radial-gradient(ellipse 45% 40% at 72% 35%, rgba(100,190,140,.18), transparent 70%); animation: fx-aurora 14s ease-in-out infinite alternate; }
}
