/* ==========================================================
   Ahmed Ali — portfolio styles
   Mobile-first. No external fonts or frameworks.
   ========================================================== */

:root {
  --bg: #f7f4ef;
  --bg-alt: #efe9e0;
  --surface: #ffffff;
  --text: #22201c;
  --muted: #5c564d;
  --line: #ddd4c7;
  --accent: #8a5a2b;        /* oak */
  --accent-soft: #f1e4d3;
  --accent-light: #d6aa78;
  --built: #2f5d4a;
  --built-soft: #dfeae4;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, monospace;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(34, 32, 28, .06), 0 4px 16px rgba(34, 32, 28, .06);
  --gutter: 16px;
  --header-h: 64px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 768px) { :root { --gutter: 32px; } }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 100;
  background: var(--text); color: #fff; padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }

.eyebrow {
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .75em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font-weight: 600; text-decoration: none; border: 2px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-secondary { border-color: var(--text); color: var(--text); }
.btn-secondary:hover { background: var(--text); color: #fff; }
.btn-lg { min-height: 56px; padding: 0 32px; font-size: 1.05rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 244, 239, .92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { display: flex; align-items: center; }
.brand img { height: 32px; width: auto; }

.nav-toggle {
  display: grid; place-items: center; width: 44px; height: 44px;
  background: none; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  display: block; width: 20px; height: 2px; background: var(--text); position: relative; transition: transform .2s;
}
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: 12px 0; color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--accent); }

/* Mobile menu (only hidden when JS is available) */
.js .site-nav {
  position: absolute; top: var(--header-h); left: 0; right: 0;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter) 16px; display: none;
}
.js .site-nav.is-open { display: block; }
.no-js .nav-toggle { display: none; }
.no-js .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; }
.no-js .site-nav ul { display: flex; flex-wrap: wrap; gap: 0 18px; }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .js .site-nav, .site-nav { position: static; display: block; padding: 0; border: 0; background: none; }
  .site-nav ul { display: flex; align-items: center; gap: 28px; }
  .site-nav a { padding: 8px 0; }
  .site-nav .nav-cta { padding: 8px 18px; border-radius: 999px; background: var(--text); color: #fff; }
  .site-nav .nav-cta:hover { background: var(--accent); color: #fff; }
}

/* ---------- Hero ---------- */
.hero { padding: 48px 0 56px; border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; gap: 40px; align-items: center; }
.hero h1 .dot { color: var(--accent); }
.hero-lede { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.hero-meta { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 8px; }
.hero-meta li { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
.hero-meta svg {
  flex: none; width: 20px; height: 20px; margin-top: 3px;
  fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-photo { margin: 0; position: relative; }
.hero-photo::before {
  content: ""; position: absolute; inset: 14px -14px -14px 14px;
  border: 2px solid var(--accent); border-radius: var(--radius); z-index: 0;
}
.hero-photo img {
  position: relative; z-index: 1; width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
@media (max-width: 899px) { .hero-photo { margin-right: 14px; } }

@media (min-width: 900px) {
  .hero { padding: 88px 0 96px; }
  .hero-inner { grid-template-columns: 1.15fr 1fr; gap: 64px; }
}

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 680px; margin-bottom: 36px; }
.section-lede { color: var(--muted); font-size: 1.05rem; }
@media (min-width: 900px) { .section { padding: 96px 0; } }

/* ---------- Portfolio ---------- */
.project-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; }
@media (min-width: 640px)  { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .project-grid { grid-template-columns: repeat(3, 1fr); } }

.project-card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.project-main { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-alt); }
.project-main img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.project-main:hover img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .project-main img { transition: none; } }

.project-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.project-body p { color: var(--muted); font-size: .95rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
}
.tag-designed { background: var(--accent-soft); color: var(--accent); }
.tag-built { background: var(--built-soft); color: var(--built); }
.tag-placeholder { background: #fff3cd; color: #6b4e00; border: 1px dashed #c9a227; }

.project-docs { list-style: none; margin: auto 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.project-docs a {
  display: block; text-decoration: none; color: var(--text); font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.project-docs a:hover { border-color: var(--accent); color: var(--accent); }
.project-docs img { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; border-bottom: 1px solid var(--line); }
.project-docs span { display: block; padding: 6px 10px; }

/* ---------- Services ---------- */
.service-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
@media (min-width: 640px)  { .service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .service-grid { grid-template-columns: repeat(4, 1fr); } }
.service {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.service p { color: var(--muted); margin: 0; font-size: .95rem; }
.service-icon {
  width: 36px; height: 36px; margin-bottom: 16px;
  fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- About ---------- */
.about-grid { display: grid; gap: 8px; }
.about-text { max-width: 680px; font-size: 1.05rem; }
.about-photo {
  width: 100%; max-width: 360px; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 80%;
  border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 8px;
}
.callout {
  margin-top: 28px; padding: 24px; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius);
}
.callout p { margin: 0; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1fr 1.4fr; gap: 64px; } }

/* ---------- Tools ---------- */
.tool-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px)  { .tool-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tool-list { grid-template-columns: repeat(5, 1fr); } }
.tool-list li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tool-list span { color: var(--muted); font-size: .9rem; }
.tool-learning { border-style: dashed !important; }
.tool-learning span { color: var(--accent); font-weight: 600; }

/* ---------- Contact ---------- */
.contact { background: var(--text); color: #f3eee6; }
.contact h2 { color: #fff; }
.contact .eyebrow { color: var(--accent-light); }
.contact .section-lede { color: #cfc7bb; }
.contact-list { list-style: none; margin: 0 0 32px; padding: 0; display: grid; gap: 1px; background: #3a3631; border-radius: var(--radius); overflow: hidden; }
.contact-list li { display: grid; gap: 2px; padding: 16px 20px; background: #2a2723; }
.contact-label { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: #a89f92; }
.contact-list a { color: #fff; font-size: 1.1rem; font-weight: 600; word-break: break-word; }
.contact-list a:hover { color: var(--accent-light); }
.contact .btn-primary { background: var(--accent-light); color: var(--text); }
.contact .btn-primary:hover { background: #fff; color: var(--text); }
.contact :focus-visible { outline-color: var(--accent-light); }
@media (min-width: 768px) {
  .contact-list { grid-template-columns: repeat(2, 1fr); }
  .contact-list li { grid-template-columns: 110px 1fr; align-items: baseline; }
}

/* ---------- Footer ---------- */
.site-footer { background: #1a1815; color: #a89f92; font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-top: 24px; padding-bottom: 24px; }
.site-footer p { margin: 0; }
.site-footer a { color: #d9d1c5; }

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(1100px, 94vw); max-height: 92vh; overflow: visible;
}
.lightbox::backdrop { background: rgba(20, 18, 16, .88); }
.lightbox img { max-height: 82vh; width: auto; margin: 0 auto; border-radius: 6px; background: var(--bg); }
.lightbox-caption { color: #f3eee6; text-align: center; margin: 12px 0 0; font-weight: 600; }
.lightbox-close {
  position: absolute; top: -48px; right: 0; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #fff; color: var(--text); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
