/* =========================================================
   Habhab.tech — Marketing Director portfolio
   Palette: deep navy + gold
   ========================================================= */

:root {
  --navy-900: #081320;
  --navy-800: #0b1b2d;
  --navy-700: #0f2438;
  --navy-600: #16314a;
  --gold:     #f5b301;
  --gold-200: #ffcf4d;
  --ink:      #e8eef5;
  --muted:    #9fb1c4;
  --line:     rgba(255, 255, 255, 0.08);
  --maxw:     1180px;
  --radius:   14px;
  --shadow:   0 18px 50px rgba(0, 0, 0, 0.45);
  --ease:     cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; background: var(--navy-900); }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: transparent;
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Decorative background layers ---------- */

/* Layer 1 (back): textured navy background, fixed to the viewport. */
.bg-texture {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-color: var(--navy-900);
  /* Subtle film-grain texture (inline SVG fractal noise). */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: "Space Grotesk", sans-serif; line-height: 1.1; margin: 0; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

.section { padding: 96px 0; }

.section-head { max-width: 640px; margin-bottom: 48px; }

.section-title {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.section-lead, .section-head p { color: var(--muted); font-size: 1.05rem; margin: 0; }
.section-para { margin-top: 16px !important; font-size: 1rem; }
.hl { color: var(--gold); font-weight: 600; }
.work .section-head { max-width: 760px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 19, 32, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav { display: flex; align-items: center; justify-content: space-between; height: 70px; }

.brand { display: flex; align-items: center; gap: 10px; font-family: "Space Grotesk", sans-serif; font-weight: 700; }

.brand-text { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-text .dot { color: var(--gold); }

.nav-links { display: flex; align-items: center; gap: 32px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }

.nav-cta {
  background: var(--gold);
  color: var(--navy-900) !important;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-cta:hover { background: var(--gold-200); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--ink); transition: 0.25s; }

/* Cursor-following downward triangle attached to the navbar's bottom edge.
   JS sets transform: translateX (horizontal follow) + scaleY (length by cursor distance). */
.nav-cursor-tri {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 28px;
  height: 14px;
  transform: translateX(-14px) scaleY(1);
  transform-origin: top center;
  pointer-events: none;
  will-change: transform;
  transition: transform 120ms ease-out;
  z-index: 1;
}
.nav-cursor-tri svg { display: block; width: 100%; height: 100%; }
.nav-cursor-tri path { fill: var(--gold); }

/* Touch ripple — a pulsing circle that expands and fades on touch (mobile, added by JS) */
.touch-ripple {
  position: fixed;
  z-index: 60;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: rgba(245, 179, 1, 0.22);
  border: 2px solid var(--gold);
  pointer-events: none;
  animation: touch-ripple 600ms ease-out forwards;
}
@keyframes touch-ripple {
  from { transform: scale(0.3); opacity: 0.9; }
  to   { transform: scale(5);   opacity: 0; }
}

/* Period travels up the stacked titles, pausing ~0.5s at each (mobile hero) */
@keyframes period-up-titles {
  0%, 16.67%   { transform: translateY(0); }          /* bottom title */
  25%, 41.67%  { transform: translateY(-1.15rem); }   /* middle title */
  50%, 66.67%  { transform: translateY(-2.3rem); }    /* top title */
  75%, 91.67%  { transform: translateY(-1.15rem); }   /* middle title */
  100%         { transform: translateY(0); }           /* back to bottom */
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 120px 0 100px; }

.hero-inner { position: relative; z-index: 1; max-width: 780px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 18px;
}
/* "Data-driven creative" and its separator show on mobile only */
.eyebrow .role-mobile, .eyebrow .sep-mobile { display: none; }

.hero-title {
  font-size: clamp(3.4rem, 11vw, 7rem);
  letter-spacing: -0.04em;
  margin-bottom: 22px;
}
.hero-title .accent { color: var(--gold); }

.hero-sub { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--ink); max-width: 620px; margin: 0 0 20px; }

.hero-para { font-size: 1.02rem; color: var(--muted); max-width: 620px; margin: 0 0 36px; }

/* Mobile-only hero block (shown via the mobile media query) */
.hero-mobile { display: none; }
.hero-cta-line { display: none; }

/* Wrapper around eyebrow + title — transparent on desktop, a row on mobile */
.hero-head { display: contents; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 56px; }

.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--gold); color: var(--navy-900); }
.btn-primary:hover { background: var(--gold-200); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

/* Five-step process strip */
.process {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 0;
  margin: 0;
}
.process li {
  display: inline-flex;
  align-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
}
.process li::before {
  content: "→";
  color: var(--gold);
  font-weight: 700;
  margin-right: 16px;
}
.process li:first-child::before { content: none; }

/* Centered "A bit of insight..." section header + process strip */
.services-head { max-width: 900px; margin-left: auto; margin-right: auto; text-align: center; }
.services-head .process { margin-top: 18px; justify-content: center; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 40px; margin-bottom: 28px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: "Space Grotesk", sans-serif; font-size: 1.35rem; color: var(--ink); }
.hero-stats span { color: var(--muted); font-size: 0.85rem; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  margin: 0;
  background: var(--navy-700);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.35s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-6px); border-color: rgba(245,179,1,0.4); box-shadow: var(--shadow); }

.card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--navy-600);
  /* smart-load fade-in (toggled by JS once decoded) */
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.card img.loaded { opacity: 1; transform: scale(1); }

.card figcaption { padding: 18px 20px 22px; }
.card h3 { font-size: 1.15rem; margin-bottom: 4px; }
.card figcaption p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- Featured project (Coach Chrono) ---------- */
.featured {
  margin-bottom: 56px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 44px;
  align-items: center;
}
.featured-head { margin-bottom: 0; }
/* Reversed featured block: text left, image right (mirrors the default proportions). */
.featured-reverse { grid-template-columns: 1fr 1.5fr; }
.featured-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 10px;
  opacity: 0.55;
}
.featured-head h3 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); letter-spacing: -0.01em; }
.featured-head p { color: var(--muted); margin: 8px 0 0; font-size: 1.02rem; }
.featured-desc { font-size: 0.95rem; margin-top: 14px !important; }

/* Single, prominent featured card — width controlled by the .featured grid column. */
.gallery.gallery-featured { grid-template-columns: 1fr; }
.gallery.gallery-featured .card { border-color: rgba(245, 179, 1, 0.3); }
.gallery.gallery-featured .card img { aspect-ratio: 16 / 10; }

@media (max-width: 760px) {
  .featured, .featured-reverse { grid-template-columns: 1fr; gap: 24px; }
  /* When stacked, show the image first for both blocks. */
  .featured-reverse .featured-media { order: -1; }
}

/* ---------- Professional Experience header (two columns) ---------- */
.section-head.work-head { max-width: 1040px; }
.work-head-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; }
/* Natural left-aligned wrap with uniform spacing, vertically centered beside the paragraph. */
.work-head-grid .chips {
  margin-top: 0;
  align-self: center;
  justify-content: flex-start;
  align-content: flex-start;
}

/* ---------- Skill tags ---------- */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 28px 0 0; align-content: flex-start; }
.chips li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: rgba(232, 238, 245, 0.7);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Services ---------- */
.service-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
@media (max-width: 1000px) { .service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .service-grid { grid-template-columns: 1fr; } }
.service {
  padding: 26px 22px;
  background: var(--navy-700);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.3s var(--ease), border-color 0.3s;
}
.service:hover { transform: translateY(-5px); border-color: rgba(245,179,1,0.35); }
.service-num { font-family: "Space Grotesk", sans-serif; color: var(--gold); font-size: 0.95rem; font-weight: 600; margin-bottom: 16px; }
.service h3 { font-size: 1.2rem; margin-bottom: 10px; }
.service p { color: var(--muted); margin: 0; font-size: 0.95rem; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-inner { max-width: 680px; margin-inline: auto; }
.contact-lead { color: var(--muted); font-size: 1.1rem; margin: 14px 0 34px; }
.contact-email {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.4rem, 4vw, 2.3rem);
  color: var(--gold);
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s;
}
.contact-email:hover { border-color: var(--gold); }

.socials { display: flex; justify-content: center; gap: 14px; margin-top: 38px; }
.social {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.9rem;
  color: var(--muted);
  transition: all 0.2s;
}
.social:hover { color: var(--navy-900); background: var(--gold); border-color: var(--gold); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 0.88rem; }
.to-top:hover { color: var(--gold); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(4, 9, 16, 0.94);
  backdrop-filter: blur(6px);
  padding: 40px;
}
.lightbox.is-open { display: flex; }

.lb-figure { margin: 0; max-width: 92vw; max-height: 88vh; text-align: center; }
.lb-figure img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 8px; box-shadow: var(--shadow); }
.lb-figure figcaption { color: var(--ink); margin-top: 16px; font-family: "Space Grotesk", sans-serif; }

.lb-close, .lb-nav {
  position: fixed;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  border-radius: 50%;
  width: 52px; height: 52px;
  font-size: 1.8rem;
  line-height: 1;
  display: grid; place-items: center;
  transition: background 0.2s, transform 0.2s;
}
.lb-close:hover, .lb-nav:hover { background: var(--gold); color: var(--navy-900); }
.lb-close { top: 24px; right: 24px; }
.lb-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 24px; top: 50%; transform: translateY(-50%); }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%) scale(1.05); }

/* ---------- Reveal on scroll ---------- */
.card, .service { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .work-head-grid { grid-template-columns: 1fr; gap: 24px; }
  .work-head-grid .chips { margin-top: 4px; }
}

@media (max-width: 720px) {
  .section { padding: 72px 0; }
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 70px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--navy-800);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
  }
  .nav-links.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-links li { width: 100%; padding: 8px 0; }
  .nav-cta { display: inline-block; margin-top: 6px; }
  .gallery { grid-template-columns: 1fr; }
  .process { gap: 10px 12px; }
  .lb-nav { width: 44px; height: 44px; }
  .lb-prev { left: 10px; } .lb-next { right: 10px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .card img { opacity: 1 !important; transform: none !important; transition: none; }
  .btn:hover, .card:hover, .service:hover { transform: none; }
  .nav-cursor-tri { transition: none; }
  .hero-title .accent { animation: none !important; transform: none !important; }
}

/* Mobile-only: hide selected descriptive paragraphs to keep things compact */
@media (max-width: 720px) {
  .hero-para,
  .featured-desc { display: none; }

  /* Stack the top roles vertically and show "Data-driven creative" */
  .eyebrow .role { display: block; }
  .eyebrow .sep { display: none; }
  .eyebrow .role-mobile { display: block; }

  /* "Habhab." flush left and flush against the paragraph; titles list up to its right */
  .hero-head {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 14px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 80px;
  }
  .hero-head .hero-title { order: 0; margin: 0; line-height: 1; font-size: clamp(2.2rem, 9vw, 2.9rem); }
  .hero-head .hero-title .accent {
    margin-left: 0.16em;
    display: inline-block;
    animation: period-up-titles 3s ease-in-out infinite;
  }
  .hero-head .eyebrow { order: 1; margin: 0; font-size: 0.7rem; letter-spacing: 0.1em; }

  /* Tighten the gap between the hero buttons and the latest projects */
  .hero { padding-bottom: 24px; }
  .hero-actions { margin-bottom: 0; }
  .section.work { padding-top: 28px; }

  /* Remove the navbar cursor triangle on mobile */
  .nav-cursor-tri { display: none; }

  /* Replace the hero sub-line with the mobile block (paragraph + CTA line + contact button) */
  .hero-sub { display: none; }
  .hero-mobile { display: block; margin-bottom: 8px; }
  .hero-sub-mobile { font-size: clamp(1.05rem, 4.5vw, 1.3rem); color: var(--ink); max-width: 17em; margin: 0 auto 36px; }
  .hero-actions { justify-content: center; }
  .hero-cta-line { display: block; color: var(--muted); margin: 20px 0 0; text-align: center; }

  /* Hide the ROI-first / Data-driven creative stat under the hero buttons */
  .hero-stats { display: none; }
  /* Hide the second half of the Professional Experience paragraph */
  .exp-rest { display: none; }

  /* Hide the process strip (Brand -> ... -> Monitor) on mobile */
  .services-head .process { display: none; }

  /* Reorder portfolio projects on mobile:
     BLU, Modern Marketing, Sun-Maid, AMP, Source, then the rest */
  #gallery .card:nth-child(1)  { order: 1; }  /* BLU Label Management */
  #gallery .card:nth-child(2)  { order: 4; }  /* AMP 98.7 */
  #gallery .card:nth-child(3)  { order: 3; }  /* Sun-Maid */
  #gallery .card:nth-child(4)  { order: 2; }  /* Modern Marketing */
  #gallery .card:nth-child(5)  { order: 5; }  /* Source Magazine */
  #gallery .card:nth-child(6)  { order: 6; }  /* Excelcior */
  #gallery .card:nth-child(7)  { order: 7; }  /* Prescott */
  #gallery .card:nth-child(8)  { order: 8; }  /* Uniting Generation Y */
  #gallery .card:nth-child(9)  { order: 9; }  /* CUSP Events */
  #gallery .card:nth-child(10) { order: 10; } /* Atlas */
  #gallery .card:nth-child(11) { order: 11; } /* H&M DressWell */

  /* Stacked accordion for the five service cards */
  .service-grid { grid-template-columns: 1fr; }
  .service { position: relative; cursor: pointer; }
  .service h3 { padding-right: 24px; }
  .service p { display: none; }
  .service.is-open p { display: block; }
  .service::after {
    content: "+";
    position: absolute;
    top: 24px;
    right: 22px;
    color: var(--gold);
    font-size: 1.3rem;
    line-height: 1;
  }
  .service.is-open::after { content: "\2212"; }
}
