/* ---------------------------------------------------------------------------
   Yannis Belhadj Kessas — portfolio
   Scandinavian-minimal, dark-first. One accent. No images, no frameworks.
--------------------------------------------------------------------------- */

:root {
  --bg: #0b0e14;
  --surface: #11151e;
  --surface-2: #161b26;
  --ink: #e8ebf1;
  --muted: #8b94a4;
  --line: #232a38;
  --accent: #3fd68f;
  --accent-ink: #0b0e14;
  --dot-grid: rgba(139, 148, 164, 0.16);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efeee8;
  --ink: #171a20;
  --muted: #5d6573;
  --line: #dddbd2;
  --accent: #0c8a5c;
  --accent-ink: #ffffff;
  --dot-grid: rgba(93, 101, 115, 0.22);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #f7f6f2;
    --surface: #ffffff;
    --surface-2: #efeee8;
    --ink: #171a20;
    --muted: #5d6573;
    --line: #dddbd2;
    --accent: #0c8a5c;
    --accent-ink: #ffffff;
    --dot-grid: rgba(93, 101, 115, 0.22);
    color-scheme: light;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

a { color: inherit; }
strong { font-weight: 700; }
code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

/* ----------------------------- header ----------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem clamp(1.25rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
  font-size: 0.95rem;
}

.wordmark-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 1.4rem;
  font-size: 0.85rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--accent); }

@media (max-width: 720px) {
  .site-nav { display: none; }
  .theme-toggle { margin-left: auto; }
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
:root[data-theme="light"] .icon-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) .icon-moon { display: block; }
  :root:not([data-theme="dark"]):not([data-theme="light"]) .icon-sun { display: none; }
}

/* ----------------------------- layout ----------------------------------- */

main { max-width: 72rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }

.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--line); }

.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4.75rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }

/* ----------------------------- hero -------------------------------------- */

.hero {
  position: relative;
  padding: clamp(4.5rem, 11vw, 8.5rem) 0 clamp(3rem, 7vw, 5rem);
  background-image: radial-gradient(var(--dot-grid) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: center top;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, var(--bg) 92%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }

.hero-sub {
  margin-top: 1.5rem;
  font-size: clamp(0.78rem, 1.6vw, 0.92rem);
  color: var(--accent);
}

.hero-lede {
  margin-top: 1.5rem;
  max-width: 44rem;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--muted);
}
.hero-lede strong { color: var(--ink); }

.hero-actions { margin-top: 2.25rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }

.hero-location { margin-top: 1.75rem; font-size: 0.78rem; color: var(--muted); }

/* ----------------------------- stats ------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: clamp(3.5rem, 8vw, 6.5rem);
}

.stat {
  padding: 1.6rem 1.25rem;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.stat:first-child { border-left: none; }

.stat-value {
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { border-left: none; border-top: 1px solid var(--line); }
  .stat:nth-child(-n + 2) { border-top: none; }
  .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .stat:last-child { grid-column: span 2; }
}

/* ----------------------------- story ------------------------------------- */

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 860px) { .story-grid { grid-template-columns: 1fr; } }

.story-text p { margin-bottom: 1.1rem; color: var(--muted); }
.story-text p strong, .story-text code { color: var(--ink); }
.story-kicker {
  color: var(--ink) !important;
  font-weight: 600;
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}

.terminal {
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] .terminal { border-color: #2a3140; }

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #1d2330;
}
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: #2a3140; }
.terminal-bar em {
  margin-left: auto;
  font-style: normal;
  font-size: 0.68rem;
  color: #5b6577;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.terminal pre {
  padding: 1.25rem 1.4rem;
  font-size: 0.82rem;
  line-height: 2;
  color: #c4ccda;
  overflow-x: auto;
}
.t-prompt { color: #3fd68f; font-weight: 700; }
.t-dim { color: #5b6577; }
.t-ok { color: #3fd68f; font-weight: 700; }
.terminal strong { color: #e8ebf1; }

/* ----------------------------- flow diagram ------------------------------ */

.section-wide { /* room for the diagram */ }

.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 0.5rem;
}

.flow-node {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1.1rem 1.25rem;
}

.flow-node-core { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.flow-stage {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.flow-node strong { font-size: 0.95rem; line-height: 1.3; }
.flow-detail { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }

.flow-arrow {
  flex: 0 0 clamp(1.1rem, 2.2vw, 2rem);
  align-self: center;
  position: relative;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 10px);
}
.flow-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid var(--accent);
  border-right: 1.5px solid var(--accent);
  transform: translateY(-50%) rotate(45deg);
}

@media (max-width: 980px) {
  .flow { flex-direction: column; }
  .flow-arrow {
    flex-basis: 1.6rem;
    width: 1px;
    height: 1.6rem;
    align-self: center;
    background: repeating-linear-gradient(180deg, var(--accent) 0 5px, transparent 5px 10px);
  }
  .flow-arrow::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 0;
    transform: translateX(-50%) rotate(135deg);
  }
}

.flow-observability {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.flow-obs-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

/* ----------------------------- skills ------------------------------------ */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1rem;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.4rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.skill-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.skill-card p { font-size: 0.92rem; color: var(--muted); }
.skill-note {
  margin-top: 0.85rem;
  font-size: 0.72rem !important;
  color: var(--accent) !important;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ----------------------------- proof ------------------------------------- */

.proof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1rem;
}

.proof-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.4rem;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.proof-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.proof-org {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.proof-card strong { font-size: 0.98rem; line-height: 1.45; font-weight: 600; }

.proof-card-featured { grid-column: 1 / -1; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.proof-card-featured strong { font-size: clamp(1.15rem, 2.4vw, 1.45rem); letter-spacing: -0.01em; }
.proof-desc { font-size: 0.95rem; color: var(--muted); line-height: 1.65; max-width: 56rem; }
.proof-link {
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.warstory {
  margin-top: 2.5rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  padding: 1.9rem clamp(1.4rem, 3.5vw, 2.4rem);
}
.warstory .eyebrow { margin-bottom: 1.25rem; }

.warstory-timeline { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; }
.warstory-timeline li {
  display: flex;
  gap: 1.1rem;
  align-items: baseline;
  font-size: 0.95rem;
  color: var(--muted);
}
.wt-time {
  flex: 0 0 5.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.warstory blockquote {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

/* ----------------------------- contact ----------------------------------- */

.contact { text-align: center; padding-bottom: clamp(4rem, 9vw, 7rem); }
.contact .eyebrow { text-align: center; }
.contact-lede { color: var(--muted); margin-bottom: 2rem; max-width: 36rem; margin-inline: auto; }

.contact-email {
  display: inline-block;
  font-size: clamp(1.1rem, 3.4vw, 1.7rem);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding-bottom: 0.15em;
  transition: border-color 0.2s ease;
  overflow-wrap: anywhere;
}
.contact-email:hover { border-color: var(--accent); }

.contact-links {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.contact-links a { color: var(--muted); transition: color 0.15s ease; }
.contact-links a:hover { color: var(--accent); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ----------------------------- motion ------------------------------------ */

.js .reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}
