/* ============================================================
   MR. Tech — style.css
   Software, built right.
   ------------------------------------------------------------
   Table of contents
   1.  Design tokens (custom properties)
   2.  Reset & base
   3.  Typography helpers
   4.  Layout primitives (container, section, grid)
   5.  Buttons
   6.  Navbar
   7.  Hero
   8.  Services
   9.  About
   10. Work / portfolio
   11. Contact
   12. Footer
   13. Utilities & motion
   14. Responsive breakpoints
   ============================================================ */

/* ----------------------------------------------------------
   1. DESIGN TOKENS
   ---------------------------------------------------------- */
:root {
  /* Brand palette — deep navy base + electric blue / teal accents */
  --navy-950: #070A14;
  --navy-900: #0A0E1A;
  --navy-850: #0E1424;
  --navy-800: #121A2E;
  --navy-700: #1B2540;
  --navy-600: #273253;

  --accent: #3D7BFF;          /* electric blue (primary) */
  --accent-hover: #5B92FF;
  --accent-2: #2DD4BF;        /* teal (secondary) */

  --text: #F4F6FB;            /* near-white */
  --text-muted: #9AA7C2;      /* muted slate */
  --text-dim: #6B7793;        /* dimmest */
  --border: #1F2A47;

  /* Typography */
  --font-head: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  /* Fluid type scale */
  --fs-hero: clamp(2.5rem, 1.4rem + 5.2vw, 5rem);
  --fs-h2: clamp(1.9rem, 1.3rem + 2.6vw, 3rem);
  --fs-h3: clamp(1.15rem, 1rem + 0.6vw, 1.35rem);
  --fs-lead: clamp(1.05rem, 1rem + 0.5vw, 1.3rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;

  /* Spacing scale */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4rem;
  --space-8: 6rem;

  /* Radius */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  /* Shadows & effects */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 16px 40px rgba(61, 123, 255, 0.28);
  --ring: 0 0 0 3px rgba(61, 123, 255, 0.45);

  /* Layout */
  --maxw: 1180px;
  --nav-h: 72px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ----------------------------------------------------------
   2. RESET & BASE
   ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  scroll-behavior: smooth;           /* anchor smooth-scroll fallback */
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--navy-900);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

ul { list-style: none; padding: 0; }

button,
input,
textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------
   3. TYPOGRAPHY
   ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.eyebrow {
  font-family: var(--font-head);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--accent-2);
  display: inline-block;
}

.accent { color: var(--accent); }
.accent-2 { color: var(--accent-2); }
.muted { color: var(--text-muted); }

/* ----------------------------------------------------------
   4. LAYOUT PRIMITIVES
   ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  padding-block: clamp(var(--space-7), 9vw, var(--space-8));
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-6);
}
.section-head h2 {
  font-size: var(--fs-h2);
  margin-top: var(--space-3);
}
.section-head p {
  color: var(--text-muted);
  font-size: var(--fs-lead);
  margin-top: var(--space-3);
}

.grid { display: grid; gap: var(--space-4); }

/* ----------------------------------------------------------
   5. BUTTONS
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.975rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
              box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(61, 123, 255, 0.08);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--border);
  padding: 0.6rem 1.1rem;
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: rgba(61, 123, 255, 0.1);
}

.btn-block { width: 100%; }

/* ----------------------------------------------------------
   6. NAVBAR
   ---------------------------------------------------------- */
.navbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease),
              backdrop-filter 0.3s var(--ease);
}
/* solid state applied by JS once the page is scrolled */
.navbar.scrolled {
  background: rgba(10, 14, 26, 0.82);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.brand { display: inline-flex; align-items: center; }
.brand img { height: 30px; width: auto; }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.nav-menu a {
  font-size: 0.95rem;
  color: var(--text-muted);
  position: relative;
  padding-block: 0.25rem;
  transition: color 0.2s var(--ease);
}
.nav-menu a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.25s var(--ease);
}
.nav-menu a:hover,
.nav-menu a:focus-visible { color: var(--text); }
.nav-menu a:hover::after { width: 100%; }

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin-inline: auto;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ----------------------------------------------------------
   7. HERO
   ---------------------------------------------------------- */
.hero {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(3rem, 9vw, 7rem));
  padding-bottom: clamp(4rem, 9vw, 7rem);
  overflow: hidden;
  isolation: isolate;
}
/* layered background: grid texture + radial glows */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("../images/hero-bg.svg");
  background-size: 64px 64px;
  opacity: 0.6;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(closest-side circle at 78% 18%, rgba(45, 212, 191, 0.18), transparent),
    radial-gradient(closest-side circle at 18% 8%, rgba(61, 123, 255, 0.22), transparent);
}

.hero-content { max-width: 820px; }

.hero h1 {
  font-size: var(--fs-hero);
  margin-top: var(--space-4);
}
.hero p.lead {
  font-size: var(--fs-lead);
  color: var(--text-muted);
  max-width: 560px;
  margin-top: var(--space-4);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.trust {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
  color: var(--text-dim);
  font-size: var(--fs-small);
}
.trust .avatars { display: flex; }
.trust .avatars span {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid var(--navy-900);
  margin-left: -8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.trust .avatars span:first-child { margin-left: 0; }

/* ----------------------------------------------------------
   8. SERVICES
   ---------------------------------------------------------- */
.services-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background: linear-gradient(180deg, var(--navy-850), var(--navy-900));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
              box-shadow 0.3s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  border-color: rgba(61, 123, 255, 0.5);
  box-shadow: var(--shadow);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: rgba(61, 123, 255, 0.12);
  color: var(--accent);
  margin-bottom: var(--space-4);
}
.card:nth-child(even) .card-icon { background: rgba(45, 212, 191, 0.12); color: var(--accent-2); }
.card-icon svg { width: 26px; height: 26px; }

.card h3 { font-size: var(--fs-h3); margin-bottom: var(--space-2); }
.card p { color: var(--text-muted); font-size: 0.95rem; }

/* ----------------------------------------------------------
   9. ABOUT
   ---------------------------------------------------------- */
.about-grid {
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: center;
}
.about-copy p {
  color: var(--text-muted);
  font-size: var(--fs-lead);
  margin-top: var(--space-3);
}
.about-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.about-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: var(--text);
}
.about-list li svg { flex: none; margin-top: 4px; color: var(--accent-2); }

.stats {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.stat {
  background: var(--navy-850);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.stat .num {
  font-family: var(--font-head);
  font-size: clamp(2rem, 1.4rem + 2vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.stat .label { color: var(--text-muted); font-size: var(--fs-small); margin-top: var(--space-2); }

/* ----------------------------------------------------------
   10. WORK / PORTFOLIO
   ---------------------------------------------------------- */
.work-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.work-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--navy-850);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.work-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }

.work-thumb {
  aspect-ratio: 10 / 7;
  width: 100%;
  object-fit: cover;
}

/* hover/focus overlay with a View action */
.work-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(10, 14, 26, 0.4), rgba(10, 14, 26, 0.86));
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.work-card:hover .work-overlay,
.work-card:focus-within .work-overlay { opacity: 1; }
.work-overlay .view {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  transform: translateY(8px);
  transition: transform 0.3s var(--ease);
}
.work-card:hover .work-overlay .view,
.work-card:focus-within .work-overlay .view { transform: translateY(0); }

.work-body { padding: var(--space-4) var(--space-4) var(--space-5); }
.work-body h3 { font-size: var(--fs-h3); }
.work-body p { color: var(--text-muted); font-size: 0.92rem; margin-top: var(--space-2); }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--space-3); }
.tag {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.02);
}

/* ----------------------------------------------------------
   11. CONTACT
   ---------------------------------------------------------- */
.contact-grid {
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
.contact-panel {
  background: linear-gradient(180deg, var(--navy-850), var(--navy-900));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(var(--space-4), 4vw, var(--space-6));
}

.field { margin-bottom: var(--space-4); }
.field label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--text-muted);
}
.field input,
.field textarea {
  width: 100%;
  background: var(--navy-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: var(--text);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.field textarea { resize: vertical; min-height: 130px; }

.form-status {
  margin-top: var(--space-3);
  font-size: var(--fs-small);
  color: var(--accent-2);
  min-height: 1.2em;
}

.contact-info { display: flex; flex-direction: column; gap: var(--space-4); }
.info-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.info-item .ic {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: rgba(61, 123, 255, 0.12);
  color: var(--accent);
}
.info-item h4 { font-size: 1rem; }
.info-item a,
.info-item p { color: var(--text-muted); font-size: 0.95rem; }
.info-item a:hover { color: var(--accent); }

.socials { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.socials a {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ----------------------------------------------------------
   12. FOOTER
   ---------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--navy-950);
  padding-block: var(--space-6) var(--space-5);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.footer-brand { max-width: 300px; }
.footer-brand img { height: 28px; margin-bottom: var(--space-3); }
.footer-brand p { color: var(--text-dim); font-size: 0.9rem; }

.footer-cols { display: flex; flex-wrap: wrap; gap: var(--space-7); }
.footer-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: var(--space-3);
}
.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: 0.92rem;
  padding-block: 0.3rem;
  transition: color 0.2s var(--ease);
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-4);
  color: var(--text-dim);
  font-size: var(--fs-small);
}

/* ----------------------------------------------------------
   13. UTILITIES & MOTION
   ---------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* scroll-reveal: hidden start-state is opt-in via .anim-ready on <html>,
   which JS only adds once it confirms the animation clock is running. If
   transitions can't run (e.g. a paused/offscreen context), content stays
   fully visible instead of being stuck at opacity:0. JS adds .in-view. */
.anim-ready .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.anim-ready .reveal.in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ----------------------------------------------------------
   14. RESPONSIVE BREAKPOINTS
   ---------------------------------------------------------- */

/* Tablet and up */
@media (min-width: 720px) {
  .about-grid { grid-template-columns: 1.1fr 0.9fr; }
  .contact-grid { grid-template-columns: 1.1fr 0.9fr; }
  .stats { gap: var(--space-4); }
}

/* Desktop and up */
@media (min-width: 920px) {
  .work-grid,
  .services-grid { gap: var(--space-5); }
}

/* Mobile nav — collapse the menu into a slide-down panel */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(10, 14, 26, 0.97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-4) var(--space-5);
    /* hidden by default; toggled via .open */
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .nav-links.open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }
  .nav-menu a {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
    color: var(--text);
  }
  .nav-links .btn { margin-top: var(--space-3); }
}
