/* ==========================================================
   Michael Tot, portfolio
   Palette comes from the LinkedIn banner: a warm dusk on the
   left (building worlds), cool signal blue on the right
   (defending systems). Edit the variables below to retheme.
   ========================================================== */

:root {
  --ink: #11153a;          /* page background */
  --ink-raised: #181d4d;   /* raised surfaces */
  --ink-deep: #0d1131;     /* terminal, footer */
  --violet: #3a2468;       /* dusk sky */
  --ember: #f2995a;        /* game systems, primary action */
  --rose: #d96a8c;        /* the blend between the two */
  --signal: #5cd6ea;       /* security and infrastructure */
  --text: #ece8f6;
  --muted: #aeabcc;
  --line: rgba(236, 232, 246, 0.14);

  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gutter: clamp(20px, 5vw, 48px);
  --max: 1120px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0 0 1em; max-width: 64ch; }
a { color: var(--signal); text-underline-offset: 0.2em; }
a:hover { color: #9ae8f4; }

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

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

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

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.wordmark:hover { color: #fff; }

.nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
.nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
.nav a:hover { color: var(--ember); }
.nav .nav-cta {
  border: 1px solid rgba(236, 232, 246, 0.45);
  padding: 7px 16px;
  border-radius: 999px;
}
.nav .nav-cta:hover { border-color: var(--ember); }

/* ---------- Scene (the banner) ---------- */

.scene {
  position: relative;
  height: clamp(360px, 40vw, 560px);
  overflow: hidden;
  background: linear-gradient(90deg, #52307f 0%, #2d2a6b 42%, #1a2a5e 58%, #12334f 100%);
}
.scene::before {
  /* sky: deeper at the top, warmer toward the horizon */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10, 12, 40, 0.65), rgba(10, 12, 40, 0) 55%);
}
.scene::after {
  /* melt the bottom edge into the page */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 38%;
  background: linear-gradient(to bottom, rgba(17, 21, 58, 0), var(--ink));
}

.scene-art {
  position: absolute;
  bottom: 0;
  height: 100%;
  width: 54%;
}
.scene-left {
  left: 0;
  -webkit-mask-image: linear-gradient(to right, #000 72%, transparent);
  mask-image: linear-gradient(to right, #000 72%, transparent);
}
.scene-right {
  right: 0;
  -webkit-mask-image: linear-gradient(to left, #000 72%, transparent);
  mask-image: linear-gradient(to left, #000 72%, transparent);
}

.lockup {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 20%;
  transform: translateX(-50%);
  width: min(92vw, 560px);
  text-align: center;
  text-shadow: 0 2px 18px rgba(10, 12, 40, 0.8);
}
.lockup p { max-width: none; margin: 0; }
.lockup-top,
.lockup-bottom {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: clamp(0.62rem, 1.1vw, 0.8rem);
  font-weight: 500;
  color: #f4effc;
}
.lockup-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin: 18px 0;
  color: #f4effc;
}
.lockup-divider { width: 1px; height: 46px; background: rgba(244, 239, 252, 0.5); }

/* ---------- Intro ---------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
  padding-block: 8px clamp(56px, 8vw, 104px);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 4.8vw, 4rem);
  line-height: 1.06;
  max-width: 16ch;
  margin-bottom: 0.55em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.12;
  margin-bottom: 0.7em;
  text-wrap: balance;
}

h3 { font-size: 1.3rem; line-height: 1.25; margin-bottom: 0.4em; }

.lede { font-size: 1.2rem; line-height: 1.55; color: #f4effc; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--ember); color: #1a1033; }
.btn-primary:hover { background: #f7ab72; color: #1a1033; }
.btn-ghost { border-color: rgba(236, 232, 246, 0.4); color: var(--text); }
.btn-ghost:hover { border-color: var(--signal); color: var(--signal); }

/* ---------- Terminal ---------- */

.terminal {
  background: var(--ink-deep);
  border: 1px solid rgba(92, 214, 234, 0.28);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}
.terminal-bar {
  display: flex;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(92, 214, 234, 0.16);
}
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: rgba(236, 232, 246, 0.2); }
.terminal-body {
  margin: 0;
  padding: 18px 20px 22px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}
.t-line { display: block; }
.t-prompt { color: var(--ember); }
.t-out .t-text { color: var(--signal); }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--text);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

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

.section { padding-block: clamp(56px, 8vw, 104px); }
.section + .section { border-top: 1px solid var(--line); }
.section-lede { color: var(--muted); max-width: 62ch; margin-bottom: 2em; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}
.list-title { font-size: 1.15rem; margin-bottom: 0.8em; color: #f4effc; }

/* Timeline: a real sequence, so the markers earn their place */
.timeline {
  list-style: none;
  margin: 2.2em 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--ember), var(--rose), var(--signal));
}
.timeline li { position: relative; padding-top: 34px; }
.timeline li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--ember);
}
.timeline li:nth-child(2)::before { border-color: #e8808a; }
.timeline li:nth-child(3)::before { border-color: #b78bd0; }
.timeline li:nth-child(4)::before { border-color: var(--signal); }
.timeline h3 { font-size: 1.5rem; }
.timeline p { color: var(--muted); font-size: 1rem; margin: 0; }

/* Capabilities: rows with dividers, not a card grid */
.caps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(32px, 6vw, 88px);
}
.cap { padding: 26px 0; border-top: 1px solid var(--line); }
.cap p { color: var(--muted); margin: 0; }

.stack { margin: 36px 0 0; display: grid; gap: 14px; }
.stack > div {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 8px 24px;
  align-items: baseline;
}
.stack dt { color: var(--muted); font-weight: 500; }
.stack dd { margin: 0; color: var(--text); }

/* Projects */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.project {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--ember);
  padding: 24px 26px 8px;
  border-radius: 2px 8px 8px 2px;
}
.project--defense { border-left-color: var(--signal); }
.project--featured {
  grid-column: 1 / -1;
  padding: 34px 36px 14px;
  background: linear-gradient(100deg, rgba(242, 153, 90, 0.12), rgba(255, 255, 255, 0.03) 55%);
}
.project--featured h3 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
.project--featured p:not(.status):not(.meta-line):not(.soon) { max-width: 60ch; font-size: 1.1rem; }
.project p { color: var(--muted); }
.project h3 { color: var(--text); }

.meta-line { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text) !important; margin-bottom: 0.4em; }
.soon { font-size: 0.92rem; font-style: italic; }

/* Security */
.phases { margin: 0; padding-left: 1.3em; }
.phases li { margin-bottom: 0.9em; color: var(--muted); padding-left: 0.3em; }
.phases li::marker { color: var(--signal); font-weight: 600; }
.phases strong { color: var(--text); font-weight: 600; }

.plain-list { margin: 0; padding: 0; list-style: none; }
.plain-list li {
  position: relative;
  padding: 0 0 1em 22px;
  color: var(--muted);
}
.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 10px;
  height: 2px;
  background: linear-gradient(90deg, var(--ember), var(--signal));
}

/* Contact */
.contact { padding-bottom: clamp(72px, 10vw, 128px); }
.contact h2 { font-size: clamp(2.2rem, 5vw, 3.8rem); max-width: 14ch; }
.phone { margin-top: 24px; color: var(--muted); }

/* Footer */
.site-footer {
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, var(--ember), var(--rose), var(--signal)) 1;
  background: var(--ink-deep);
  padding-block: 28px;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-inner p { margin: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .intro, .split { grid-template-columns: minmax(0, 1fr); }
  .timeline { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-left: 4px; }
  .timeline::before { top: 8px; bottom: 8px; left: 7px; right: auto; width: 2px; height: auto;
    background: linear-gradient(180deg, var(--ember), var(--rose), var(--signal)); }
  .timeline li { padding: 0 0 0 38px; }
  .timeline li::before { top: 4px; }
}

@media (max-width: 720px) {
  .nav a:not(.nav-cta) { display: none; }
  .caps, .projects { grid-template-columns: minmax(0, 1fr); }
  .project--featured { padding: 26px 24px 10px; }
  .stack > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .lockup { bottom: 16%; }
  .lockup-top, .lockup-bottom { letter-spacing: 0.2em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; }
  .btn { transition: none; }
}

/* ==========================================================
   Case study pages, statuses and media placeholders
   ========================================================== */

.site-header--solid {
  position: sticky;
  top: 0;
  background: rgba(17, 21, 58, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

/* Status tags */
.status { font-size: 0.85rem; font-weight: 600; margin: 0 0 0.6em; }
.project .status { margin-bottom: 0.6em; }
.status.status--live { color: var(--signal); }
.status.status--testing { color: var(--ember); }
.status.status--progress { color: var(--rose); }
.status.status--retired,
.status.status--earlier { color: var(--muted); }

/* Project cards link to their case studies */
.project h3 a { color: var(--text); text-decoration: none; }
.project h3 a::after { content: ""; position: absolute; inset: 0; }
.project h3 a:hover { color: #fff; }
.project { position: relative; transition: background-color 0.15s; }
.project:hover { background: rgba(255, 255, 255, 0.06); }
.project:focus-within { outline: 2px solid var(--signal); outline-offset: 3px; }
.project h3 a:focus-visible { outline: none; }
.subhead { font-size: 1.3rem; margin: 2.4em 0 1em; color: #f4effc; }

/* Case study layout */
.case { padding-block: clamp(32px, 6vw, 64px) clamp(56px, 8vw, 96px); max-width: calc(820px + var(--gutter) * 2); }
.crumb { font-size: 0.95rem; margin-bottom: 2em; }
.case h1 { max-width: 20ch; margin-bottom: 0.4em; font-size: clamp(2.2rem, 5vw, 3.4rem); }
.case .lede { max-width: 62ch; }
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 32px;
  margin: 2em 0 1em;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--muted); font-size: 0.9rem; }
.facts dd { margin: 2px 0 0; }
.case-section { padding-top: clamp(32px, 5vw, 56px); }
.case-section h2 { font-size: clamp(1.6rem, 2.8vw, 2.1rem); }
.case-section h3 { font-size: 1.2rem; margin-top: 1.6em; }
.case-section p { color: #dcd8ee; }
.case-list { margin: 0 0 1.2em; padding-left: 1.2em; max-width: 66ch; }
.case-list li { margin-bottom: 0.7em; color: #dcd8ee; padding-left: 0.2em; }
.case-list li::marker { color: var(--signal); }
.case--world .case-list li::marker { color: var(--ember); }
.case-list strong { color: var(--text); }

.case-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: clamp(48px, 7vw, 80px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.case-nav a { text-decoration: none; color: var(--text); font-family: var(--font-display); font-size: 1.15rem; line-height: 1.3; }
.case-nav a:hover { color: var(--signal); }
.case-nav span { display: block; font-family: var(--font-body); font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.case-nav-next { text-align: right; }

/* Media slots: placeholder until the file exists, then the real thing */
.slot, .excerpt, .diagram { margin: 28px 0 32px; }
.slot figcaption, .excerpt figcaption, .diagram figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 10px; }
.slot-frame {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(236, 232, 246, 0.24);
  display: flex;
}
.slot--image .slot-frame { aspect-ratio: auto; min-height: 220px; }
.slot.is-filled .slot-frame { border: 1px solid var(--line); background: #0b0e27; aspect-ratio: auto; min-height: 0; display: block; }
.slot-frame img, .slot-frame video { display: block; width: 100%; height: auto; }
.slot-placeholder {
  margin: auto;
  padding: 24px clamp(20px, 5vw, 48px);
  text-align: center;
  max-width: 54ch;
}
.slot-placeholder p { margin: 0 auto 0.5em; color: var(--muted); }
.slot-placeholder .slot-type { color: var(--text); font-weight: 600; font-size: 0.95rem; }
.case--world .slot-type { color: var(--ember); }
.case--defense .slot-type { color: var(--signal); }
.slot-placeholder .slot-desc { font-size: 0.98rem; }
.slot-file { display: none; font-family: var(--font-mono); font-size: 0.78rem; overflow-wrap: anywhere; }
.dev .slot-file { display: block; }

.excerpt-frame {
  border-radius: 8px;
  border: 1px dashed rgba(236, 232, 246, 0.24);
  background: rgba(255, 255, 255, 0.025);
  min-height: 160px;
  display: flex;
}
.excerpt.is-filled .excerpt-frame { display: block; border: 1px solid rgba(92, 214, 234, 0.22); background: var(--ink-deep); min-height: 0; }
.excerpt pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text);
  tab-size: 4;
}

/* Syntax colours for code excerpts (highlight.js classes), from the site palette */
.excerpt code { font-family: inherit; }
.hljs-comment, .hljs-quote { color: #8784ad; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: var(--ember); }
.hljs-string, .hljs-regexp, .hljs-char.escape_ { color: #f0b8c9; }
.hljs-number, .hljs-symbol { color: #ffcf9e; }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--signal); }
.hljs-title.class_, .hljs-type, .hljs-built_in { color: #9fe6f1; }
.hljs-meta, .hljs-attr, .hljs-attribute, .hljs-params { color: var(--rose); }
.hljs-variable, .hljs-template-variable, .hljs-property { color: var(--text); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* Inline diagrams */
.diagram-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.02); padding: 16px; }
.diagram svg { display: block; width: 100%; min-width: 560px; height: auto; }
.dg-box rect { fill: var(--ink-raised); stroke: rgba(236, 232, 246, 0.28); stroke-width: 1.2; }
.dg-world rect { stroke: var(--ember); }
.dg-defense rect { stroke: var(--signal); }
.dg-warn rect { stroke: var(--rose); stroke-dasharray: 5 4; }
.dg-box text { fill: var(--text); font-family: var(--font-body); font-size: 15px; text-anchor: middle; }
.dg-line path { fill: none; stroke: rgba(236, 232, 246, 0.5); stroke-width: 1.5; }
.dg-fail path { stroke: var(--rose); stroke-dasharray: 5 4; }
.dg-arrowhead { fill: rgba(236, 232, 246, 0.7); }
.dg-note { fill: var(--muted); font-family: var(--font-body); font-size: 14px; text-anchor: middle; font-style: italic; }

@media (max-width: 720px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .case-nav { grid-template-columns: minmax(0, 1fr); }
  .case-nav-next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .project { transition: none; }
}

/* YouTube slots */
.slot.is-youtube .slot-frame { aspect-ratio: 16 / 9; display: block; position: relative; }
.yt-facade { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; }
.yt-facade img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity 0.15s; }
.yt-facade:hover img, .yt-facade:focus-visible img { opacity: 1; }
.yt-play {
  position: absolute; left: 50%; top: 50%;
  width: 72px; height: 72px; margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: rgba(17, 21, 58, 0.85);
  border: 2px solid var(--ember);
}
.yt-play::after {
  content: ""; position: absolute; left: 29px; top: 22px;
  border-style: solid; border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent var(--ember);
}
.slot.is-youtube iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (prefers-reduced-motion: reduce) { .yt-facade img { transition: none; } }

/* Off-screen note for AI agents (see index.html). Hidden from sighted users and screen readers alike. */
.agent-note {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Contact form */
.contact .split { align-items: start; }
.contact-form {
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(20px, 3vw, 32px);
}
.contact-form label { font-weight: 500; font-size: 0.95rem; margin-top: 8px; }
.contact-form .optional { color: var(--muted); font-weight: 400; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--ink-deep);
  border: 1px solid rgba(236, 232, 246, 0.22);
  border-radius: 6px;
  padding: 10px 12px;
}
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form input:focus-visible, .contact-form textarea:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; border-color: transparent; }
.contact-form .btn { justify-self: start; margin-top: 12px; cursor: pointer; font-family: inherit; }
.contact-form .btn[disabled] { opacity: 0.6; cursor: wait; }
.sender { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.sender legend { font-weight: 500; font-size: 0.95rem; margin-bottom: 6px; padding: 0; }
.sender label { margin-top: 0; font-weight: 400; display: inline-flex; gap: 8px; align-items: center; }
.sender input { accent-color: var(--ember); width: 18px; height: 18px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 4px 0 0; min-height: 1.5em; }
.form-status.is-ok { color: var(--signal); }
.form-status.is-error { color: #ff9db0; }
.form-note { margin: 0; font-size: 0.9rem; color: var(--muted); }
.contact-stats { margin-top: 28px; color: var(--muted); font-size: 0.95rem; }
