/* CodingAssistMY website
   Colours follow the logo: deep navy, lighter navy, cool white and an ice-blue accent. */

:root {
  --navy: #14284B;
  --navy-2: #1D3660;
  --navy-line: #2E4A75;
  --navy-ghost: #3F5A85;
  --bg: #F3F6FA;
  --soft: #E4EBF4;
  --line: #D5DDE8;
  --white: #FFFFFF;
  --accent: #A9CBF7;
  --text: #14284B;
  --muted: #46576E;
  --label: #2A5599;
  --on-dark: #F3F6FA;
  --on-dark-muted: #C5D3E6;
  --on-dark-dim: #93A8C4;
  --string: #F2B880;

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base ---------- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { font-family: var(--font-display); margin: 0; }

p { margin: 0; }

a { color: inherit; }

:focus-visible { outline: 3px solid var(--label); outline-offset: 3px; border-radius: 6px; }
.hero :focus-visible, .footer :focus-visible, .card--dark :focus-visible { outline-color: var(--accent); }

.container { max-width: 1200px; margin: 0 auto; padding-inline: 24px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  background: var(--accent); color: var(--navy); font-weight: 700;
  padding: 12px 16px; border-radius: 10px; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 14px 28px; border-radius: 999px;
  font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap;
  transition: translate .2s ease, opacity .2s ease, background-color .2s ease;
}
.btn:hover { translate: 0 -2px; }
.btn--accent { background: var(--accent); color: var(--navy); }
.btn--ghost { border: 1px solid var(--navy-ghost); color: var(--on-dark); font-weight: 500; }
.btn--ghost:hover { background: rgba(255, 255, 255, .06); }
.btn--dark { background: var(--navy); color: var(--on-dark); }
.btn--small { min-height: 44px; padding: 10px 20px; font-size: 15px; }
.btn--large { padding: 18px 34px; font-size: 18px; }

/* ---------- Header and hero ---------- */

.hero { background: var(--navy); color: var(--on-dark); }

.nav {
  position: relative; z-index: 20; /* keeps the mobile menu above the animated hero content */
  display: flex; align-items: center; justify-content: space-between; gap: 16px 32px;
  padding: 24px 0;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  text-decoration: none; color: var(--on-dark);
}
.brand__logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px; background: #FFFFFF; overflow: hidden;
}
.brand__logo img { width: 40px; height: auto; }

.nav__menu { display: flex; align-items: center; gap: 8px 28px; font-size: 15px; }
.nav__menu a:not(.btn) { color: var(--on-dark-muted); text-decoration: none; padding: 12px 0; }
.nav__menu a:not(.btn):hover { color: var(--on-dark); }

.nav__toggle {
  display: none;
  width: 48px; height: 48px; border-radius: 12px;
  border: 1px solid var(--navy-ghost); background: transparent; color: var(--on-dark);
  align-items: center; justify-content: center; cursor: pointer;
}

.hero__body {
  display: flex; flex-wrap: wrap; align-items: center; gap: 48px;
  padding: 56px 0 96px;
}
.hero__copy { flex: 1 1 460px; min-width: 0; }
.hero__visual { flex: 1 1 380px; min-width: 0; }

.eyebrow {
  margin-bottom: 20px;
  font-family: var(--font-mono); font-size: 14px; letter-spacing: .02em; color: var(--accent);
}

.hero h1 {
  font-size: clamp(38px, 5.4vw, 66px); line-height: 1.04; letter-spacing: -.02em;
}
.accent { color: var(--accent); }

.hero__lead { margin-top: 24px; max-width: 540px; font-size: 19px; color: var(--on-dark-muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero__note { margin-top: 20px; font-size: 14px; color: var(--on-dark-dim); }

/* Code window */
.code-window {
  background: var(--navy-2); border: 1px solid var(--navy-line); border-radius: 16px;
  overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.code-window__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid var(--navy-line);
}
.code-window__bar > span:not(.code-window__file) { width: 11px; height: 11px; border-radius: 50%; background: var(--navy-ghost); }
.code-window__file { margin-left: 10px; font-family: var(--font-mono); font-size: 13px; color: var(--on-dark-dim); }
.code-window__body {
  min-height: 236px; padding: 24px 22px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 14px; line-height: 1.75; color: var(--on-dark-muted);
}
.c-comment { color: var(--on-dark-dim); }
.c-key { color: var(--accent); }
.c-str { color: var(--string); }

/* Tech strip */
.tech { background: var(--navy-2); color: var(--on-dark-muted); }
.tech__row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 40px;
  padding-block: 22px; font-family: var(--font-mono); font-size: 15px;
}
.tech__label { color: var(--on-dark-dim); }

/* ---------- Sections ---------- */

.section { padding-top: 96px; padding-bottom: 24px; }
.section--tight { padding-top: 72px; }

.label { margin-bottom: 12px; font-family: var(--font-mono); font-size: 14px; color: var(--label); }

.section h2 {
  max-width: 720px;
  font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -.015em;
}

.grid { display: grid; gap: 20px; margin-top: 48px; }
.grid--services { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid--services { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid--services { grid-template-columns: minmax(0, 1fr); } }
.grid--two { grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); margin-top: 0; }
.grid--three { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

.footnote { margin-top: 24px; font-size: 14px; color: var(--muted); }

/* Hover lift. Uses `translate` so it never clashes with the reveal animation, which uses `transform`. */
.card, .step, .plan { transition: translate .3s var(--ease), box-shadow .3s ease; }
.card:hover, .step:hover, .plan:hover { translate: 0 -6px; box-shadow: 0 16px 36px rgba(20, 40, 75, .14); }

/* Service cards */
.card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 28px; border-radius: var(--radius);
  background: var(--white); border: 1px solid var(--line);
}
.card h3 { font-size: 24px; }
.card p { color: var(--muted); }
.card .card__price { margin-top: auto; padding-top: 8px; font-family: var(--font-mono); font-size: 14px; color: var(--navy); }
.card__icon { color: var(--navy); }
.card--dark { background: var(--navy); border-color: var(--navy); color: var(--on-dark); }
.card--dark p { color: var(--on-dark-muted); }
.card--dark .card__icon, .card--dark .card__price { color: var(--accent); }

/* Audience */
.audience { border-top: 3px solid var(--navy); padding-top: 24px; }
.audience h3 { margin-bottom: 12px; font-size: 28px; }
.audience p { font-size: 17px; line-height: 1.6; color: var(--muted); }

/* Steps */
.steps { list-style: none; padding: 0; }
.step { padding: 28px; border-radius: var(--radius); background: var(--soft); }
.step__num { display: block; margin-bottom: 16px; font-family: var(--font-mono); font-size: 32px; color: var(--navy); }
.step h3 { margin-bottom: 8px; font-size: 22px; }
.step p { color: var(--muted); }
.step a { color: var(--label); }

/* Projects */
.project__media {
  height: 260px; border-radius: var(--radius); background: var(--soft); overflow: hidden;
}
.project__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: scale .6s var(--ease);
}
.project:hover .project__media img { scale: 1.04; }
.project__media--phones {
  display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px;
}
.project__media--phones img {
  width: auto; max-width: 48%; height: 100%; object-fit: contain;
  border-radius: 10px; box-shadow: 0 6px 18px rgba(20, 40, 75, .18);
}
.project h3 { margin: 16px 0 6px; font-size: 22px; }
.project p { color: var(--muted); }

/* Pricing */
.plan {
  display: flex; flex-direction: column; gap: 12px;
  padding: 32px; border-radius: var(--radius);
  background: var(--white); border: 1px solid var(--line);
}
.plan h3 { font-size: 22px; }
.plan p { color: var(--muted); }
.plan .plan__price { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1.2; color: var(--navy); }
.plan__unit { font-family: var(--font-body); font-size: 16px; font-weight: 500; color: var(--muted); }
.plan--featured { background: var(--navy); border-color: var(--navy); color: var(--on-dark); }
.plan--featured p { color: var(--on-dark-muted); }
.plan--featured .plan__price { color: var(--accent); }

/* Contact */
#contact { padding-bottom: 96px; }
.cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px;
  padding: clamp(32px, 6vw, 72px); border-radius: 28px;
  background: var(--accent); color: var(--navy);
}
.cta__text { flex: 1 1 380px; min-width: 0; }
.cta h2 { font-size: clamp(30px, 4.4vw, 52px); line-height: 1.06; letter-spacing: -.02em; }
.cta p { margin-top: 16px; max-width: 520px; font-size: 18px; line-height: 1.5; }

/* Footer */
.footer { background: var(--navy); color: var(--on-dark-muted); }
.footer__row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px;
  padding-block: 40px; font-size: 14px; line-height: 1.6;
}
.footer__brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--on-dark); margin-bottom: 4px; }

/* ---------- Animations ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes type { from { width: 0; } to { width: calc(var(--n, 20) * (1ch + var(--ls, 0em))); } }
@keyframes caret { 0%, 49% { border-right-color: currentColor; } 50%, 100% { border-right-color: transparent; } }

/* Page load: nav fades in, hero copy rises in sequence, code window follows */
.nav { animation: fade .8s ease both; }
.hero__copy > * { animation: rise .8s var(--ease) both; }
.hero__copy > :nth-child(1) { animation-delay: .10s; }
.hero__copy > :nth-child(2) { animation-delay: .25s; }
.hero__copy > :nth-child(3) { animation-delay: .40s; }
.hero__copy > :nth-child(4) { animation-delay: .55s; }
.hero__copy > :nth-child(5) { animation-delay: .70s; }
.hero__visual { animation: rise 1s var(--ease) .4s both; }

/* Typing: the eyebrow line, then the code window line by line */
.typed {
  display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom;
  width: 0; --n: 37; --ls: .02em;
  border-right: 2px solid currentColor;
  animation: type 1.4s steps(37, end) .6s forwards, caret .7s step-end .6s 6 forwards;
}
.code-line { white-space: pre; overflow: hidden; width: 0; animation: type .7s steps(var(--n), end) forwards; }
.code-line:nth-child(1) { --n: 41; animation-delay: .9s; }
.code-line:nth-child(2) { --n: 22; animation-delay: 1.8s; }
.code-line:nth-child(3) { --n: 23; animation-delay: 2.4s; }
.code-line:nth-child(4) { --n: 8;  animation-delay: 3.0s; }
.code-line:nth-child(5) { --n: 21; animation-delay: 3.3s; }
.code-line:nth-child(6) { --n: 20; animation-delay: 3.8s; }
.code-line:nth-child(7) { --n: 5;  animation-delay: 4.3s; }

/* Scroll reveal. Only hidden when JavaScript runs (html.js), so the page still shows without it. */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s var(--ease), transform .7s var(--ease), translate .3s var(--ease), box-shadow .3s ease;
  transition-delay: var(--d, 0s), var(--d, 0s), 0s, 0s;
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .nav__toggle { display: inline-flex; }
  .nav__menu {
    display: none;
    position: absolute; top: 84px; right: 0; left: 0; z-index: 5;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 12px; border-radius: 16px;
    background: var(--navy-2); border: 1px solid var(--navy-line);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .3);
  }
  .nav__menu.is-open { display: flex; }
  .nav__menu a:not(.btn) { padding: 12px 14px; border-radius: 10px; font-size: 16px; }
  .nav__menu a:not(.btn):hover { background: rgba(255, 255, 255, .06); }
  .nav__menu .btn { margin-top: 6px; }
}

@media (max-width: 600px) {
  .container { padding-inline: 16px; }
  .hero__body { padding: 32px 0 64px; gap: 40px; }
  .hero__lead { font-size: 17px; }
  .btn { white-space: normal; }
  .hero__actions .btn { flex: 1 1 100%; }
  .code-window__body { padding: 20px 16px; font-size: 12.5px; min-height: 212px; }
  .section { padding-top: 72px; }
  .section--tight { padding-top: 56px; }
  .grid { margin-top: 32px; }
  .project__media { height: 220px; }
  .cta .btn { width: 100%; }
  #contact { padding-bottom: 72px; }
}

/* Respect reduced-motion settings */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .typed, .code-line { width: auto !important; border-right-color: transparent; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
