/*
Theme Name: BassemFekry
Author: Bassem Fekry
Author URI: bassemfekry.com
Version: 2.0
*/

:root {
  --bg-top: #181818;
  --bg-bottom: #000;
  --panel: rgba(40, 41, 45, 0.92);
  --panel-solid: #1c1d20;
  --mint: #B4F8C8;
  --green: #55ac6f;
  --green-dark: #1a6430;
  --text: #fff;
  --text-soft: #d8d8d8;
  --muted: #9a9a9a;
  --radius: 14px;
  --font-display: a-day-without-sun-text, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg-bottom); color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: var(--font-display);
  background: transparent;
  overflow-x: hidden;
}
/* Fixed gradient layer (background-attachment: fixed is ignored on iOS) */
body::before {
  content: ""; position: fixed; inset: -10vh 0; z-index: -1;
  background: linear-gradient(var(--bg-top), var(--bg-bottom));
}
main { flex: 1; position: relative; z-index: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--mint); color: #000; padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Stars background ---------- */
.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.star {
  position: absolute; background: #fff; border-radius: 50%;
  animation: twinkle 3s linear infinite, drift 30s linear infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
@keyframes drift { from { transform: translateY(0); } to { transform: translateY(-100vh); } }

/* ---------- Header / nav ---------- */
.site-header { position: relative; z-index: 20; }
.nav-bar { display: flex; align-items: center; justify-content: space-between; padding-top: 28px; padding-bottom: 28px; }
.logo { width: 100px; height: auto; }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 6px 36px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  position: relative; color: var(--text); text-decoration: none;
  font-size: 18px; text-transform: uppercase; letter-spacing: .03em;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  width: 0; height: 3px; background: var(--mint); transition: width .4s;
}
.site-nav a:hover, .site-nav a.active { color: var(--mint); }
.site-nav a:hover::after, .site-nav a.active::after { width: 100%; }

.menu-toggle, .menu-close {
  display: none; background: none; border: 0; color: #fff; font-size: 26px; cursor: pointer; padding: 6px;
}

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .site-nav {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(300px, 85vw);
    background: rgba(85, 172, 111, .97); padding: 80px 32px 32px;
    transform: translateX(100%); transition: transform .4s ease; z-index: 50;
    box-shadow: -10px 0 40px rgba(0,0,0,.4);
  }
  .site-nav.open { transform: translateX(0); }
  .site-nav ul { flex-direction: column; gap: 26px; }
  .site-nav a { font-size: 22px; }
  .site-nav a.active, .site-nav a:hover { color: #0b2e16; }
  .site-nav a::after { background: #0b2e16; }
  .menu-close { display: block; position: absolute; top: 22px; right: 22px; }
}

/* ---------- Common ---------- */
.page { padding-top: 20px; padding-bottom: 60px; }
.sub-title {
  text-align: center; font-size: clamp(40px, 7vw, 64px); font-weight: 600;
  text-transform: uppercase; margin-bottom: 30px;
}
.lead { text-align: center; color: var(--muted); font-family: var(--font-body); max-width: 640px; margin: -14px auto 34px; }

.panel {
  background: var(--panel); border: 2px solid var(--mint); border-radius: var(--radius);
  padding: clamp(20px, 4vw, 40px); transition: box-shadow .4s;
}
.panel:hover { box-shadow: 0 8px 30px rgba(0,0,0,.6); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 36px; border-radius: 8px; border: 1px solid var(--mint);
  background: var(--mint); color: var(--green-dark); font: inherit; font-weight: 600;
  text-transform: uppercase; text-decoration: none; cursor: pointer;
  transition: transform .3s, background .3s, color .3s;
}
.btn:hover { background: var(--green); border-color: var(--green); color: #fff; transform: translateY(-4px); }
.btn-ghost { background: transparent; color: var(--mint); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(180,248,200,.4); color: var(--mint); font-family: var(--font-body);
  font-size: 13px; letter-spacing: .02em;
}
.badge::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84;
  box-shadow: 0 0 0 0 rgba(61,220,132,.7); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(61,220,132,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); } }

/* ---------- Home ---------- */
.hero { min-height: calc(100vh - 160px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px 0 40px; }
.hero h1 { font-size: clamp(48px, 10vw, 88px); font-weight: 600; text-transform: uppercase; line-height: 1; }
.hero .role { font-size: clamp(22px, 4vw, 40px); text-transform: uppercase; margin-top: 12px; }
.hero .badge { margin-top: 22px; }
.home-btn { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; }
.home-btn img { width: 300px; max-width: 80vw; padding: 10px; opacity: .85; transition: transform .5s, opacity .5s; }
.home-btn a:hover img, .home-btn a:focus-visible img { opacity: 1; transform: translateY(-14px) scale(1.02); }
.scroll-hint { margin-top: 26px; color: var(--muted); font-size: 22px; animation: bob 2s ease-in-out infinite; text-decoration: none; }
@keyframes bob { 50% { transform: translateY(8px); } }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(30px, 5vw, 44px); text-transform: uppercase; }
.section-head a { color: var(--mint); text-decoration: none; text-transform: uppercase; }
.section-head a:hover { text-decoration: underline; }

/* ---------- Portfolio ---------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 34px; }
.filter-btn {
  background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,.25);
  padding: 10px 22px; border-radius: 999px; font: inherit; font-size: 17px; text-transform: uppercase;
  cursor: pointer; transition: all .3s;
}
.filter-btn:hover { border-color: var(--mint); color: var(--mint); }
.filter-btn.active { background: var(--mint); color: var(--green-dark); border-color: var(--mint); }
.filter-btn .count { opacity: .6; font-size: .8em; margin-left: 4px; }

.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.work-card { animation: cardIn .45s ease both; }
.work-card[hidden] { display: none; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } }
.work-card > a { display: block; text-decoration: none; color: inherit; }
.work-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #111; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .8; transition: transform .5s, opacity .5s, filter .5s; }
.work-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(61,151,167,.35), rgba(5,2,2,.85)); opacity: 0; transition: opacity .4s;
}
.play-icon {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 1;
  font-size: 54px; color: var(--mint); opacity: 0; transform: scale(.6); transition: all .35s;
}
.work-card a:hover .work-thumb img, .work-card a:focus-visible .work-thumb img { transform: scale(1.08); opacity: 1; filter: blur(1.5px); }
.work-card a:hover .work-thumb::after, .work-card a:focus-visible .work-thumb::after { opacity: 1; }
.work-card a:hover .play-icon, .work-card a:focus-visible .play-icon { opacity: 1; transform: scale(1); }
.work-info { padding: 12px 4px 0; }
.work-info h3 { font-size: 22px; font-weight: 600; text-transform: uppercase; transition: color .3s; }
.work-card a:hover h3 { color: var(--mint); }
.work-meta { color: var(--muted); font-family: var(--font-body); font-size: 13px; margin-top: 4px; }
.more-row { display: flex; justify-content: center; margin-top: 40px; }
.show-more[hidden] { display: none; }
.show-more .count { opacity: .6; font-size: .8em; margin-left: 6px; }
.show-more .count:empty { display: none; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 0; font-family: var(--font-body); }

/* ---------- Showreel ---------- */
.showreel-card { max-width: 1000px; margin: 0 auto; }
.showreel-card .work-thumb { border: 2px solid var(--mint); border-radius: var(--radius); }
.showreel-card .play-icon { opacity: .9; transform: none; font-size: 80px; }
.showreel-card .work-thumb img { opacity: .9; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(200px, 320px) 1fr; gap: clamp(24px, 4vw, 50px); align-items: start; }
.about-photo img { width: 100%; border: 2px solid var(--mint); border-radius: var(--radius); }
.about-text p { color: var(--text-soft); font-size: clamp(18px, 2vw, 22px); line-height: 1.55; font-weight: 600; margin-bottom: 18px; }
.about-text p:last-child { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-top: 30px; }
.stat { text-align: center; padding: 18px 10px; border: 1px solid rgba(180,248,200,.3); border-radius: 10px; }
.stat strong { display: block; font-size: 36px; color: var(--mint); }
.stat span { color: var(--muted); font-family: var(--font-body); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.about-block { margin-top: 34px; }
.about-block h2 { font-size: 26px; text-transform: uppercase; margin-bottom: 14px; color: var(--mint); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.chips li { padding: 8px 16px; border-radius: 999px; background: rgba(180,248,200,.1); border: 1px solid rgba(180,248,200,.35); font-family: var(--font-body); font-size: 14px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--green); }
.timeline li { padding: 0 0 18px 22px; position: relative; font-family: var(--font-body); }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--mint); }
.timeline strong { display: block; font-size: 17px; }
.timeline span { color: var(--muted); font-size: 14px; }
.about-actions { margin-top: 30px; }

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 280px; margin: 0 auto; }
}

/* ---------- Contact ---------- */
.contact-wrap { max-width: 880px; margin: 0 auto; }
.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 24px; }
.contact-form .full { grid-column: 1 / -1; }
.field { position: relative; }
.field input, .field textarea {
  width: 100%; padding: 22px 12px 10px; background: transparent; color: #fff;
  border: 0; border-bottom: 2px solid #666; font: inherit; font-size: 18px; resize: vertical;
  transition: border-color .3s;
}
.field textarea { min-height: 130px; }
.field label {
  position: absolute; left: 12px; top: 20px; color: #9a9a9a; pointer-events: none;
  text-transform: uppercase; letter-spacing: .05em; transition: all .25s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--mint); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label { top: 0; font-size: 12px; color: var(--mint); }
.hp { position: absolute; left: -9999px; }
.form-status { grid-column: 1 / -1; min-height: 1.4em; text-align: center; font-family: var(--font-body); }
.form-status.ok { color: var(--mint); }
.form-status.err { color: #ffb4a8; }
.contact-direct { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; margin-top: 30px; font-family: var(--font-body); }
.contact-direct a { color: var(--mint); text-decoration: none; }
.contact-direct a:hover { text-decoration: underline; }
.contact-direct i { margin-right: 8px; }
@media (max-width: 640px) { .contact-form { grid-template-columns: 1fr; } }

/* ---------- Expressions ---------- */
.search-box { position: relative; max-width: 460px; margin: 0 auto 24px; }
.search-box input {
  width: 100%; padding: 14px 46px 14px 22px; border-radius: 999px; font-size: 16px;
  border: 1.5px solid var(--green); background: #1a1a1a; color: var(--mint); font-family: var(--font-body);
}
.search-box input::placeholder { color: #99c999; }
.search-box input:focus { outline: none; box-shadow: 0 0 10px 2px rgba(85,172,111,.6); }
.search-box button {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; border: 0; background: #fff; color: #000; cursor: pointer;
}
.expr-list { display: grid; gap: 16px; max-width: 980px; margin: 0 auto; }
.expr-cat-heading { text-align: center; color: var(--green); text-transform: uppercase; font-size: 28px; margin: 20px 0 4px; }
.expr {
  background: #1a1a1a; border: 2px solid var(--green); border-radius: 10px;
  box-shadow: 0 0 10px rgba(85,172,111,.2); font-family: var(--font-body);
}
.expr summary {
  list-style: none; cursor: pointer; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 14px;
  font-size: 19px; font-weight: 700;
}
.expr summary::-webkit-details-marker { display: none; }
.expr summary::after { content: "+"; color: var(--mint); font-size: 24px; transition: transform .3s; }
.expr[open] summary::after { transform: rotate(45deg); }
.expr-body { padding: 0 20px 20px; }
.expr-desc { color: var(--text-soft); font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.expr-code-wrap { position: relative; }
.expr pre {
  margin: 0; background: #111; border-left: 4px solid var(--green); border-radius: 6px;
  padding: 14px 90px 14px 14px; color: var(--mint); font: 15px/1.6 "Courier New", monospace;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px; background: var(--green); color: #000; border: 0;
  padding: 7px 14px; border-radius: 6px; cursor: pointer; font-family: var(--font-body); font-weight: 600;
}
.copy-btn:hover { background: var(--mint); }
.copy-btn.done { background: var(--mint); }

/* ---------- Footer ---------- */
.site-footer { position: relative; z-index: 1; text-align: center; padding: 30px var(--gutter) 26px; font-size: 15px; }
.social-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-bottom: 12px; }
.social-icons a { color: #ececec; font-size: 30px; transition: transform .4s, color .4s; }
.social-icons a:hover { color: var(--mint); transform: translateY(-5px); }

/* ---------- Tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px; }
.tool-card {
  display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius);
  background: var(--panel); border: 1px solid rgba(255, 255, 255, .08); animation: cardIn .45s ease both;
}
.tool-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.tool-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s; }
a.tool-thumb:hover img, a.tool-thumb:focus-visible img { transform: scale(1.05); }
.tool-thumb .play-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mint); font-size: 56px; opacity: .85; }
.tool-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 24px; flex: 1; font-family: var(--font-body); }
.tool-tags { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tool-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tool-price { font-size: 13px; font-weight: 600; color: var(--mint); padding: 3px 12px; border: 1px solid rgba(180, 248, 200, .35); border-radius: 999px; }
.tool-body h2 { font-family: var(--font-display); font-size: 28px; font-weight: 600; text-transform: uppercase; margin: 0; color: var(--text); }
.tool-desc { color: var(--text-soft); font-size: 15px; line-height: 1.55; margin: 0; }
.tool-features { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; color: var(--text-soft); font-size: 14px; }
.tool-features i { color: var(--mint); font-size: 12px; margin-right: 6px; }
.tool-meta { color: var(--muted); font-size: 13px; margin: 0; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 10px; }
.tool-actions .btn { padding: 12px 24px; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; place-items: safe center; overflow-y: auto; background: rgba(0,0,0,.95); padding: 20px; animation: fadeIn .3s; }
.lightbox[hidden] { display: none; }
.lightbox-frame { --ar: 16 / 9; width: min(1280px, 100%, calc((100vh - 120px) * var(--ar))); aspect-ratio: var(--ar); background: #000; box-shadow: 0 20px 60px rgba(0,0,0,.6); border-radius: 18px; overflow: hidden; }
.lightbox-ambient { position: fixed; inset: 0; background: center / cover no-repeat; filter: blur(80px) saturate(1.4); transform: scale(1.25); opacity: 0; transition: opacity .6s; pointer-events: none; }
.lightbox-ambient.on { opacity: .55; }
.lightbox.live .lightbox-ambient { opacity: 0; }
/* Live glow colours, animated smoothly between the samples the script sets */
@property --gl { syntax: '<color>'; inherits: false; initial-value: transparent; }
@property --gr { syntax: '<color>'; inherits: false; initial-value: transparent; }
@property --gt { syntax: '<color>'; inherits: false; initial-value: transparent; }
@property --gb { syntax: '<color>'; inherits: false; initial-value: transparent; }
@property --gc { syntax: '<color>'; inherits: false; initial-value: transparent; }
.lightbox-live {
  position: fixed; inset: -10%; pointer-events: none; opacity: 0;
  background:
    radial-gradient(45% 70% at 8% 50%, var(--gl), transparent 75%),
    radial-gradient(45% 70% at 92% 50%, var(--gr), transparent 75%),
    radial-gradient(70% 45% at 50% 6%, var(--gt), transparent 75%),
    radial-gradient(70% 45% at 50% 94%, var(--gb), transparent 75%),
    radial-gradient(40% 40% at 50% 50%, var(--gc), transparent 80%);
  filter: blur(60px) saturate(1.3);
  transition: opacity .8s, --gl .5s linear, --gr .5s linear, --gt .5s linear, --gb .5s linear, --gc .5s linear;
}
.lightbox.live .lightbox-live { opacity: .6; }
.lightbox-body, .lightbox-close { position: relative; z-index: 1; }
.lightbox-close { z-index: 2; }   /* stays clickable even when a tall video + description fills the screen */
.lightbox-body { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.lightbox.has-info .lightbox-frame { width: min(1280px, 100%, calc((100vh - 260px) * var(--ar))); }
.lightbox-info { width: 100%; max-width: 720px; text-align: center; }
.lightbox-title { color: var(--mint); font-family: var(--font-display); font-size: 26px; text-transform: uppercase; margin: 0; }
.lightbox-meta { color: var(--muted); font-family: var(--font-body); font-size: 13px; margin: 4px 0 0; }
.lightbox-desc { color: var(--text-soft); font-family: var(--font-body); font-size: 15px; line-height: 1.55; margin: 10px 0 0; }
.lightbox-credits { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); font-family: var(--font-body); }
.lightbox-credits dt { color: var(--muted); font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; }
.lightbox-credits dd { color: var(--text); font-size: 14px; margin: 2px 0 0; }
.lightbox-credits a { color: inherit; text-decoration: underline; text-decoration-color: rgba(180, 248, 200, .5); text-underline-offset: 3px; }
.lightbox-credits a:hover, .lightbox-credits a:focus-visible { color: var(--mint); text-decoration-color: currentColor; }
.lightbox-info [hidden] { display: none; }
.lightbox-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.lightbox-close { position: absolute; top: 18px; right: 22px; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; }
.lightbox-close:hover { color: var(--mint); }
@keyframes fadeIn { from { opacity: 0; } }
body.no-scroll { overflow: hidden; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 60px 0; }
.notfound h1 { font-size: clamp(80px, 18vw, 180px); color: var(--mint); line-height: 1; }
.notfound p { font-family: var(--font-body); color: var(--muted); margin: 16px 0 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 400px) {
  .g-recaptcha { transform: scale(.88); transform-origin: center; }
}
