/* ==========================================================================
   MTech Engineering — base.css
   Reset, typography, layout primitives, buttons, forms and utilities.
   Depends on tokens.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.menu-open { overflow: hidden; }

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

img { height: auto; }

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button { background: none; border: 0; cursor: pointer; }

ul,
ol { margin: 0; padding: 0; list-style: none; }

figure,
blockquote,
dl,
dd { margin: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--sp-7) 0;
}

::selection {
  background: rgba(30, 136, 200, .18);
  color: var(--navy-900);
}

/* -------------------------------------------------------------- typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--navy-900);
  font-weight: 800;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--sp-4);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); font-weight: 800; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); font-weight: 700; letter-spacing: -0.01em; }

p {
  margin: 0 0 var(--sp-4);
  text-wrap: pretty;
}

p:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; color: var(--navy-900); }

small { font-size: var(--fs-xs); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* -------------------------------------------------------------- selection-ish links */
/* Inline links sitting inside a paragraph get a taller hit area without
   disturbing the line rhythm (padding pulled back with a negative margin). */
.link-inline {
  color: var(--blue-ink);
  font-weight: 500;
  padding-block: 7px;
  margin-block: -7px;
  text-decoration: underline;
  text-decoration-color: rgba(30, 136, 200, .35);
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}

.link-inline:hover {
  color: var(--navy-900);
  text-decoration-color: var(--navy-900);
}

/* --------------------------------------------------------------- focus ring */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}


/* --------------------------------------------------------------- skip link */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: calc(var(--z-float) + 10);
  background: var(--navy-900);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: var(--fs-sm);
  box-shadow: var(--sh-lg);
  transition: top var(--t-base) var(--ease);
}

.skip-link:focus {
  top: var(--sp-4);
  outline-color: var(--amber);
}

/* ============================== LAYOUT ==================================== */

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

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section-sm { padding-block: var(--section-y-sm); }

.section-alt { background: var(--surface-alt); }
.section-surface { background: var(--surface); }

/* Section head: eyebrow + heading + intro, centred or left */
.section-head { max-width: 760px; margin-bottom: var(--sp-8); }
.section-head.is-center { margin-inline: auto; text-align: center; }
.section-head.is-center .eyebrow { justify-content: center; }
.section-head p { font-size: var(--fs-lead); color: var(--muted); margin-top: var(--sp-4); }
.section-head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-6);
  max-width: none;
}

/* --------------------------------------------------------------- blueprints */
/* Layers inside a .grid-bg block:  section background → grid → decoration → content */
.grid-bg {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  pointer-events: none;
}

.grid-bg > .container {
  position: relative;
  z-index: 1;
}

/* Modifier: dissolve the grid towards the bottom instead of stopping on a hard
   line where the section ends. Without this rule the class is inert — which is
   what it was before, applied in markup but never defined. */
.grid-bg--fade::before {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 100%);
}

/* Decorative concentric rings — the profile-cover motif */
.deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.rings {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--grid-line-strong);
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: .9;
}

.orb--teal { background: var(--teal); }
.orb--blue { background: var(--blue); }
.orb--orange { background: var(--orange); }
.orb--amber { background: var(--amber); }

/* ============================== EYEBROW ================================== */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--orange-strong);
  margin-bottom: var(--sp-4);
  line-height: 1.4;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  flex: 0 0 28px;
  border-radius: 2px;
  background: currentColor;
}

.eyebrow--on-dark { color: var(--amber); }

/* ============================== BUTTONS ================================== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0.8rem 1.5rem;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease),
    background-color var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease),
    color var(--t-base) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

/* shine sweep */
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -140%;
  width: 60%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .42), transparent);
  transform: skewX(-18deg);
  transition: left var(--t-slow) var(--ease);
}

.btn:hover::after,
.btn:focus-visible::after { left: 150%; }

/* Buttons are content-width flex rows, so an icon with no explicit size would
   shrink or stretch to whatever space is left. Pin it to the label's cap height. */
.btn .btn-ico {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  transition: transform var(--t-base) var(--ease);
}

.btn-sm .btn-ico { width: 16px; height: 16px; }
.btn-lg .btn-ico { width: 19px; height: 19px; }

.btn:hover .btn-ico { transform: translateX(4px); }

.btn:hover { transform: translateY(-2px); }

/* Gradient starts at --blue-strong, not --blue: white on #1E88C8 is only 3.9:1,
   which fails AA for button-sized text. #17709F → #125C85 gives 5.5:1 → 7.2:1. */
.btn-primary {
  background: linear-gradient(135deg, var(--blue-strong), var(--blue-deep));
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(23, 112, 159, .58);
}

.btn-primary:hover { box-shadow: 0 16px 32px -12px rgba(30, 136, 200, .7); }

.btn-outline {
  background: var(--surface);
  color: var(--navy-900);
  border-color: var(--border-strong);
  box-shadow: var(--sh-xs);
}

.btn-outline:hover {
  border-color: var(--blue);
  color: var(--blue-strong);
  box-shadow: var(--sh-md);
}

.btn-ghost {
  background: transparent;
  color: var(--navy-900);
  border-color: var(--border-strong);
}

.btn-ghost:hover { background: var(--surface); border-color: var(--blue); }

.btn-on-dark {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .26);
  backdrop-filter: blur(6px);
}

.btn-on-dark:hover {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .5);
}

.btn-amber {
  background: linear-gradient(135deg, var(--amber), var(--orange));
  color: #40260A;
  box-shadow: 0 10px 24px -12px rgba(232, 113, 10, .7);
}

.btn-amber:hover { box-shadow: 0 16px 32px -14px rgba(232, 113, 10, .8); }

.btn-sm { min-height: 44px; padding: 0.6rem 1.15rem; font-size: var(--fs-xs); }
.btn-lg { min-height: 54px; padding: 0.95rem 1.9rem; font-size: var(--fs-body); }
.btn-block { width: 100%; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* -------------------------------------------------------------- text link */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent-ink, var(--blue-strong));
  transition: color var(--t-fast) var(--ease), gap var(--t-fast) var(--ease);
}

.arrow-link svg { transition: transform var(--t-base) var(--ease); }
.arrow-link:hover { color: var(--navy-900); }
.arrow-link:hover svg { transform: translateX(4px); }

/* ============================== SURFACES ================================= */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  transition:
    transform var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease);
}

a.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--sh-lg);
  border-color: var(--border-strong);
}

.panel-navy {
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 58%, var(--navy-700) 100%);
  color: var(--on-dark-soft);
  border-radius: var(--r-xl);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: var(--sh-lg);
  position: relative;
  overflow: hidden;
}

.panel-navy::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.panel-navy > * { position: relative; }

/* 4-colour brand bar (teal · blue · orange · amber) */
.brand-bar {
  display: flex;
  height: 4px;
  width: 100%;
}

.brand-bar span { flex: 1 1 25%; }
.brand-bar span:nth-child(1) { background: var(--teal); }
.brand-bar span:nth-child(2) { background: var(--blue); }
.brand-bar span:nth-child(3) { background: var(--orange); }
.brand-bar span:nth-child(4) { background: var(--amber); }

/* Accent-aware components pick up their palette from a wrapper.
     --accent      bright   → icon chips, bars, borders, display numerals
     --accent-soft tinted   → those chips' backgrounds
     --accent-ink  darkened → small coloured text (4.5:1 on every light surface)
   Any block that sets --accent sets --accent-ink alongside it. */

/* ============================== BADGES =================================== */

.tag-line {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink, var(--blue-ink));
  overflow-wrap: anywhere;
}

/* ============================== FORMS ==================================== */

.field { margin-bottom: var(--sp-5); }

.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 0.45rem;
}

.field .req { color: var(--red); margin-left: 2px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.75rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--navy-900);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  appearance: none;
}

.field textarea { min-height: 132px; resize: vertical; line-height: 1.6; }

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
  padding-right: 2.6rem;
}

.field input::placeholder,
.field textarea::placeholder { color: #94A3B8; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--sh-focus);
}

.field .hint {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 0.35rem;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--red); }

.field-error {
  display: none;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #B3121F;
  margin-top: 0.35rem;
}

.field.has-error .field-error { display: block; }

.form-status {
  display: none;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.9rem 1.05rem;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

.form-status.is-visible { display: flex; }

.form-status--ok {
  background: var(--teal-soft);
  border: 1px solid rgba(18, 168, 157, .4);
  color: #0A5F59;
}

.form-status--error {
  background: var(--red-soft);
  border: 1px solid rgba(209, 24, 43, .32);
  color: #8E0F1D;
}

.form-status svg { flex: 0 0 20px; margin-top: 2px; }

/* ============================== UTILITIES ================================ */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--muted); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }

.grid { display: grid; gap: var(--sp-5); }

/* Long tokens (codes, standards, emails) must never blow out a layout */
.break-anywhere { overflow-wrap: anywhere; word-break: break-word; }

/* Text gradient used for the hero highlight */
.grad-text {
  background: linear-gradient(100deg, var(--orange) 0%, var(--amber) 55%, var(--orange-strong) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ============================== MOTION ================================== */

/* Scroll reveal — toggled by main.js via IntersectionObserver.
   Only armed when the `js` class is present, so content is never hidden when
   JavaScript is unavailable (main.js removes the class it does not find). */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity var(--t-slow) var(--ease-out),
    transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
}
