/*
Theme Name: Amr Ahmad Portfolio
Theme URI: amrahmad.com
Author: Amr Ahmad
Author URI: amrahmad.com
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
*/

/* ============ TOKENS ============ */
:root{
  --bg: #FAF9F6;
  --bg-alt: #F1EEE7;
  --ink: #16150F;
  --ink-soft: #5B584D;
  --ink-faint: #9C978A;
  --line: #DEDACD;
  --accent: #3D3DFF;
  --accent-ink: #17177A;
  --accent-soft: #E7E6FF;
  --white: #FFFFFF;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-w: 96px;
  --topbar-h: 64px;
}

html.reduce-motion *{
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

*{ box-sizing: border-box; margin:0; padding:0; }
html{ scroll-behavior: smooth; }
body{
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; }
button{ font-family:inherit; cursor:pointer; background:none; border:none; color:inherit; }
input, textarea{ font-family:inherit; font-size:inherit; color:inherit; }

::selection{ background: var(--accent); color:#fff; }

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

.wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: 0 32px;
}

.eyebrow{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.eyebrow::before{
  content:"";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

h1, h2, h3{
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

section{ position: relative; }

/* ============ SIDE INDEX NAV (desktop) ============ */
.index-nav{
  position: fixed;
  top:0; left:0;
  width: var(--nav-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0;
  z-index: 100;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.index-nav .brand{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  writing-mode: vertical-rl;
  color: var(--ink-soft);
}
.index-track{
  position: relative;
  display:flex;
  flex-direction:column;
  gap: 30px;
  align-items:center;
}
.index-track .rail{
  position:absolute;
  left:50%; top:0;
  transform: translateX(-50%);
  width:1px; height:100%;
  background: var(--line);
  z-index:0;
}
.index-item{
  position:relative;
  z-index:1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  width: 34px; height:34px;
  display:flex; align-items:center; justify-content:center;
  transition: color .35s var(--ease);
}
.index-item::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:50%;
  background: var(--accent-soft);
  transform: scale(0);
  transition: transform .4s var(--ease);
  z-index:-1;
}
.index-item.active{ color: var(--accent-ink); font-weight:500; }
.index-item.active::before{ transform: scale(1); }

.index-nav .scroll-cue{
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  writing-mode: vertical-rl;
  display:flex; align-items:center; gap:10px;
}
.scroll-cue .line{
  width:1px; height:40px;
  background: var(--ink-faint);
  position:relative;
  overflow:hidden;
}
.scroll-cue .line::after{
  content:"";
  position:absolute; left:0; top:-100%;
  width:100%; height:100%;
  background: var(--accent);
  animation: cueMove 2.4s var(--ease) infinite;
}
@keyframes cueMove{
  0%{ top:-100%; }
  50%{ top:100%; }
  50.01%{ top:-100%; }
  100%{ top:-100%; }
}

/* ============ TOP BAR (mobile) ============ */
.topbar{
  display:none;
  position: fixed;
  top:0; left:0; right:0;
  height: var(--topbar-h);
  align-items:center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(250,249,246,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 200;
}
.topbar .brand{ font-family: var(--font-mono); font-size:13px; }
.burger{
  width: 32px; height:22px;
  position: relative;
}
.burger span{
  position:absolute; left:0; width:100%; height:1.5px;
  background: var(--ink);
  transition: transform .4s var(--ease), opacity .3s var(--ease), top .4s var(--ease);
}
.burger span:nth-child(1){ top:0; }
.burger span:nth-child(2){ top:50%; margin-top:-0.75px; }
.burger span:nth-child(3){ top:100%; margin-top:-1.5px; }
.burger.open span:nth-child(1){ top:50%; transform: rotate(45deg); }
.burger.open span:nth-child(2){ opacity:0; }
.burger.open span:nth-child(3){ top:50%; margin-top:-1.5px; transform: rotate(-45deg); }

.mobile-menu{
  position: fixed;
  inset:0;
  background: var(--bg);
  z-index: 150;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding: 40px;
  gap: 18px;
  transform: translateY(-100%);
  transition: transform .55s var(--ease);
}
.mobile-menu.open{ transform: translateY(0); }
.mobile-menu a{
  font-family: var(--font-display);
  font-size: clamp(32px, 9vw, 48px);
  display:flex; align-items:baseline; gap:14px;
}
.mobile-menu a span{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* ============ MAIN CONTENT AREA ============ */
main{
  margin-left: var(--nav-w);
}

/* ============ HERO ============ */
.hero{
  min-height: 100vh;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding: 140px 0 100px;
}
.hero h1{
  font-size: clamp(40px, 6.4vw, 82px);
  max-width: 14ch;
}
.hero h1 em{
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}
.hero .sub{
  margin-top: 26px;
  max-width: 46ch;
  font-size: 18px;
  color: var(--ink-soft);
}
.hero .cta-row{
  margin-top: 44px;
  display:flex;
  gap: 16px;
  flex-wrap: wrap;
}
.btn{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  padding: 15px 26px;
  border-radius: 100px;
  transition: transform .45s var(--ease), background .3s, color .3s, border-color .3s;
  will-change: transform;
}
.btn-solid{
  background: var(--ink);
  color: var(--bg);
}
.btn-solid:hover{ background: var(--accent); }
.btn-ghost{
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover{ border-color: var(--ink); }

.hero-mark{
  margin-top: 90px;
  display:flex;
  align-items:center;
  gap: 28px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}
.hero-mark .dot{
  width:7px; height:7px; border-radius:50%;
  background: #4CAF50;
  animation: pulse 2s ease infinite;
}
@keyframes pulse{
  0%,100%{ opacity:1; transform:scale(1); }
  50%{ opacity:.4; transform:scale(0.8); }
}

/* ============ REVEAL UTILITY ============ */
.reveal{
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.is-visible{
  opacity: 1;
  transform: translateY(0);
}

/* ============ SECTION HEADER ============ */
.sec-head{
  padding-top: 130px;
  margin-bottom: 60px;
}
.sec-head h2{
  font-size: clamp(30px, 4.4vw, 46px);
}

section:first-of-type .sec-head{ padding-top:0; }

/* ============ WORK / GALLERY ============ */
.work{ padding-bottom: 40px; }
.work-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}
.work-card{
  cursor: pointer;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.work-thumb{
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1s var(--ease);
  background: var(--bg-alt);
}
.work-card.is-visible .work-thumb{ clip-path: inset(0 0 0% 0); }
.thumb-img{
  width:100%; height:100%;
  object-fit: cover;
  transition: transform .7s var(--ease);
}
.work-card:hover .thumb-img{ transform: scale(1.06); }
.thumb-glyph{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26%;
  color: rgba(255,255,255,0.92);
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 55%),
    linear-gradient(135deg, var(--g1), var(--g2));
  transition: transform .7s var(--ease);
}
.work-card:hover .thumb-glyph{ transform: scale(1.06); }
.work-meta{
  display:flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 18px;
  gap: 12px;
}
.work-meta h3{
  font-size: 21px;
  font-weight: 500;
}
.work-tags{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  text-align: right;
}

/* ============ MODAL ============ */
.modal-overlay{
  position: fixed; inset:0;
  background: rgba(22,21,15,0.5);
  backdrop-filter: blur(3px);
  z-index: 300;
  opacity:0;
  pointer-events:none;
  transition: opacity .4s var(--ease);
}
.modal-overlay.open{ opacity:1; pointer-events:auto; }
.modal{
  position: fixed;
  top: 50%; left:50%;
  width: min(560px, calc(100vw - 48px));
  max-height: 82vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  z-index: 301;
  transform: translate(-50%,-48%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .5s var(--ease), opacity .4s var(--ease);
}
.modal.open{
  transform: translate(-50%,-50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.modal-close{
  position:absolute; top:24px; right:24px;
  width:34px; height:34px;
  border-radius:50%;
  border: 1px solid var(--line);
  display:flex; align-items:center; justify-content:center;
  transition: transform .3s var(--ease), border-color .3s;
}
.modal-close:hover{ transform: rotate(90deg); border-color: var(--ink); }
.modal h3{ font-size: 28px; margin-bottom: 6px; padding-right: 40px; }
.modal .modal-role{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 20px;
}
.modal p{ color: var(--ink-soft); margin-bottom: 22px; }
.modal-tags{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 26px; }
.chip{
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.modal-actions{ display:flex; gap:12px; flex-wrap:wrap; }

/* ============ RESUME ============ */
.resume-grid{
  display:grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 60px;
}
.timeline-item{
  padding: 26px 0;
  border-top: 1px solid var(--line);
  display:grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
}
.timeline-item:last-child{ border-bottom: 1px solid var(--line); }
.timeline-item .year{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  padding-top: 3px;
}
.timeline-item h3{ font-size: 19px; font-weight:500; }
.timeline-item .org{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin: 4px 0 10px;
}
.timeline-item p{ color: var(--ink-soft); font-size: 15px; }

.skills-col h3{
  font-size: 15px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 18px;
}
.skills-list{ display:flex; flex-wrap:wrap; gap:10px; margin-bottom: 40px; }
.skills-list .chip{ background: var(--bg-alt); color: var(--ink); border: 1px solid var(--line); }

.resume-download{ margin-top: 6px; }

/* ============ CONTACT ============ */
.contact{ padding-bottom: 140px; }
.contact-grid{
  display:grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 60px;
}
.contact-intro h2{ font-size: clamp(30px, 4.4vw, 46px); margin-bottom: 20px; }
.contact-intro p{ color: var(--ink-soft); max-width: 40ch; margin-bottom: 30px; }
.contact-links{ display:flex; flex-direction:column; gap: 10px; }
.contact-links a{
  font-family: var(--font-mono);
  font-size: 14px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  width: fit-content;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .3s, color .3s;
}
.contact-links a:hover{ color: var(--accent); border-color: var(--accent); }

.field{
  position: relative;
  margin-bottom: 26px;
}
.field input, .field textarea{
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 10px;
  font-size: 16px;
  transition: border-color .3s;
}
.field textarea{ resize: vertical; min-height: 90px; }
.field label{
  position:absolute;
  left:0; top:12px;
  color: var(--ink-faint);
  font-size: 16px;
  pointer-events:none;
  transition: transform .3s var(--ease), font-size .3s var(--ease), color .3s;
  transform-origin: left top;
}
.field input:focus, .field textarea:focus{ outline:none; border-color: var(--accent); }
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label{
  transform: translateY(-20px);
  font-size: 12px;
  color: var(--accent);
}
.field .err{
  font-family: var(--font-mono);
  font-size: 11px;
  color: #C8452C;
  margin-top: 6px;
  height: 14px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s, transform .3s;
}
.field.invalid .err{ opacity:1; transform:translateY(0); }
.field.invalid input, .field.invalid textarea{ border-color: #C8452C; }
.field.shake{ animation: shake .4s var(--ease); }
@keyframes shake{
  20%{ transform: translateX(-6px); }
  40%{ transform: translateX(5px); }
  60%{ transform: translateX(-3px); }
  80%{ transform: translateX(2px); }
  100%{ transform: translateX(0); }
}

.submit-btn{
  position: relative;
  overflow: hidden;
  min-width: 168px;
  justify-content: center;
}
.submit-btn .label-sending, .submit-btn .label-sent, .submit-btn .label-error{
  display:none;
  align-items:center;
  gap:8px;
}
.submit-btn.sending .label-idle{ display:none; }
.submit-btn.sending .label-sending{ display:inline-flex; }
.submit-btn.sent .label-idle, .submit-btn.sent .label-sending{ display:none; }
.submit-btn.sent .label-sent{ display:inline-flex; }
.submit-btn.sent{ background: #2E7D46; }
.submit-btn.error .label-idle, .submit-btn.error .label-sending{ display:none; }
.submit-btn.error .label-error{ display:inline-flex; }
.submit-btn.error{ background: #C8452C; }
.spinner{
  width:12px; height:12px;
  border-radius:50%;
  border: 1.5px solid rgba(250,249,246,0.35);
  border-top-color: var(--bg);
  animation: spin .7s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
.check{ width:14px; height:14px; }
.check path{
  stroke: var(--bg);
  stroke-width: 2.4;
  fill:none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: draw .5s var(--ease) forwards;
}
@keyframes draw{ to{ stroke-dashoffset: 0; } }
.form-status{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 14px;
  min-height: 14px;
}

/* ============ FOOTER ============ */
footer{
  border-top: 1px solid var(--line);
  padding: 34px 0;
  display:flex;
  justify-content: space-between;
  align-items:center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}
.back-top{
  display:flex; align-items:center; gap:8px;
  transition: color .3s, transform .4s var(--ease);
}
.back-top:hover{ color: var(--accent); transform: translateY(-2px); }

/* ============ SINGLE PROJECT PAGE ============ */
.single-project-hero{ padding: 160px 0 60px; }
.single-project-hero .back-link{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  display:inline-flex;
  gap:8px;
  margin-bottom: 30px;
  transition: color .3s;
}
.single-project-hero .back-link:hover{ color: var(--accent); }
.single-project-hero h1{ font-size: clamp(32px, 5vw, 54px); margin-bottom: 14px; }
.single-project-image{
  border-radius: 14px;
  overflow: hidden;
  margin: 40px 0 50px;
  aspect-ratio: 16/9;
}
.single-project-image img{ width:100%; height:100%; object-fit:cover; }
.single-project-content{ max-width: 68ch; color: var(--ink-soft); font-size: 17px; }
.single-project-content p{ margin-bottom: 18px; }
.single-project-footer{ margin-top: 40px; padding-bottom: 120px; display:flex; gap:14px; flex-wrap:wrap; }

/* ============ ADMIN NOTICE ON FRONT-END (empty states) ============ */
.maya-empty-state{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* ============ RESPONSIVE ============ */
@media (min-width: 641px){
  .work-card:nth-child(6n+1) .thumb-glyph{ --g1:#3D3DFF; --g2:#8A8AFF; }
  .work-card:nth-child(6n+2) .thumb-glyph{ --g1:#16150F; --g2:#4A4938; }
  .work-card:nth-child(6n+3) .thumb-glyph{ --g1:#7A6BFF; --g2:#3D3DFF; }
  .work-card:nth-child(6n+4) .thumb-glyph{ --g1:#2D2C22; --g2:#5B584D; }
  .work-card:nth-child(6n+5) .thumb-glyph{ --g1:#4646E0; --g2:#16150F; }
  .work-card:nth-child(6n+6) .thumb-glyph{ --g1:#5B584D; --g2:#3D3DFF; }
}

@media (max-width: 900px){
  .resume-grid, .contact-grid{ grid-template-columns: 1fr; }
  .resume-grid{ gap: 50px; }
}

@media (max-width: 640px){
  .index-nav{ display:none; }
  .topbar{ display:flex; }
  main{ margin-left: 0; padding-top: var(--topbar-h); }
  .wrap{ padding: 0 22px; }
  .hero{ min-height: auto; padding: 60px 0 70px; }
  .hero-mark{ margin-top: 60px; }
  .sec-head{ padding-top: 80px; }
  .work-grid{ grid-template-columns: 1fr; gap: 40px; }
  .thumb-glyph{ font-size: 20%; }
  .modal{ padding: 28px; }
  footer{ flex-direction:column; gap:14px; text-align:center; }
  .single-project-hero{ padding-top: 100px; }
}
