/*
 Theme Name: Elmerrahi One Page (Child)
 Description: One-page child theme with pro typography, smooth scroll, scrollspy, progress bar, reveal animations + micro-interactions
 Author: You
 Version: 2.1
 Template: twentytwentyfour
 Text Domain: elmerrahi-onepage
*/

/* ================= TOKENS ================= */
:root{
  --maxw: 1100px;
  --pad: 24px;
  --header-h: 64px;
  --accent: #19c3a6;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fs-base: clamp(15px, 0.35vw + 14px, 18px);
  --lh-base: 1.7;

  --fs-h1: clamp(40px, 4.5vw, 64px);
  --fs-h2: clamp(28px, 2.6vw, 44px); /* Section titles */
  --fs-h3: clamp(20px, 1.6vw, 26px);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body{
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  letter-spacing: -0.005em;
  color: #111;
  background: #fff;
}
h1,h2,h3,h4,h5,h6{
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-top: 0;
}

/* ================= HIDE PARENT HEADER ================= */
body.home .wp-site-blocks > header.wp-block-template-part:first-of-type,
body.front-page .wp-site-blocks > header.wp-block-template-part:first-of-type,
body.page-template-front-page .wp-site-blocks > header.wp-block-template-part:first-of-type,
body.home header.wp-block-template-part,
body.front-page header.wp-block-template-part{ display:none !important; }
body.home .wp-site-blocks > header.wp-block-template-part + *,
body.front-page .wp-site-blocks > header.wp-block-template-part + *{ margin-top:0 !important; }
body.home .wp-block-site-title,
body.front-page .wp-block-site-title,
body.home .wp-block-site-tagline,
body.front-page .wp-block-site-tagline{ display:none !important; }

/* ================= SKIP LINK ================= */
.skip-link{ position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }
.skip-link:focus{
  left:var(--pad); top:10px; width:auto; height:auto;
  padding:8px 10px; background:#000; color:#fff; border-radius:8px; z-index:1000;
}

/* ================= HEADER / NAV ================= */
.site-header{
  position:sticky; top:0; z-index:999; height:var(--header-h);
  display:flex; align-items:center; background:rgba(255,255,255,.9);
  backdrop-filter:blur(8px); border-bottom:1px solid #eee;
  transition:background .3s ease, border-color .3s ease;
}
.nav-inner{
  width:100%; max-width:var(--maxw); margin:0 auto; padding:0 var(--pad);
  display:flex; align-items:center; gap:28px;
}
.brand{ font-family:var(--font-display); font-weight:800; letter-spacing:.02em; text-transform:uppercase; font-size:14px; }
.primary-nav ul{ list-style:none; margin:0; padding:0; display:flex; gap:18px; flex-wrap:wrap; }
.primary-nav a{
  text-decoration:none; padding:8px 10px; border-radius:8px; border:1px solid transparent;
  color:#2a2a2a; opacity:.85; transition:all .3s ease; font-weight:500;
}
.primary-nav a:hover{ opacity:1; border-color:var(--accent); }
.primary-nav a.is-active,
.primary-nav a[aria-current="true"]{
  border-color:var(--accent);
  box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent) inset;
  opacity:1;
}

/* ================= SECTIONS ================= */
.section{
  scroll-margin-top: calc(var(--header-h) + 12px);
  padding:64px var(--pad);
  opacity:0; transform:translateY(30px);
  transition:opacity .6s ease, transform .6s ease;
}
.section .wrap{ max-width:var(--maxw); margin:0 auto; }
.section h2{
  font-size:var(--fs-h2);
  font-weight:800; /* bigger & bolder */
  text-align:center;
  margin:0 0 10px;
}
.section .sub{ opacity:.7; margin-bottom:22px; text-align:center; }
.section.is-visible{ opacity:1; transform:translateY(0); }
body.no-js .section{ opacity:1; transform:none; }

/* Title overline for polish */
.section[data-accent]::before{
  content:""; display:block; width:56px; height:3px; margin:0 auto 16px;
  border-radius:999px; background:var(--accent); opacity:.3;
}

/* ================= HERO ================= */
.hero{
  min-height: calc(70vh - var(--header-h));
  display:grid; place-items:center; text-align:center; padding-top:40px;
  background: radial-gradient(1000px 400px at 50% -20%, #f5fffc, #fff);
}
.hero h1{ font-size:var(--fs-h1); font-weight:800; margin:10px 0; }
.hero p{ opacity:.75; margin:0; }

/* ================= PORTFOLIO ================= */
.portfolio-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:24px; }
.portfolio-card{
  background:#fff; border:1px solid #eee; border-radius:16px; padding:16px;
  text-align:center; display:flex; flex-direction:column; text-decoration:none; color:inherit;
  transition:transform .3s ease, box-shadow .3s ease; height:100%; will-change:transform;
}
.portfolio-card .image-frame{
  width:100%; aspect-ratio:4/3; border-radius:12px; overflow:hidden; margin-bottom:12px;
  display:flex; align-items:center; justify-content:center; background:#f8f8f8;
}
.portfolio-card img.portfolio-thumb{ width:100%; height:100%; object-fit:cover; display:block; }
.portfolio-card h3{ font-size:18px; margin-bottom:8px; color:var(--accent); }
.portfolio-card p{ font-size:14px; color:#444; margin-top:auto; }
.portfolio-card:hover{ transform:translateY(-6px); box-shadow:0 8px 22px rgba(0,0,0,.12); }

/* Responsive grid */
@media (max-width:1100px){ .portfolio-grid{ grid-template-columns:repeat(3,1fr); } }
@media (max-width:768px){ .portfolio-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:480px){ .portfolio-grid{ grid-template-columns:1fr; } }

/* Featured utility */
.featured{ display:block; width:100%; max-height:420px; object-fit:cover; border-radius:16px; margin:8px 0 16px; }

/* ================= CTA ================= */
.btn-cta{
  display:inline-block; margin-top:20px; padding:12px 24px; font-weight:600;
  background:var(--accent); color:#fff !important; border-radius:8px; text-decoration:none;
  transition:all .3s ease; box-shadow:0 4px 12px rgba(0,0,0,.12);
}
.btn-cta:hover{ background:#148c7b; transform:translateY(-2px); box-shadow:0 6px 16px rgba(0,0,0,.18); }

/* ================= PROGRESS BAR ================= */
#scroll-progress{
  position:fixed; top:0; left:0; height:4px; background:var(--accent); width:0%;
  z-index:2000; transition:width .15s linear;
}

/* ================= SERVICES ================= */
.services-title{ text-align:center; margin-bottom:40px; font-size:32px; font-weight:700; }
.services-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:32px; align-items:stretch; }
.service-card{
  background:#fff; border:1px solid #eee; border-radius:16px; padding:16px; text-align:center;
  transition:transform .3s ease, box-shadow .3s ease; display:flex; flex-direction:column; height:100%;
  will-change:transform;
}
.service-card h3{ font-size:18px; margin-bottom:12px; color:var(--accent); }
.service-card img.service-icon{ width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:12px; margin-bottom:12px; }
.service-card p{ font-size:15px; line-height:1.6; color:#444; margin-top:auto; }
.service-card:hover{ transform:translateY(-6px); box-shadow:0 8px 22px rgba(0,0,0,.12); }

/* ================= BLOG ================= */
.blog-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:32px; }
.blog-card{
  background:#fff; border:1px solid #eee; border-radius:16px; padding:16px; text-align:center;
  display:flex; flex-direction:column; text-decoration:none; color:inherit;
  transition:transform .3s ease, box-shadow .3s ease; height:100%; will-change:transform;
}
.blog-card img.blog-thumb{ width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:12px; margin-bottom:12px; }
.blog-card h3{ font-size:18px; margin-bottom:12px; color:var(--accent); }
.blog-card p{ font-size:15px; line-height:1.6; color:#444; margin-top:auto; }
.blog-card:hover{ transform:translateY(-6px); box-shadow:0 8px 22px rgba(0,0,0,.12); }

/* ================= TALKS ================= */
.talks-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:32px; }
.talk-card{
  background:#fff; border:1px solid #eee; border-radius:16px; padding:16px; text-align:center;
  transition:transform .3s ease, box-shadow .3s ease; height:100%; will-change:transform;
}
.talk-card img.talk-thumb{ width:100%; border-radius:12px; margin-bottom:12px; transition:transform .3s ease; }
.talk-card h3{ font-size:18px; margin-bottom:8px; color:var(--accent); }
.talk-card p{ font-size:14px; color:#444; }
.talk-card:hover{ transform:translateY(-6px); box-shadow:0 8px 22px rgba(0,0,0,.12); }
.talk-card:hover img.talk-thumb{ transform:scale(1.05); }

/* ================= LIGHTBOX ================= */
.video-lightbox{ position:fixed; inset:0; display:none; justify-content:center; align-items:center; background:rgba(0,0,0,.85); z-index:2000; }
.video-lightbox.active{ display:flex; }
.video-overlay{ position:absolute; inset:0; background:rgba(0,0,0,0.6); }
.video-content{ position:relative; max-width:900px; width:90%; aspect-ratio:16/9; background:#000; border-radius:12px; overflow:hidden; z-index:2100; }
.video-content iframe{ width:100%; height:100%; border:none; }
.video-close{ position:absolute; top:10px; right:10px; font-size:32px; background:none; border:none; color:#fff; cursor:pointer; z-index:2200; }
.talk-trigger{ background:none; border:none; padding:0; text-align:inherit; cursor:pointer; width:100%; display:flex; flex-direction:column; align-items:center; }

/* ================= ABOUT (CENTERED) ================= */
.about-center-wrap{
  max-width:var(--maxw); margin:0 auto; min-height:50vh;
  display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
}
.about-title{ margin:0 0 18px; }
.about-center{ margin:6px 0 22px; }
.about-center-img{
  max-width:720px; width:100%; height:auto; display:block;
  border-radius:20px; box-shadow:0 10px 30px rgba(0,0,0,.12);
}

/* ================= MICRO-INTERACTIONS ================= */
/* Selection color */
::selection{ background:var(--accent); color:#fff; }
::-moz-selection{ background:var(--accent); color:#fff; }

/* Underline grow for content links */
.wrap a:not(.btn-cta){ position:relative; text-decoration:none; }
.wrap a:not(.btn-cta)::after{
  content:""; position:absolute; left:50%; bottom:-2px; width:0; height:1px; background:var(--accent);
  transform:translateX(-50%) scaleX(0); transform-origin:center; transition:transform .25s ease, width .25s ease;
}
.wrap a:not(.btn-cta):hover::after,
.wrap a:not(.btn-cta):focus-visible::after{ width:100%; transform:translateX(-50%) scaleX(1); }

/* Cursor glow (JS creates the node) */
#cursor-glow{
  position:fixed; left:0; top:0; width:220px; height:220px; border-radius:50%;
  pointer-events:none; opacity:0; transform:translate(-50%,-50%);
  background:radial-gradient(circle at center, color-mix(in srgb, var(--accent) 55%, transparent) 0%, transparent 60%);
  filter:blur(30px); transition:opacity .2s ease; z-index:1500;
}

/* Letter wave (JS wraps .char) */
.h-wave .char{ display:inline-block; will-change:transform; transition:transform .25s cubic-bezier(.22,.61,.36,1); }

/* Ripple on click */
.ripple-container{ position:relative; overflow:hidden; }
.ripple{
  position:absolute; width:12px; height:12px; border-radius:50%;
  background:color-mix(in srgb, var(--accent) 35%, #000 0%); opacity:.25; transform:scale(0);
  animation:ripple .6s ease-out forwards;
}
@keyframes ripple{ to{ transform:scale(18); opacity:0; } }

/* Subtle indicator under section titles (already above via ::before) */
.pop-in{ transform:translateY(0); opacity:1; transition:opacity .6s ease, transform .6s ease; }

/* About photo effects (Tilt + Shine + Duotone) */
.fx-portrait{ position:relative; display:inline-block; perspective:800px; }
.fx-portrait .featured{
  display:block; border-radius:20px; transform-style:preserve-3d;
  will-change:transform, filter; transition:transform .2s ease, filter .2s ease, box-shadow .3s ease;
  box-shadow:0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.fx-portrait::after{
  content:""; position:absolute; inset:-2px; border-radius:22px;
  background:linear-gradient(120deg, rgba(255,255,255,.18), rgba(255,255,255,0) 40%);
  mix-blend-mode:screen; opacity:.0; transition:opacity .2s ease; pointer-events:none;
}
.fx-portrait.is-tilting .featured{ filter:saturate(1.05) contrast(1.02); }
.fx-portrait.is-tilting::after{ opacity:.55; }
.fx-duotone .featured{ filter:grayscale(1) contrast(1.05) brightness(0.95); }
.fx-duotone:hover .featured,
.fx-duotone:focus-within .featured{
  filter:none;
  box-shadow:0 0 0 1px color-mix(in srgb, var(--accent) 42%, transparent),
             0 12px 28px rgba(0,0,0,.18),
             0 0 80px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ================= RESPONSIVE ================= */
@media (max-width:900px){
  .services-grid, .blog-grid, .talks-grid{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width:768px){
  :root{ --pad:18px; --header-h:58px; }
  .primary-nav ul{ gap:8px; overflow-x:auto; white-space:nowrap; }
  .hero h1{ font-size: clamp(32px, 5vw, 44px); }
}
@media (max-width:600px){
  .services-grid, .blog-grid, .talks-grid{ grid-template-columns:1fr; }
}

/* ================= DARK MODE ================= */
@media (prefers-color-scheme: dark){
  body{ background:#0c0c0c; color:#eee; }
  .site-header{ background:rgba(20,20,20,.76); border-bottom:1px solid #222; }
  .primary-nav a{ color:#e6e6e6; }
  .card, .service-card, .blog-card, .talk-card{ border-color:#222; }
  .section .sub{ opacity:.8; }
}

/* ================= REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce){
  *{ animation:none !important; transition:none !important; }
  .fx-portrait .featured, .fx-portrait::after{ transition:none !important; }
}
.site-footer {
  text-align: center;
  padding: 40px var(--pad);
  background: #f8f8f8;
  border-top: 1px solid #eee;
  font-size: 14px;
  color: #666;
}
.site-footer .sub {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.8;
}
