/* Hassan El Shazly - portfolio
   Two themes through CSS variables. data-theme on <html> picks one. */
html[data-theme='dark'] {
  --bg: #101216;
  --card: #181b22;
  --line: #2a2e38;
  --text: #c5c9d3;
  --heading: #f4f1ea;
  --muted: #8b90a0;
  --accent: #f5b04c;
  --on-accent: #1a1204;
  --shadow: rgba(0, 0, 0, 0.45);
}
html[data-theme='light'] {
  --bg: #f6f3ec;
  --card: #ffffff;
  --line: #ddd6c7;
  --text: #3f4250;
  --heading: #1a1b22;
  --muted: #6b6e7c;
  --accent: #c2410c;
  --on-accent: #ffffff;
  --shadow: rgba(60, 40, 10, 0.14);
}
:root {
  --sans: 'Inter', system-ui, sans-serif;
  --head: 'Space Grotesk', 'Inter', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.7; transition: background 0.3s, color 0.3s; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--head); color: var(--heading); line-height: 1.1; }
.mono { font-family: var(--mono); }

/* ----- Navbar ----- */
.navbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px 6%; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-family: var(--mono); font-weight: 500; font-size: 1.05rem; text-decoration: none; color: var(--heading); }
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo-icon { color: var(--accent); flex-shrink: 0; transition: transform 0.25s; }
.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.1); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 0.92rem; transition: color 0.2s, transform 0.2s; }
.nav-links a:hover { color: var(--accent); transform: translateY(-2px); }
.nav-icon { width: 15px; height: 15px; fill: currentColor; opacity: 0.75; flex-shrink: 0; transition: transform 0.2s, opacity 0.2s; }
.nav-links a:hover .nav-icon { transform: scale(1.2); opacity: 1; }
.nav-actions { display: flex; gap: 10px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); border-radius: 10px; color: var(--heading); cursor: pointer; transition: border-color 0.2s, transform 0.2s; position: relative; }
.icon-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
/* dark theme shows the sun (click to go light); light theme shows the moon */
html[data-theme='dark'] .icon-moon, html[data-theme='light'] .icon-sun { display: none; }
.menu-toggle { display: none; }
.menu-toggle span { position: absolute; left: 11px; right: 11px; height: 2px; background: currentColor; transition: transform 0.25s; }
.menu-toggle span:first-child { top: 16px; }
.menu-toggle span:last-child { top: 23px; }
.menu-toggle[aria-expanded='true'] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* ----- Hero ----- */
.hero { max-width: 1100px; margin: 0 auto; padding: 36px 6% 56px; display: grid; grid-template-columns: 1.15fr 1fr; gap: 60px; align-items: center; }
.hero h1 { font-size: clamp(3rem, 8vw, 5.6rem); letter-spacing: -0.03em; margin: 14px 0 12px; animation: rise 0.7s 0.1s both; }
.role { font-family: var(--head); font-size: clamp(1.25rem, 2.6vw, 1.7rem); color: var(--muted); animation: rise 0.7s 0.2s both; }
.lead { max-width: 520px; margin-top: 20px; animation: rise 0.7s 0.3s both; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; animation: rise 0.7s 0.4s both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.portrait { position: relative; justify-self: center; width: min(100%, 290px); animation: rise 0.9s 0.25s both; }
.portrait-frame { position: relative; aspect-ratio: 1 / 1; border-radius: 50%; overflow: hidden; border: 2px solid var(--accent); box-shadow: 14px 14px 0 var(--card), 14px 14px 0 1px var(--line); background: var(--card); }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; transition: transform 0.6s; }
.portrait:hover .portrait-frame img { transform: scale(1.04); }

.btn { display: inline-block; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.92rem; border: 1.5px solid transparent; transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s; }
.btn:hover { transform: translateY(-3px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { box-shadow: 0 10px 24px var(--shadow); }
.btn-ghost { border-color: var(--line); color: var(--heading); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ----- Sections ----- */
.section { max-width: 1100px; margin: 0 auto; padding: 90px 6%; }
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin-bottom: 36px; display: flex; align-items: baseline; gap: 14px; }
.section-title .mono { color: var(--accent); font-size: 0.95rem; font-weight: 400; }
.center-title { justify-content: center; }
.section-note { color: var(--muted); margin: -16px 0 34px; }

.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 50px; align-items: start; }
.about-body p { margin-bottom: 18px; }
.facts { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.facts div { padding: 16px 20px; border-bottom: 1px solid var(--line); transition: transform 0.2s; }
.facts div:hover { transform: translateX(5px); }
.facts div:last-child { border: 0; }
.facts dt { color: var(--accent); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; }
.facts dd { color: var(--heading); font-weight: 500; font-size: 0.95rem; }

.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.skill-group { border-top: 2px solid var(--accent); padding-top: 14px; }
.skill-group h3 { font-size: 0.85rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 14px; }
.skill-group ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.skill-group li { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; font-size: 0.92rem; color: var(--heading); transition: border-color 0.2s, transform 0.2s; }
.skill-group li:hover { border-color: var(--accent); transform: translateY(-3px); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 26px; }
.project { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s; }
.project:hover { transform: translateY(-8px); box-shadow: 0 22px 40px var(--shadow); border-color: var(--accent); }
.thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.5s; }
.project:hover .thumb img { transform: scale(1.05); }
.project-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.project h3 { font-size: 1.3rem; margin-bottom: 8px; }
.project p { color: var(--muted); font-size: 0.93rem; line-height: 1.6; flex: 1; }
.project-tech { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.project-tech span { font-size: 0.72rem; color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; }
.project-links { display: flex; gap: 20px; }
.project-links a { display: inline-block; color: var(--heading); font-weight: 600; font-size: 0.9rem; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 1px; transition: color 0.2s, transform 0.2s; }
.project-links a:hover { color: var(--accent); transform: translateY(-2px); }

.timeline { list-style: none; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li { position: relative; padding: 0 0 30px 30px; transition: transform 0.25s; }
.timeline li:hover { transform: translateX(5px); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); transition: transform 0.25s; }
.timeline li:hover::before { transform: scale(1.3); }
.timeline h3 { font-size: 1.1rem; }
.timeline p { color: var(--muted); }

.contact { text-align: center; }
.contact-text { max-width: 520px; margin: 0 auto 30px; color: var(--muted); }
.contact-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }

.footer { text-align: center; padding: 30px 6%; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.footer a { color: var(--accent); }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
/* the project card also has a hover transform, so the visible state must not fight it */
.project.reveal.visible { transition: opacity 0.6s, transform 0.25s, box-shadow 0.25s, border-color 0.25s; }

/* ----- Responsive ----- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto auto auto; column-gap: 14px; row-gap: 0; align-items: center; padding: 64px 5% 40px; }
  .hero-text { display: contents; }
  .hero h1 { grid-column: 1; grid-row: 1; align-self: end; color: var(--accent); font-size: clamp(1.55rem, 6.6vw, 3rem); margin: 0 0 4px; }
  .role { grid-column: 1; grid-row: 2; font-size: clamp(0.95rem, 3.8vw, 1.3rem); line-height: 1.3; }
  .lead { grid-column: 1; grid-row: 3; align-self: start; font-size: 0.85rem; line-height: 1.5; margin-top: 10px; }
  .portrait { order: 0; grid-column: 2; grid-row: 1 / 4; align-self: center; width: 100%; max-width: 260px; justify-self: end; }
  .portrait-frame { box-shadow: none; }
  .hero-buttons { grid-column: 1 / -1; grid-row: 4; display: flex; flex-wrap: nowrap; gap: 12px; margin-top: 28px; }
  .hero-buttons .btn { flex: 1 1 0; text-align: center; padding: 11px 10px; font-size: 0.88rem; white-space: nowrap; }
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: grid; }
  .nav-links { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 18px; padding: 22px 6% 26px; background: var(--bg); border-bottom: 1px solid var(--line); display: none; }
  .nav-links.open { display: flex; }
  .section { padding: 64px 6%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .icon-btn:hover, .nav-links a:hover, .nav-links a:hover .nav-icon, .skill-group li:hover,
  .project:hover, .project:hover .thumb img, .project-links a:hover, .portrait:hover .portrait-frame img,
  .facts div:hover, .timeline li:hover, .timeline li:hover::before, .logo:hover .logo-icon { transform: none !important; }
}
