/* =========================================================================
   Ibrahim — Personal Website
   Apple-inspired, monochrome + single green accent. Dark by default.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

:root,
[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-elev: #141417;
  --bg-elev2: #1c1c20;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f7;
  --text-2: rgba(245, 245, 247, 0.60);
  --text-3: rgba(245, 245, 247, 0.40);
  --accent: #30d158;
  --accent-soft: rgba(48, 209, 88, 0.14);
  --nav-bg: rgba(10, 10, 12, 0.70);
  --glow: rgba(48, 209, 88, 0.12);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -34px rgba(0, 0, 0, 0.9);
}

[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --bg-elev2: #f4f4f6;
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text: #1d1d1f;
  --text-2: rgba(29, 29, 31, 0.64);
  --text-3: rgba(29, 29, 31, 0.42);
  --accent: #248a3d;
  --accent-soft: rgba(36, 138, 61, 0.10);
  --nav-bg: rgba(251, 251, 253, 0.72);
  --glow: rgba(36, 138, 61, 0.07);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 24px 50px -34px rgba(0, 0, 0, 0.22);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Geeza Pro", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color .5s ease, color .5s ease;
}

::selection { background: var(--accent-soft); }
a { color: inherit; text-decoration: none; }

.mono {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
}

/* RTL: flip directional arrows */
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

/* Shared focus ring for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ Root */
.page {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background-color .5s ease, color .5s ease;
}

.shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.eyebrow {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

/* --------------------------------------------------------------- Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
.nav {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  flex: none;
}
.brand img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border-strong);
  background: var(--bg-elev2);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14.5px;
  color: var(--text-2);
}
.nav-links a { transition: color .2s; }
.nav-links a:hover { color: var(--text); }

/* Language switcher */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  flex: none;
}
.lang-switch button {
  padding: 5px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  transition: all .2s;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
}
.lang-switch button:hover { color: var(--text-2); }
.lang-switch button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

/* Theme toggle */
.theme-toggle {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  width: 56px;
  height: 30px;
  border-radius: 16px;
  position: relative;
  padding: 0;
  flex: none;
  transition: background .3s, border-color .3s;
}
.theme-toggle .sun {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 11px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.theme-toggle .sun svg { display: block; opacity: .55; color: var(--text-2); }
.theme-toggle .stars {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: .55;
  color: var(--text-2);
}
.theme-toggle .stars span { border-radius: 50%; background: currentColor; display: block; }
.theme-toggle .stars span:nth-child(1) { width: 3px; height: 3px; }
.theme-toggle .stars span:nth-child(2) { width: 2px; height: 2px; }
.theme-toggle .stars span:nth-child(3) { width: 2.5px; height: 2.5px; }
.theme-toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text);
  transform: translateX(0);
  transition: transform .32s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .theme-toggle .knob { transform: translateX(26px); }

/* ----------------------------------------------------------------- Hero */
.hero {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(72px, 15vh, 150px) 24px clamp(60px, 10vh, 110px);
}
.hero-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 90%);
  height: 520px;
  background: radial-gradient(ellipse at center, var(--glow), transparent 68%);
  pointer-events: none;
  filter: blur(8px);
  z-index: 0;
}
.hero-inner { position: relative; z-index: 1; max-width: 880px; }
.hero-avatar {
  width: clamp(100px, 15vw, 150px);
  height: clamp(100px, 15vw, 150px);
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 32px;
  background: var(--bg-elev2);
  box-shadow: 0 0 0 1px var(--border-strong), 0 22px 55px -22px rgba(0, 0, 0, 0.55);
  animation: fadeUp .8s both;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 13px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-elev);
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 34px;
  animation: fadeUp .8s .04s both;
  transition: border-color .2s, color .2s;
}
.hero-badge:hover { border-color: var(--border-strong); color: var(--text); }
.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: block;
  animation: pulseDot 2.6s infinite;
}
.hero-badge svg { color: var(--text-3); }
.hero-greeting {
  font-size: clamp(19px, 2.4vw, 24px);
  color: var(--text-2);
  font-weight: 500;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
  animation: fadeUp .8s .08s both;
}
.hero-headline {
  font-size: clamp(40px, 7vw, 82px);
  line-height: 1.03;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 0 0 28px;
  text-wrap: balance;
  animation: fadeUp .9s .12s both;
}
.hero-sub {
  font-size: clamp(17px, 2.1vw, 21px);
  color: var(--text-2);
  max-width: 600px;
  line-height: 1.55;
  margin: 0 0 40px;
  animation: fadeUp .9s .2s both;
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  animation: fadeUp .9s .28s both;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 550;
  transition: transform .25s ease, opacity .25s, background .25s;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { transform: translateY(-2px); background: var(--bg-elev); }

.scroll-cue {
  position: relative;
  z-index: 1;
  margin-top: clamp(48px, 9vh, 96px);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 12px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.06em;
}
.scroll-cue svg { animation: bob 2.4s infinite; }

/* -------------------------------------------------------------- Reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s cubic-bezier(0.16, 1, 0.3, 1),
              transform .9s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- About */
.section { width: 100%; max-width: 1120px; margin: 0 auto; }
.about { padding: clamp(70px, 11vh, 130px) 24px; }
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.about-heading {
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
.about-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-size: clamp(16px, 1.7vw, 18.5px);
  line-height: 1.65;
  color: var(--text-2);
  max-width: 540px;
}
.about-body p { margin: 0; }

/* --------------------------------------------------------------- Skills */
.skills { padding: clamp(40px, 6vh, 70px) 24px clamp(70px, 11vh, 120px); }
.section-heading {
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 48px;
  max-width: 600px;
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.skill-card {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 18px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: transform .3s ease, border-color .3s;
}
.skill-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.skill-card .label { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 13.5px;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 12px;
  background: var(--bg-elev2);
}

/* ----------------------------------------------------------- Featured */
.work { padding: clamp(70px, 11vh, 120px) 24px; }
.work .section-heading { margin-bottom: 44px; }
.feature-card {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 28px;
  padding: clamp(28px, 4vw, 52px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: clamp(36px, 5vw, 64px);
  align-items: center;
  box-shadow: var(--card-shadow);
}
.phone-wrap { display: flex; justify-content: center; position: relative; }
.phone-glow {
  position: absolute;
  width: 70%;
  height: 70%;
  top: 14%;
  background: radial-gradient(ellipse at center, var(--glow), transparent 70%);
  filter: blur(10px);
}
.phone {
  position: relative;
  width: clamp(210px, 62vw, 272px);
  aspect-ratio: 9 / 19.2;
  border-radius: 44px;
  padding: 11px;
  background: linear-gradient(160deg, #34343a, #0c0c0e);
  box-shadow: 0 0 0 1px var(--border-strong), 0 30px 70px -30px rgba(0, 0, 0, 0.85);
}
.phone .notch {
  position: absolute;
  top: 19px;
  left: 50%;
  transform: translateX(-50%);
  width: 86px;
  height: 26px;
  background: #000;
  border-radius: 14px;
  z-index: 3;
}
.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 34px;
  display: block;
  object-fit: cover;
  background: linear-gradient(180deg, #101012, #1a1a1e);
}

/* Styled image placeholder (replaces the prototype's drop-slot) */
.img-slot {
  position: relative;
  overflow: hidden;
  background: var(--bg-elev2);
}
.img-slot::after {
  content: attr(data-placeholder);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-3);
}
.img-slot.has-image::after { display: none; }
.img-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.feature-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.feature-head h3 {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0;
}
.pill-accent {
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  border-radius: 100px;
  padding: 4px 11px;
  font-weight: 550;
}
.feature-desc {
  font-size: clamp(16px, 1.7vw, 18.5px);
  line-height: 1.62;
  color: var(--text-2);
  margin: 0 0 26px;
  max-width: 520px;
}
.feature-meta {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 26px;
}
.meta-row { display: flex; gap: 14px; align-items: baseline; }
.meta-label {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  width: 92px;
  flex: none;
}
.meta-val { font-size: 15px; color: var(--text-2); line-height: 1.5; }
.divider { height: 1px; background: var(--border); }

/* ------------------------------------------------------------ App grid */
.apps { padding: clamp(10px, 2vh, 30px) 24px clamp(70px, 11vh, 120px); }
.apps-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 40px;
}
.apps-head .section-heading { margin: 0; max-width: 560px; }
.view-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  color: var(--text-2);
  transition: color .2s;
}
.view-all:hover { color: var(--text); }
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}
.app-card {
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 18px;
  padding: 16px;
  transition: transform .3s ease, border-color .3s;
}
.app-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.app-icon {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  flex: none;
  box-shadow: inset 0 0 0 1px var(--border);
}
/* Monogram placeholder used until a real icon PNG is dropped in.
   Calm + monochrome per the brief; a single faint accent tint. */
.app-icon-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 120% at 30% 18%, var(--accent-soft), transparent 60%),
    var(--bg-elev2);
  color: var(--text-2);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-feature-settings: "ss01";
  user-select: none;
}
.app-icon.has-image { background: none; }
.app-icon.has-image img {
  width: 100%;
  height: 100%;
  border-radius: 13px;
  object-fit: cover;
  display: block;
}
.app-meta { min-width: 0; flex: 1; }
.app-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-tag { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.app-card > svg { color: var(--text-3); flex: none; }

/* -------------------------------------------------------------- Process */
.process {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.process-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(70px, 11vh, 120px) 24px;
}
.process-inner .section-heading { margin-bottom: 52px; max-width: 560px; }
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.process-step {
  position: relative;
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 170px;
}
.process-step .n {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.process-step .t { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.process-step .d { font-size: 14px; color: var(--text-2); line-height: 1.5; }

/* ----------------------------------------------------------- Philosophy */
.philosophy {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(90px, 16vh, 170px) 24px;
  text-align: center;
}
.philosophy .quote-mark {
  font-size: 64px;
  line-height: 0;
  color: var(--accent);
  font-weight: 600;
  display: inline-block;
  height: 30px;
}
.philosophy p {
  font-size: clamp(26px, 4vw, 46px);
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 24px 0 0;
  text-wrap: balance;
}

/* -------------------------------------------------------------- Contact */
.contact {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(20px, 4vh, 40px) 24px clamp(80px, 13vh, 140px);
}
.contact-card {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 28px;
  padding: clamp(40px, 7vw, 80px);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.contact-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  height: 340px;
  background: radial-gradient(ellipse at center, var(--glow), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}
.contact-inner { position: relative; }
.contact-heading {
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.contact-sub {
  font-size: clamp(16px, 1.9vw, 19px);
  color: var(--text-2);
  max-width: 480px;
  margin: 0 auto 38px;
  line-height: 1.55;
}
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.contact-actions .btn-ghost:hover { background: var(--bg-elev2); }

/* --------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--border); }
.footer-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--text-3);
}
.footer-inner .left { display: flex; align-items: center; gap: 8px; }
.footer-inner .left .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ------------------------------------------------------------ Keyframes */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* ------------------------------------------------------------ Responsive */
@media (max-width: 760px) {
  .nav-links { display: none; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
