/* ============================================================
   MIMIR — Data & AI Consultancy
   Brand: IBM Plex Superfamily · Ink ground · Volt/Cyan/Rust
   ============================================================ */

:root {
  /* Brand palette */
  --volt: #C7F000;   /* hero / signal */
  --cyan: #25D0DE;   /* secondary */
  --rust: #C24A1D;   /* accent */
  --graphite: #2A2E33; /* surface */
  --ink: #17191C;    /* ground */
  --bone: #EDE9DD;   /* text / neg */

  /* Derived */
  --ink-2: #1d2024;
  --graphite-2: #23272c;
  --cyan-deep: #0B6A73; /* cyan family, dark enough to read on bone */
  --line: rgba(237, 233, 221, 0.12);
  --line-strong: rgba(237, 233, 221, 0.22);
  --muted: rgba(237, 233, 221, 0.62);
  --muted-2: rgba(237, 233, 221, 0.45);

  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 1120px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

h1, h2, h3 { font-family: var(--font-mono); font-weight: 600; letter-spacing: -0.01em; }

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

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--volt); color: var(--ink); padding: 10px 16px;
  font-family: var(--font-mono); font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(23, 25, 28, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand-lockup { height: 26px; width: auto; }

.nav { display: flex; align-items: center; }
.nav-menu {
  display: flex; align-items: center; gap: 28px;
  list-style: none; margin: 0; padding: 0;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
}
.nav-menu a { color: var(--muted); transition: color 0.2s var(--ease); }
.nav-menu a:hover { color: var(--bone); }
.nav-cta {
  color: var(--ink) !important; background: var(--volt);
  padding: 8px 16px; border-radius: var(--radius);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-cta:hover { background: #d6ff33; transform: translateY(-1px); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px; background: var(--bone);
  transition: transform 0.25s 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); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-mono); font-weight: 600; font-size: 15px;
  padding: 13px 24px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid transparent; transition: transform 0.2s var(--ease),
    background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.btn-primary { background: var(--volt); color: var(--ink); }
.btn-primary:hover { background: #d6ff33; transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--bone); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(64px, 12vw, 132px) 0 clamp(56px, 9vw, 104px); }
.hero-grid {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(120% 90% at 78% 8%, #000 0%, transparent 68%);
  -webkit-mask-image: radial-gradient(120% 90% at 78% 8%, #000 0%, transparent 68%);
  opacity: 0.7;
}
.hero::after {
  /* soft volt/cyan glow top-right */
  content: ""; position: absolute; z-index: 0;
  top: -160px; right: -120px; width: 620px; height: 620px;
  background: radial-gradient(circle at center,
    rgba(199,240,0,0.14), rgba(37,208,222,0.10) 40%, transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 900px; }

.eyebrow {
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.02em;
  color: var(--cyan); margin: 0 0 22px;
}
h1 {
  font-size: clamp(2.1rem, 5.4vw, 4rem); line-height: 1.06; margin: 0 0 26px;
}
.accent-volt { color: var(--volt); }
.accent-cyan { color: var(--cyan); }
.hero-lead {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--muted);
  max-width: 640px; margin: 0 0 34px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Sections ---------- */
.section { position: relative; overflow: hidden; padding: clamp(64px, 10vw, 112px) 0; border-top: 1px solid var(--line); }
.section-alt { background: var(--ink-2); }
.section > .wrap { position: relative; z-index: 1; }

/* Brand mark watermark — one per section, colour-keyed to its accents */
.section-mark {
  position: absolute; z-index: 0; pointer-events: none; user-select: none;
  top: clamp(40px, 6vw, 72px); right: -60px;
  width: clamp(280px, 32vw, 460px); height: auto;
  opacity: 0.05;
  mask-image: linear-gradient(200deg, #000 40%, transparent 85%);
  -webkit-mask-image: linear-gradient(200deg, #000 40%, transparent 85%);
}

.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 12px; }
.section-num {
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  color: var(--volt); padding: 3px 8px; border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.section-title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0; color: var(--bone); }
.section-intro { color: var(--muted); max-width: 620px; margin: 0 0 44px; font-size: 1.08rem; }

/* ---------- Light sections (bone ground, ink text, rust/cyan detail) ----------
   Most component colours resolve through the custom properties below, so
   redefining them here re-themes descendants without touching their rules. */
.section-light {
  --line: rgba(23, 25, 28, 0.14);
  --line-strong: rgba(23, 25, 28, 0.32);
  --muted: rgba(23, 25, 28, 0.68);
  --muted-2: rgba(23, 25, 28, 0.52);
  background: var(--bone);
  color: var(--ink);
}
.section-light .section-title,
.section-light .about-lead p,
.section-light .fact-v,
.section-light .principle h3,
.section-light .contact-lead { color: var(--ink); }
.section-light .section-num { color: var(--rust); }
.section-light .section-title::after { background: linear-gradient(90deg, var(--rust), rgba(194, 74, 29, 0.3)); }
.section-light .fact-k { color: var(--rust); }
.section-light .about-facts li { background: rgba(255, 255, 255, 0.55); }
.section-light .principle { background: rgba(255, 255, 255, 0.45); border-top-color: var(--rust); }
.section-light .req { color: var(--rust); }
.section-light .contact-form { background: rgba(255, 255, 255, 0.55); }
.section-light .field input,
.section-light .field textarea,
.section-light .field select {
  background-color: #fff; color: var(--ink); border-color: var(--line-strong);
}
.section-light .field input:focus,
.section-light .field textarea:focus,
.section-light .field select:focus { border-color: var(--rust); background-color: #fff; }
.section-light .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23C24A1D' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}
.section-light .btn-primary { background: var(--rust); color: var(--bone); }
.section-light .btn-primary:hover { background: #d5561f; }
.section-light .form-note.ok { color: var(--cyan-deep); }
.section-light a:focus-visible, .section-light button:focus-visible,
.section-light input:focus-visible, .section-light textarea:focus-visible,
.section-light select:focus-visible { outline-color: var(--rust); }
.section-light .section-mark { opacity: 0.06; }

/* ---------- About ---------- */
.about-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px;
  margin: 36px 0 8px; align-items: start;
}
.about-lead p { margin: 0 0 20px; color: var(--bone); }
.about-lead p:first-child { font-size: 1.14rem; }

.about-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.about-facts li {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px;
  background: var(--graphite-2);
}
.fact-k { font-family: var(--font-mono); font-size: 12.5px; color: var(--cyan); letter-spacing: 0.02em; }
.fact-v { font-family: var(--font-mono); font-size: 15px; color: var(--bone); }

.principles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 64px;
}
.principle {
  position: relative; overflow: hidden;
  padding: 26px 24px; border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 2px solid var(--volt); background: rgba(42,46,51,0.35);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.principle::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--rust), rgba(194, 74, 29, 0.25));
  transform: scaleY(0); transform-origin: top; transition: transform 0.3s var(--ease);
}
.principle:hover {
  transform: translateY(-4px);
  border-left-color: var(--line-strong);
  border-right-color: var(--line-strong);
  border-bottom-color: var(--line-strong);
}
.principle:hover::before { transform: scaleY(1); }
.principle h3 { margin: 0 0 10px; font-size: 1.12rem; color: var(--bone); }
.principle p { margin: 0; color: var(--muted); font-size: 0.98rem; }

/* ---------- Services ---------- */
/* Flagship featured card */
.service-featured {
  position: relative; margin-bottom: 24px; padding: 36px 36px 32px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(199,240,0,0.10), transparent 55%),
    var(--graphite);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  border-left: 3px solid var(--volt); overflow: hidden;
}
.featured-head { margin-bottom: 26px; }
.featured-badge {
  display: inline-block; font-family: var(--font-mono); font-weight: 600;
  font-size: 12.5px; letter-spacing: 0.04em; color: var(--ink);
  background: var(--volt); padding: 5px 12px; border-radius: var(--radius); margin-bottom: 16px;
}
.featured-head h3 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); color: var(--bone); }
.featured-body { display: grid; grid-template-columns: 1.35fr 1fr; gap: 44px; align-items: start; }
.featured-copy p { margin: 0 0 18px; color: var(--muted); }
.featured-copy p:last-child { margin-bottom: 0; }
.featured-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 2px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.featured-list li {
  display: flex; flex-direction: column; gap: 5px; padding: 15px 18px;
  background: rgba(23,25,28,0.5); font-family: var(--font-mono);
  font-size: 13.5px; color: var(--bone); line-height: 1.45;
}
.fl-k { color: var(--cyan); font-size: 12px; letter-spacing: 0.02em; }
.featured-cta { margin-top: 30px; }

.services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.service-card {
  position: relative; padding: 32px 28px; background: var(--graphite);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
  overflow: hidden;
}
.service-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--cyan), var(--volt));
  transform: scaleY(0); transform-origin: top; transition: transform 0.3s var(--ease);
}
.service-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.service-card:hover::before { transform: scaleY(1); }
.service-card h3 { margin: 0 0 12px; font-size: 1.28rem; color: var(--bone); }
.service-card > p { margin: 0 0 20px; color: var(--muted); font-size: 0.98rem; }
.service-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.service-list li {
  font-family: var(--font-mono); font-size: 13.5px; color: var(--bone);
  padding-left: 20px; position: relative;
}
.service-list li::before {
  content: "//"; position: absolute; left: 0; color: var(--cyan); font-weight: 600;
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 56px; align-items: start; }
.contact-lead { font-size: 1.14rem; color: var(--bone); margin: 0 0 30px; }
.contact-details { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.contact-details li { display: flex; flex-direction: column; gap: 5px; }
.contact-form {
  background: var(--graphite); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px 30px;
}
.botcheck { display: none; }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }
.field { margin-bottom: 18px; }
.field label {
  display: block; font-family: var(--font-mono); font-size: 13px;
  color: var(--muted); margin-bottom: 7px; letter-spacing: 0.02em;
}
.req { color: var(--rust); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; background: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--bone); font-family: var(--font-sans); font-size: 15px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--cyan); background-color: #14161a; outline: none;
}
.field input:user-invalid, .field textarea:user-invalid { border-color: var(--rust); }
.field select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2325D0DE' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.form-note { font-family: var(--font-mono); font-size: 13px; min-height: 0; margin: 0 0 8px; }
.form-note.error { color: var(--rust); }
.form-note.ok { color: var(--volt); }
.form-fineprint { font-size: 12.5px; color: var(--muted-2); margin: 14px 0 0; text-align: center; }
.fineprint-link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.fineprint-link:hover { color: var(--rust); }

/* ---------- Prose pages (privacy etc.) ---------- */
.prose { max-width: 720px; margin-top: 28px; }
.prose p.prose-lead { font-size: 1.14rem; color: var(--ink); }
.prose h3 { font-size: 1.12rem; margin: 36px 0 10px; color: var(--ink); }
.prose p { margin: 0 0 16px; color: var(--muted); }
.prose ul { margin: 0 0 16px; padding-left: 22px; color: var(--muted); }
.prose li { margin-bottom: 10px; }
.prose a { color: var(--rust); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--ink); }
.prose-updated { font-family: var(--font-mono); font-size: 13px; color: var(--muted-2); margin-top: 36px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 44px 0; background: var(--ink-2); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-mark { height: 34px; width: auto; }
.footer-name { font-family: var(--font-mono); font-weight: 600; font-size: 14px; margin: 0; letter-spacing: 0.04em; }
.footer-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-2); margin: 2px 0 0; }
.footer-nav { display: flex; gap: 22px; font-family: var(--font-mono); font-size: 13.5px; }
.footer-nav a { color: var(--muted); transition: color 0.2s var(--ease); }
.footer-nav a:hover { color: var(--volt); }
.footer-copy { font-family: var(--font-mono); font-size: 12px; color: var(--muted-2); margin: 0; width: 100%; text-align: center; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- Motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes grid-drift { to { background-position: 0 -44px, 44px 0; } }
@keyframes glow-pulse {
  from { opacity: 0.7; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.1); }
}

/* Reveal on scroll (animation-based so hover transitions stay untouched) */
.reveal { opacity: 0; }
.reveal.is-visible { animation: rise 0.65s var(--ease) both; animation-delay: var(--d, 0s); }
.reveal.settled { animation: none; opacity: 1; }

/* Stagger within grids */
.principles .principle:nth-child(2),
.services-grid .service-card:nth-child(2) { --d: 0.12s; }
.principles .principle:nth-child(3) { --d: 0.24s; }

/* Hero entrance */
.hero .eyebrow, .hero h1, .hero-lead, .hero-actions {
  animation: rise 0.7s var(--ease) backwards;
}
.hero .eyebrow  { animation-delay: 0.05s; }
.hero h1        { animation-delay: 0.18s; }
.hero-lead      { animation-delay: 0.32s; }
.hero-actions   { animation-delay: 0.46s; }

/* Terminal caret after the headline */
.caret {
  display: inline-block; width: 0.45em; height: 0.85em;
  margin-left: 0.14em; vertical-align: -0.04em;
  background: var(--volt);
  animation: blink 1.1s steps(2, start) infinite;
}

/* Ambient hero motion */
.hero-grid { animation: grid-drift 24s linear infinite; }
.hero::after { animation: glow-pulse 9s ease-in-out infinite alternate; }

/* Section title underline draws in */
.section-title { position: relative; padding-bottom: 14px; }
.section-title::after {
  content: ""; position: absolute; left: 2px; bottom: 0;
  width: 72px; height: 3px;
  background: linear-gradient(90deg, var(--volt), var(--cyan));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.7s var(--ease) 0.25s;
}
.section-head.is-visible .section-title::after,
.section-head.settled .section-title::after { transform: scaleX(1); }

/* Nav link underline */
.nav-menu a:not(.nav-cta) { position: relative; }
.nav-menu a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--volt);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav-menu a:not(.nav-cta):hover::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; }
  .reveal.is-visible { animation: none; }
  .hero .eyebrow, .hero h1, .hero-lead, .hero-actions,
  .hero-grid, .hero::after, .caret { animation: none; }
  .section-title::after { transform: scaleX(1); transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 36px; }
  .principles { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: 1fr; }
  .featured-body { grid-template-columns: 1fr; gap: 28px; }
  .service-featured { padding: 28px 24px; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  /* 16px minimum stops iOS Safari auto-zooming when a field gets focus */
  .field input, .field textarea, .field select { font-size: 16px; }
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute; top: 68px; right: 0; left: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--ink-2); border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  }
  .nav-menu.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-menu li { border-top: 1px solid var(--line); }
  .nav-menu a { display: block; padding: 15px 4px; }
  .nav-cta { text-align: center; margin-top: 12px; border-top: 0 !important; }
  .nav-menu li:has(.nav-cta) { border-top: 0; }
  .hero-actions .btn { flex: 1 1 auto; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
