/* ==========================================================================
   Aejne Tech — site styles
   Mobile-first, system-font, light/dark aware via prefers-color-scheme.
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Palette — light */
  --bg: #f7f7f5;
  --bg-elev: #ffffff;
  --fg: #0e1116;
  --fg-muted: #5a6270;
  --line: #e3e4e1;
  --line-strong: #cfd1cc;
  --accent: #3d5afe;
  --accent-2: #00b8a9;
  --accent-ink: #ffffff;
  --grid: rgb(14 17 22 / 0.045);
  --glow: rgb(61 90 254 / 0.14);

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Layout */
  --max: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 14px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --bg-elev: #12151c;
    --fg: #eef0f4;
    --fg-muted: #9aa3b2;
    --line: #1f2430;
    --line-strong: #2c3342;
    --accent: #7c8cff;
    --accent-2: #2de0cf;
    --accent-ink: #0b0d12;
    --grid: rgb(238 240 244 / 0.05);
    --glow: rgb(124 140 255 / 0.18);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
  color: var(--bg);
}

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 1.05rem;
}

.brand:hover {
  color: inherit;
}

.brand svg {
  width: 28px;
  height: 28px;
}

.nav {
  display: flex;
  gap: clamp(0.9rem, 3vw, 1.75rem);
  font-size: 0.9375rem;
}

.nav a {
  color: var(--fg-muted);
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--fg);
}

/* Hide secondary nav items on very small screens */
@media (max-width: 380px) {
  .nav .nav-optional {
    display: none;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(4.5rem, 14vw, 9rem) clamp(3.5rem, 10vw, 6.5rem);
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}

/* Geometric grid backdrop */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 30%, transparent 75%);
}

/* Soft accent glow */
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 42rem;
  height: 42rem;
  right: -14rem;
  top: -16rem;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  pointer-events: none;
}

.hero-shapes {
  position: absolute;
  z-index: -1;
  right: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  top: 50%;
  translate: 0 -50%;
  width: clamp(10rem, 28vw, 22rem);
  height: auto;
  opacity: 0.9;
  pointer-events: none;
}

@media (max-width: 760px) {
  .hero-shapes {
    opacity: 0.22;
    right: -3rem;
    width: 16rem;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.eyebrow::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent-2);
  rotate: 45deg;
}

.hero h1 {
  font-size: clamp(2.5rem, 8.5vw, 5.25rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  max-width: 14ch;
  margin-bottom: 0.4em;
}

.hero h1 .accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-size: clamp(1.0625rem, 2.2vw, 1.3rem);
  color: var(--fg-muted);
  max-width: 38rem;
  margin-bottom: 2rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--fg-muted);
  color: inherit;
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.btn-primary:hover {
  color: var(--bg);
  border-color: var(--fg);
}

.btn svg {
  width: 1em;
  height: 1em;
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(4rem, 10vw, 7rem);
  border-bottom: 1px solid var(--line);
}

.section:last-of-type {
  border-bottom: 0;
}

.section-head {
  display: grid;
  gap: 0.5rem;
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.section h2 {
  font-size: clamp(1.85rem, 5vw, 2.85rem);
  margin: 0;
  max-width: 22ch;
}

.section-intro {
  color: var(--fg-muted);
  max-width: 40rem;
  margin: 0.4rem 0 0;
}

/* ---------- Principles ---------- */
.principles {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 720px) {
  .principles {
    grid-template-columns: repeat(3, 1fr);
  }
}

.principles li {
  background: var(--bg-elev);
  padding: 1.75rem 1.5rem;
}

.principles h3 {
  font-size: 1.125rem;
  margin-bottom: 0.4rem;
}

.principles p {
  color: var(--fg-muted);
  font-size: 0.975rem;
  margin: 0;
}

.principle-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 1.1rem;
  color: var(--accent);
}

/* ---------- Projects ---------- */
.cards {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 720px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-upcoming {
  border-style: dashed;
  border-color: var(--line-strong);
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0 14px,
      var(--grid) 14px 15px
    ),
    var(--bg-elev);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
}

.app-icon svg {
  width: 28px;
  height: 28px;
}

.app-icon-ghost {
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  color: var(--fg-muted);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--fg-muted);
  white-space: nowrap;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg);
}

.badge-live::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent);
}

.card h3 {
  font-size: 1.3rem;
  margin: 0.4rem 0 0;
}

.card p {
  color: var(--fg-muted);
  margin: 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.card-meta li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--fg) 5%, transparent);
}

/* ---------- Contact ---------- */
.contact-panel {
  position: relative;
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.75rem, 5vw, 3rem);
  border-radius: calc(var(--radius) + 4px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}

.contact-panel::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -6rem -10rem auto;
  width: 24rem;
  height: 24rem;
  background: radial-gradient(circle, var(--glow), transparent 65%);
}

@media (min-width: 820px) {
  .contact-panel {
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
  }
}

.contact-panel h2 {
  font-size: clamp(1.85rem, 5vw, 2.85rem);
  margin-bottom: 0.4rem;
}

.contact-panel p {
  color: var(--fg-muted);
  margin: 0;
}

.contact-email {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-email span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.contact-email a {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
  word-break: break-word;
  border-bottom: 2px solid var(--accent);
  align-self: flex-start;
  padding-bottom: 0.1rem;
}

/* ---------- Legal / prose ---------- */
.page-head {
  padding-block: clamp(3.5rem, 10vw, 6rem) clamp(2rem, 5vw, 3rem);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
}

.page-head h1 {
  font-size: clamp(2.25rem, 7vw, 3.75rem);
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}

.page-head p {
  color: var(--fg-muted);
  margin: 0;
}

.legal-layout {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(4rem, 10vw, 6rem);
}

@media (min-width: 960px) {
  .legal-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 4rem;
  }
}

.toc {
  font-size: 0.9rem;
}

@media (min-width: 960px) {
  .toc {
    position: sticky;
    top: 5.5rem;
    align-self: start;
  }
}

.toc p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.9rem;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 0.45rem;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  color: var(--fg-muted);
  text-decoration: none;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero) "  ";
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.6;
  white-space: pre;
}

.toc a:hover {
  color: var(--fg);
}

.prose {
  max-width: 44rem;
}

.prose section {
  scroll-margin-top: 5.5rem;
  padding-bottom: 1.5rem;
}

.prose section + section {
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}

.prose h2 {
  font-size: 1.45rem;
  margin-bottom: 0.75rem;
}

.prose h3 {
  font-size: 1.075rem;
  margin: 1.5rem 0 0.5rem;
}

.prose p,
.prose li {
  color: color-mix(in srgb, var(--fg) 82%, var(--bg));
}

.prose ul {
  padding-left: 1.2rem;
  margin: 0 0 1em;
}

.prose li {
  margin-bottom: 0.45rem;
}

.prose li::marker {
  color: var(--accent);
}

.prose a {
  color: var(--accent);
}

.callout {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  background: var(--bg-elev);
  margin: 0 0 1.5rem;
}

.callout p:last-child {
  margin: 0;
}

/* ---------- 404 ---------- */
.not-found {
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: clamp(5rem, 16vw, 10rem);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.not-found::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000 20%, transparent 70%);
}

.not-found .code {
  font-family: var(--font-mono);
  font-size: clamp(4.5rem, 22vw, 9rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  margin: 0 0 1rem;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.not-found h1 {
  font-size: clamp(1.6rem, 5vw, 2.25rem);
}

.not-found p {
  color: var(--fg-muted);
  max-width: 30rem;
  margin: 0 auto 2rem;
}

.not-found .actions {
  justify-content: center;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.site-footer a {
  color: var(--fg-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--fg);
}
