/* ==========================================================================
   madsmadsen.dk
   Dark, editorial résumé. Each section owns one accent colour.
   ========================================================================== */

:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #171b24;
  --line: #252a36;
  --line-2: #323848;
  --text: #e7e9ef;
  --body: #c3c8d3;
  --muted: #9097a8;
  --faint: #5c6375;

  --violet: #9d7bff;
  --teal: #2fd4b0;
  --amber: #f2b33d;
  --blue: #5da8ff;
  --coral: #ff7f5c;
  --lime: #b5f25c;
  --pink: #ff5c93;

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

* { font-variant-ligatures: none; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(157, 123, 255, 0.13), transparent 70%),
    radial-gradient(700px 420px at -12% 35%, rgba(47, 212, 176, 0.06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

body::before {
  /* faint dot grid, fading out downwards */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}
.btn-primary { background: var(--violet); border-color: var(--violet); color: #120c26; font-weight: 700; }
.btn-primary:hover { background: #b199ff; transform: translateY(-1px); box-shadow: 0 8px 26px -8px rgba(157, 123, 255, 0.8); }

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

.cv {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 32px 96px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 72px;
}

/* ---------------------------------------------------------------- sidebar */

.cv-side { position: sticky; top: 56px; align-self: start; }
.cv-kicker { font-family: var(--font-mono); font-size: 12.5px; color: var(--faint); margin: 0 0 14px; }
.cv-name { margin: 0; font-size: 60px; line-height: 0.92; font-weight: 800; letter-spacing: -0.045em; }
.cv-name span { display: block; color: var(--violet); }
.cv-role { margin: 18px 0 0; font-size: 19px; font-weight: 500; }
.cv-loc { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

.cv-links { margin: 24px 0 26px; display: flex; flex-direction: column; gap: 9px; }
.cv-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  overflow-wrap: anywhere;
}
.cv-links a:hover { color: var(--text); }
.cv-links svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.cv-links svg.stroke { fill: none; stroke: currentColor; stroke-width: 1.7; }

.cv-toc { margin-top: 36px; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.cv-toc a {
  position: relative;
  padding: 5px 0 5px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
  text-decoration: none;
  transition: color 0.2s;
}
.cv-toc a::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--c);
  transform: scaleY(0);
  transition: transform 0.25s var(--ease);
}
.cv-toc a:hover { color: var(--muted); }
.cv-toc a.is-active { color: var(--text); }
.cv-toc a.is-active::before { transform: none; }

/* ---------------------------------------------------------------- main */

.cv-main section { margin-bottom: 64px; }
.cv-main h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--faint);
}
.cv-main h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cv-main h2 b { font-weight: 400; color: var(--c); }

.cv-hero { padding-top: 6px; }
.cv-intro { margin: 0; font-size: 26px; line-height: 1.4; font-weight: 500; letter-spacing: -0.012em; color: #d9dce4; }
.cv-intro em { font-style: normal; color: var(--text); background: linear-gradient(transparent 62%, rgba(157, 123, 255, 0.35) 62%); }

.cv-entry {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.cv-entry:first-of-type { border-top: 0; padding-top: 0; }
.cv-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); padding-top: 4px; }
.cv-date .now { color: var(--c); }
.cv-entry h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.cv-entry h3 small { font-weight: 500; color: var(--muted); font-size: 15.5px; }
.cv-entry p { margin: 6px 0 0; color: var(--body); }

.cv-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.cv-tags span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.cv-projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cv-project {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.cv-project:hover { border-color: var(--c); transform: translateY(-3px); box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--c) 70%, transparent); }
.cv-project:first-child { grid-column: 1 / -1; background: linear-gradient(135deg, color-mix(in srgb, var(--coral) 10%, var(--panel)), var(--panel) 60%); }
.cv-project h3 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.cv-project:first-child h3 { font-size: 22px; }
.cv-project .badge { margin-left: auto; font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--amber); }
.cv-project p { margin: 6px 0 0; color: #b9bfcb; font-size: 14.5px; flex: 1; }

.cv-skills { margin: 0; display: grid; gap: 14px; }
.cv-skill-row { display: grid; grid-template-columns: 196px 1fr; gap: 12px; align-items: center; }
.cv-skill-row dt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
/* dotted leader + "=" so each label reads as an assignment to its list */
.cv-skill-row dt::before {
  content: "";
  order: 1;
  flex: 1;
  min-width: 12px;
  border-bottom: 2px dotted var(--line-2);
  transform: translateY(-4px);
}
.cv-skill-row dt::after { content: "="; order: 2; color: var(--c); }
.cv-skill-row dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cv-skill-row dd span { padding: 3px 12px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 14.5px; }
.cv-skill-row.core dd span { border-color: rgba(93, 168, 255, 0.5); background: rgba(93, 168, 255, 0.1); }

.cv-games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cv-game {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.cv-game:hover { border-color: var(--pink); transform: translateY(-2px); }
.cv-game img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #fff; padding: 4px; }
.cv-game h3 { margin: 0; font-size: 16.5px; }
.cv-game p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }

.cv-foot { border-top: 1px solid var(--line); padding-top: 28px; color: var(--muted); }
.cv-foot p { margin: 0 0 6px; }
.cv-foot a { color: var(--violet); text-underline-offset: 3px; }
.cv-copy { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }

/* ---------------------------------------------------------------- reveal */

.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

.cv-side > * { animation: rise 0.7s var(--ease) both; }
.cv-side > :nth-child(2) { animation-delay: 0.05s; }
.cv-side > :nth-child(3) { animation-delay: 0.1s; }
.cv-side > :nth-child(4) { animation-delay: 0.15s; }
.cv-side > :nth-child(n + 5) { animation-delay: 0.2s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .cv { grid-template-columns: 1fr; gap: 44px; padding: 48px 20px 72px; }
  .cv-side { position: static; }
  .cv-name { font-size: 50px; }
  .cv-name span { display: inline; }
  .cv-toc { display: none; }
}

@media (max-width: 640px) {
  .cv-name { font-size: 42px; }
  .cv-intro { font-size: 21px; }
  .cv-entry, .cv-skill-row { grid-template-columns: 1fr; gap: 4px; }
  .cv-skill-row { gap: 8px; }
  .cv-skill-row dt::before { display: none; }
  .cv-projects, .cv-games { grid-template-columns: 1fr; }
}

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

@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .cv { display: block; padding: 0; }
  .cv-toc, .btn, .skip-link { display: none; }
  .cv-side { position: static; margin-bottom: 24px; }
  .cv-name span, .cv-main h2 b, .cv-date .now { color: #000; }
  .cv-intro, .cv-entry p, .cv-project p { color: #222; }
  .cv-project, .cv-game { background: none; border-color: #ccc; }
  .js .reveal { opacity: 1; transform: none; }
}
