/* =====================================================================
 *  Sameer Al Sahab — portfolio
 *  Fonts live in ./fonts (served from the same origin as the site)
 *    Space Grotesk  → display / headings
 *    Inter          → body
 *    OPlus Sans     → navigation + buttons
 *    Letter Mono LL → small labels, badges, section indices
 *    Ndot55         → big numbers (stats)
 *    NType82        → wordmark
 *    Google Sans Code → footer / fine print
 *  ===================================================================== */

@font-face { font-family: "Space Grotesk"; src: url("fonts/SpaceGrotesk-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "OPlus Sans"; src: url("fonts/OPlusSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Letter Mono"; src: url("fonts/LetteraMonoLL-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Ndot55"; src: url("fonts/Ndot55-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "NType82"; src: url("fonts/NType82-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Google Sans Code"; src: url("fonts/GoogleSansCode-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Google Sans Code"; src: url("fonts/GoogleSansCode-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f5f3ee;
  --surface: #fbfaf7;
  --ink: #181816;
  --muted: #6a675f;
  --line: #e2dfd6;
  --accent: #2b4a3f;
  --accent-soft: #dfe7e2;
  --accent-ink: #f5f3ee;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(0,0,0,.02), 0 18px 40px -22px rgba(24,24,22,.18);
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-nav: "OPlus Sans", "Inter", sans-serif;
  --font-mono: "Letter Mono", "Google Sans Code", ui-monospace, monospace;
  --font-dot: "Ndot55", "Space Grotesk", sans-serif;
  --font-mark: "NType82", "Space Grotesk", sans-serif;
  --font-code: "Google Sans Code", ui-monospace, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --surface: #181816; --ink: #efede6; --muted: #9a968b;
    --line: #2a2926; --accent: #9ccbb9; --accent-soft: #1e2a25; --accent-ink: #0f1a16;
    --shadow: 0 18px 40px -22px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --surface: #181816; --ink: #efede6; --muted: #9a968b;
  --line: #2a2926; --accent: #9ccbb9; --accent-soft: #1e2a25; --accent-ink: #0f1a16;
  --shadow: 0 18px 40px -22px rgba(0,0,0,.7);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background .35s, color .35s;
}
h1, h2, h3, .font-display {
  font-family: var(--font-display); font-weight: 400; font-synthesis: none;
  line-height: 1.08; letter-spacing: -.02em; margin: 0;
}
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
strong { font-weight: 600; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 1.5rem; }
.section   { padding-block: clamp(4rem, 9vw, 7rem); }
.text-muted { color: var(--muted); }

main { counter-reset: sec; }
main > section.section:not(.gallery-section) { counter-increment: sec; }
main > section.section + section.section:not(.gallery-section) { border-top: 1px solid var(--line); }

.section-title {
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  margin-bottom: 2.5rem;
  display: flex; flex-direction: column; gap: .9rem;
}
.section-title::before {
  content: counter(sec, decimal-leading-zero);
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .18em;
  color: var(--accent);
  display: flex; align-items: center; gap: .9rem;
}
.section-title.sub::before { content: none; }
.section-title.sub { font-size: clamp(1.5rem, 3vw, 2rem); }
.gallery-section .section-title::before { content: "—"; }
.section-header { margin-bottom: 1rem; }
.section-header .section-title { align-items: center; }
.section-tag { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; }

/* ---------- flex / grid presets ---------- */
.flex-row      { display: flex; flex-direction: row; gap: .75rem; flex-wrap: wrap; }
.flex-col      { display: flex; flex-direction: column; gap: 1rem; }
.flex-center   { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.flex-wrap-gap { display: flex; flex-wrap: wrap; gap: .5rem; }

.grid-auto { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2    { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.75rem;
  transition: background .35s, border-color .25s, transform .35s var(--ease), box-shadow .35s;
}
.card-title { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; letter-spacing: -.01em; margin-bottom: .5rem; line-height: 1.2; }
.card-media { aspect-ratio: 16/10; border-radius: var(--radius-sm); background: var(--line); margin-bottom: 1rem; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-flat { box-shadow: none; }
.card p.text-muted { font-size: .95rem; line-height: 1.7; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.4rem; border-radius: 999px; border: 1px solid transparent;
  font: 400 .92rem/1 var(--font-nav); letter-spacing: .01em; cursor: pointer; text-decoration: none;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary   { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); }
.btn-ghost     { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--line); }
.btn-sm { padding: .5rem 1rem; font-size: .82rem; }
.btn-lg { padding: .9rem 1.7rem; font-size: 1rem; }

/* ---------- badge ---------- */
.badge {
  display: inline-block; padding: .28rem .7rem; border-radius: 6px;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: 1px solid var(--line);
}

/* ---------- form ---------- */
.contact-container { max-width: 720px; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.input, .textarea {
  width: 100%; padding: .85rem 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--ink); font: inherit; transition: border-color .25s;
}
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.input:focus, .textarea:focus { outline: none; border-bottom-color: var(--accent); }
.textarea { min-height: 140px; resize: vertical; }
#contact-form.card { gap: 1.75rem; padding: clamp(1.5rem, 4vw, 2.5rem); }
.form-status { font-size: .9rem; min-height: 1.25rem; }
.form-status.ok { color: #2a7a4b; } .form-status.err { color: #b3392f; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav > .container > a { font-family: var(--font-mark); font-size: 1.1rem; letter-spacing: .02em; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-links { display: none; gap: 1.75rem; }
.nav a.nav-link {
  position: relative; text-decoration: none; color: var(--muted);
  font-family: var(--font-nav); font-size: .92rem; padding: .25rem 0; transition: color .2s;
}
.nav a.nav-link:hover, .nav a.nav-link.active { color: var(--ink); }
.nav a.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.nav a.nav-link.active::after, .nav a.nav-link:hover::after { transform: scaleX(1); }

.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; transition: border-color .2s, transform .3s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); transform: rotate(-12deg); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

.progress { position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

@media (min-width: 768px) { .md-hide { display: none; } .nav-links { display: flex; } }
@media (max-width: 767px) {
  #nav-links.open {
  display: flex; flex-direction: column; gap: .25rem; position: absolute; top: 100%; left: 0; right: 0;
  padding: .75rem 1.5rem 1.25rem; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  #nav-links.open a.nav-link { padding: .65rem 0; font-size: 1.05rem; }
}

/* ---------- hero ---------- */
.hero { position: relative; overflow-x: clip; padding-top: clamp(3rem, 7vw, 5.5rem); }
.hero-row { display: flex; flex-direction: column; gap: 2.5rem; }
@media (min-width: 768px) { .hero-row { flex-direction: row; align-items: center; gap: clamp(3rem, 7vw, 6rem); } }

.hero h1 { font-size: clamp(2.75rem, 8vw, 5.5rem); line-height: .98; letter-spacing: -.035em; }
.hero p.text-muted { font-size: 1.15rem; max-width: 40ch; }
.hero .social-icon { --brand: var(--ink) !important; }

.hero-figure {
  --px: 0; --py: 0;
  position: relative; flex: none; align-self: center;
  width: min(340px, 82vw); height: min(500px, 120vw);
  clip-path: inset(-40% -30% 0 -30%);
}
.hero-arch {
  position: absolute; inset: 17% 7% 0 7%;
  border-radius: 999px 999px var(--radius) var(--radius);
  background: linear-gradient(180deg, var(--accent-soft) 0%, color-mix(in srgb, var(--accent) 88%, #000) 140%);
}
.hero-arch::after {
  content: ""; position: absolute; inset: -14px -14px 0 -14px;
  border: 1px solid var(--accent); opacity: .3; border-radius: inherit; border-bottom: 0;
}
.hero-cut {
  position: absolute; left: 0; right: 0; bottom: -6%; margin-inline: auto;
  height: 106%; width: auto; max-width: none;
  filter: drop-shadow(0 22px 26px rgba(0,0,0,.28));
  transform: translate(calc(var(--px) * 8px), calc(var(--py) * 5px));
  transition: transform .3s ease-out;
  animation: rise 1s var(--ease) both;
}
@keyframes rise { from { translate: 0 10%; opacity: 0; } to { translate: 0 0; opacity: 1; } }

/* ---------- social icons ---------- */
.social-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand, #444); transition: transform .25s var(--ease), background .2s;
}
.social-icon:hover { transform: translateY(-3px); background: var(--accent) !important; }
.social-icon img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
:root[data-theme="dark"] .hero .social-icon img { filter: brightness(0); }
.avatar { width: 240px; height: 240px; border-radius: 50%; background: var(--line); object-fit: cover; }

/* ---------- recognition / stats ---------- */
#recognition h2:not(.section-title) {
font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 1.75rem; color: var(--ink);
}
#recognition > .container > p:not(.text-muted) {
font-family: var(--font-mono); color: var(--line); letter-spacing: .4em; margin: 3rem 0 1.5rem; overflow: hidden;
}
.stats { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat  { background: var(--surface); padding: 2rem 1.25rem; text-align: left; transition: background .3s; }
.stat-num   { font-family: var(--font-dot); font-size: clamp(2.25rem, 5vw, 3.25rem); color: var(--accent); line-height: 1; letter-spacing: .01em; }
.stat-label { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: .9rem; line-height: 1.5; }
@media (hover: hover) { .stat:hover { background: var(--accent-soft); } }

details.more summary {
  cursor: pointer; list-style: none; font-family: var(--font-nav); color: var(--accent);
  margin-top: 1.25rem; width: fit-content; border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "\2212  "; }
.more-body { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); line-height: 1.85; }
.more-body p + p { margin-top: 1rem; }

/* ---------- why hire me ---------- */
#why-hire-me .card { padding: clamp(1.5rem, 4vw, 2.5rem); }
#why-hire-me .card > p { max-width: 70ch; }

/* ---------- projects ---------- */
#projects h3.font-display {
font-family: var(--font-mono); font-size: .78rem !important; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
padding-bottom: .9rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem;
}
@media (hover: hover) {
  .grid-auto .card:hover, .grid-2 .card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
}

/* ---------- timeline ---------- */
.timeline { border-left: 1px solid var(--line); padding-left: 2rem; display: flex; flex-direction: column; gap: 2.25rem; margin-left: 5px; }
.timeline-item { position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: calc(-2rem - 5.5px); top: .55rem; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline-item .badge { margin-top: .5rem; }

/* ---------- gallery ---------- */
.gallery { columns: 3 220px; column-gap: 1rem; }
.gallery-item { break-inside: avoid; margin-bottom: 1rem; border-radius: var(--radius-sm); overflow: hidden; background: var(--line); cursor: zoom-in; }
.gallery-item img { width: 100%; display: block; transition: transform .6s var(--ease); }
@media (hover: hover) { .gallery-item:hover img { transform: scale(1.04); } }

.gallery-section {
  display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden; padding-block: 0;
  transition: grid-template-rows .7s var(--ease), padding .7s var(--ease), opacity .45s ease, visibility 0s linear .7s;
}
.gallery-section > .container { min-height: 0; overflow: hidden; }
.gallery-section.open {
  grid-template-rows: 1fr; opacity: 1; visibility: visible; padding-block: clamp(4rem, 9vw, 7rem);
  transition: grid-template-rows .7s var(--ease), padding .7s var(--ease), opacity .6s ease .1s, visibility 0s;
  border-top: 1px solid var(--line);
}

/* ---------- lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 92vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10,10,9,.82); backdrop-filter: blur(8px); }
.lightbox img { display: block; max-width: 94vw; max-height: 90vh; border-radius: var(--radius-sm); cursor: zoom-out; }
.lightbox[open] { animation: lb .3s var(--ease); }
@keyframes lb { from { opacity: 0; scale: .96; } to { opacity: 1; scale: 1; } }

/* ---------- footer ---------- */
footer.section p { font-family: var(--font-code); font-size: .78rem; }

@media (prefers-reduced-motion: reduce) {
  .hero-cut, .lightbox[open] { animation: none !important; }
  .gallery-section, .gallery-section.open { transition: none !important; }
}
