/* morley.cloud: single stylesheet for all root pages.
   Sections: tokens, base, layout, nav, hero, terminal, stats, sections,
   cards, timeline, modules, certs, faq, contact, prose, steps, video, footer, utilities */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-var.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-var.woff2") format("woff2");
}

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #111821;
  --panel-2: #0a0e13;
  --line: #1e2a38;
  --text: #d6e2ee;
  --mute: #8a9ab0;
  --green: #4ade80;
  --amber: #fbbf24;
  --cyan: #38bdf8;
  --purple: #a78bfa;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }
code { font-family: var(--mono); }
.mono { font-family: var(--mono); }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--green); color: #04210f; padding: 10px 16px; border-radius: 6px; font-weight: 600;
}
.skip:focus { top: 12px; text-decoration: none; }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }
section { padding: 72px 0; border-top: 1px solid var(--line); }
section.first { border-top: 0; }

/* ---------- nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 15, 20, .9);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-nav .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 60px; gap: 8px 24px; flex-wrap: wrap; }
.brand { font-family: var(--mono); font-weight: 700; color: var(--text); }
.brand b { color: var(--green); }
.brand:hover { text-decoration: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 24px; list-style: none; padding: 0; font-size: 14px; }
.site-nav ul a { color: var(--mute); padding: 6px 0; display: inline-block; }
.site-nav ul a:hover,
.site-nav ul a[aria-current="page"] { color: var(--text); text-decoration: none; }

/* ---------- buttons ---------- */
.btns { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 6px;
  font-size: 14px; font-weight: 600; border: 1px solid var(--line); color: var(--text);
}
.btn:hover { text-decoration: none; border-color: var(--green); }
.btn.pri { background: var(--green); color: #04210f; border-color: var(--green); }
.btn.pri:hover { filter: brightness(1.08); }

/* ---------- hero ---------- */
.hero { padding: 84px 0 64px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.eyebrow { font-family: var(--mono); color: var(--green); font-size: 13px; margin-bottom: 18px; }
h1 { font-size: clamp(32px, 4.8vw, 54px); line-height: 1.1; letter-spacing: -.02em; font-weight: 650; }
h1 em { font-style: normal; color: var(--green); }
.lede { color: var(--mute); margin: 22px 0 30px; max-width: 540px; font-size: 18px; }

/* ---------- terminal ---------- */
.term { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.term-bar { display: flex; gap: 7px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--mute); font: 12px var(--mono); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: #2a3645; }
.term-title { margin-left: 8px; }
.term pre { padding: 18px; font: 13px/1.7 var(--mono); overflow-x: auto; white-space: pre; }
.g { color: var(--green); }
.a { color: var(--amber); }
.c { color: var(--cyan); }
.m { color: var(--mute); }
.p { color: var(--purple); }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--green); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 72px; list-style: none; padding: 0; }
.stats li { padding: 22px; border-right: 1px solid var(--line); }
.stats li:last-child { border-right: 0; }
.stats b { display: block; font: 700 30px var(--mono); color: var(--green); }
.stats span { font-size: 13px; color: var(--mute); }

/* ---------- section headings ---------- */
.sh { font: 14px var(--mono); color: var(--green); margin-bottom: 8px; }
h2 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.2; letter-spacing: -.01em; margin-bottom: 14px; font-weight: 650; }
h3 { font-size: 18px; line-height: 1.3; margin-bottom: 8px; font-weight: 600; }
.sub { color: var(--mute); max-width: 680px; margin-bottom: 36px; }
.sub:last-child { margin-bottom: 0; }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1fr 190px; gap: 48px; align-items: start; }
.about p { color: var(--mute); margin-bottom: 16px; max-width: 680px; }
.about p strong { color: var(--text); font-weight: 600; }
.portrait { width: 190px; height: 190px; border-radius: 50%; object-fit: cover; object-position: 50% 28%; border: 2px solid var(--line); }
.certs { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; margin-top: 32px; padding: 0; list-style: none; }
.certs img { height: 92px; width: auto; transition: transform .2s; }
.certs a:hover img { transform: translateY(-3px); }
.certs .small img { height: 48px; opacity: .85; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; list-style: none; padding: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; transition: border-color .2s, transform .2s; }
.card:hover { border-color: var(--green); transform: translateY(-2px); }
.card .tag { font: 12px var(--mono); color: var(--cyan); margin-bottom: 10px; display: block; }
.card p { color: var(--mute); font-size: 15px; }

/* ---------- timeline ---------- */
.tl { border-left: 1px solid var(--line); margin-left: 6px; list-style: none; padding: 0; }
.tl li { position: relative; padding: 0 0 28px 28px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: -5px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.tl .when { font: 12px var(--mono); color: var(--mute); display: block; }
.tl h3 { margin-bottom: 2px; }
.tl p { color: var(--mute); font-size: 15px; }

/* ---------- modules ---------- */
.mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; list-style: none; padding: 0; }
.mod { display: flex; flex-direction: column; }
.mod p { flex: 1; }
.mod code.src { display: block; margin-top: 16px; background: var(--panel-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 6px; font-size: 12px; color: var(--amber); overflow-x: auto; white-space: normal; overflow-wrap: anywhere; }
.mod .links { margin-top: 14px; display: flex; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.more { margin-top: 28px; }

/* ---------- faq ---------- */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.faq summary { cursor: pointer; padding: 16px 20px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--green); }
.faq details[open] summary::after { content: "-"; }
.faq details p { padding: 0 20px 18px; color: var(--mute); }

/* ---------- contact ---------- */
.contact { text-align: center; }
.contact .sub { margin-left: auto; margin-right: auto; }
.contact .term { max-width: 560px; margin: 30px auto 0; text-align: left; }

/* ---------- prose (privacy, services, modules intro) ---------- */
.page-head { padding: 64px 0 8px; }
.crumbs { font: 13px var(--mono); color: var(--mute); margin-bottom: 18px; }
.crumbs a { color: var(--mute); }
.crumbs a:hover { color: var(--text); }
.prose { padding: 32px 0 80px; }
.prose p, .prose li { color: var(--mute); }
.prose p { margin-bottom: 16px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose h2 { margin-top: 40px; font-size: 24px; }
.prose ul, .prose ol { padding-left: 22px; margin-bottom: 16px; }
.prose li { margin-bottom: 6px; }

section .prose { padding: 0; }
.prose .sh { color: var(--green); margin-bottom: 8px; }
.prose .sh + h2 { margin-top: 0; }
.prose h3 { margin-top: 24px; }
.prose code { color: var(--amber); font-size: .9em; }
.prose .term { margin: 20px 0; }
.prose .term pre { color: var(--text); }

/* ---------- steps ---------- */
.prose .steps, .steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 14px; margin-bottom: 24px; }
.steps li { counter-increment: step; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 18px 62px; color: var(--mute); }
.steps li::before { content: counter(step); position: absolute; left: 20px; top: 16px; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #04210f; font: 700 13px/26px var(--mono); text-align: center; }

/* ---------- video grid ---------- */
.videos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; list-style: none; padding: 0; }
.videos iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: var(--panel); }

/* ---------- 404 ---------- */
.notfound { padding: 110px 0; text-align: center; }
.notfound .lede { margin-left: auto; margin-right: auto; }
.notfound .btns { justify-content: center; }
.notfound .term { max-width: 520px; margin: 32px auto; text-align: left; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--mute); font-size: 13px; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.site-footer ul { display: flex; gap: 20px; flex-wrap: wrap; list-style: none; padding: 0; }
.site-footer a { color: var(--mute); }
.site-footer a:hover { color: var(--text); }
.badge { height: 56px; width: auto; opacity: .85; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; gap: 36px; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  .about .portrait { order: -1; width: 128px; height: 128px; }
  .grid, .mods, .videos { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li:nth-child(2) { border-right: 0; }
  .stats li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  section { padding: 56px 0; }
}

@media (max-width: 480px) {
  .wrap, .wrap-narrow { padding: 0 18px; }
  .site-nav ul { gap: 2px 16px; font-size: 13px; }
  .term pre { font-size: 12px; padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .card, .certs img { transition: none; }
}
