:root {
  --bg: #fafaf7;
  --ink: #1f2125;
  --mute: rgba(31, 33, 37, 0.5);
  --faint: rgba(31, 33, 37, 0.3);
  --rule: rgba(31, 33, 37, 0.12);
  --accent: #c4a157;
  --link-hover-bg: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --ink: #dcdfe5;
    --mute: rgba(220, 223, 229, 0.5);
    --faint: rgba(220, 223, 229, 0.3);
    --rule: rgba(220, 223, 229, 0.12);
    --link-hover-bg: rgba(255, 255, 255, 0.03);
  }
}

[data-theme="light"] {
  --bg: #fafaf7;
  --ink: #1f2125;
  --mute: rgba(31, 33, 37, 0.5);
  --faint: rgba(31, 33, 37, 0.3);
  --rule: rgba(31, 33, 37, 0.12);
  --link-hover-bg: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] {
  --bg: #0f1115;
  --ink: #dcdfe5;
  --mute: rgba(220, 223, 229, 0.5);
  --faint: rgba(220, 223, 229, 0.3);
  --rule: rgba(220, 223, 229, 0.12);
  --link-hover-bg: rgba(255, 255, 255, 0.03);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--faint) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.35;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 760px;
  padding: 64px 80px;
  margin: 0 auto;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--rule);
  font-size: 12px;
  color: var(--mute);
}

.topbar .meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

#theme-toggle {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--mute);
  font-size: 13px;
  line-height: 1;
  font-family: inherit;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

#theme-toggle:hover,
#theme-toggle:focus-visible {
  color: var(--accent);
  outline: none;
}

/* Hero */
.hero {
  margin-top: 56px;
  display: flex;
  gap: 28px;
  align-items: center;
}

.avatar {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  background-image: url("assets/mathias.jpg");
  background-size: 110%;
  background-position: center 18%;
  background-repeat: no-repeat;
  border: 1px solid var(--rule);
  border-radius: 50%;
}

.hero-text { flex: 1; min-width: 0; }

.hero h1 {
  font-size: 36px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.85em;
  background: var(--accent);
  margin-left: 6px;
  vertical-align: -2px;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--mute);
}

/* Bio */
.bio {
  margin-top: 56px;
  max-width: 640px;
}

.bio p {
  position: relative;
  margin: 0;
  padding-left: 30px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}

.bio p + p { margin-top: 18px; }

.bio p::before {
  content: ">";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  line-height: 1.75;
  user-select: none;
}

.bio a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 33%, transparent);
}

/* Links */
.links {
  margin-top: 56px;
  display: flex;
  flex-direction: column;
}

.link {
  display: grid;
  grid-template-columns: 36px 130px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}

.link:first-child { border-top: 1px solid var(--rule); }

.link .k {
  color: var(--mute);
  font-size: 12px;
  transition: color 0.15s;
}

.link .label { font-size: 14px; font-weight: 500; }
.link .desc { font-size: 12px; color: var(--mute); }
.link .url { font-size: 12px; color: var(--faint); }

.link .arrow {
  font-size: 13px;
  color: var(--mute);
  opacity: 0.4;
  width: 12px;
  text-align: right;
  transition: opacity 0.15s, color 0.15s;
}

.link:hover,
.link:focus-visible {
  background: var(--link-hover-bg);
  outline: none;
}

.link:hover .k,
.link:focus-visible .k,
.link:hover .arrow,
.link:focus-visible .arrow {
  color: var(--accent);
}

.link:hover .arrow,
.link:focus-visible .arrow {
  opacity: 1;
}

/* Footer */
footer {
  margin-top: 56px;
  font-size: 12px;
  color: var(--mute);
  display: flex;
  justify-content: flex-end;
}

/* Mobile */
@media (max-width: 640px) {
  .container { padding: 36px 24px; }

  .hero { margin-top: 36px; gap: 20px; }

  .avatar { width: 72px; height: 72px; flex: 0 0 72px; }

  .hero h1 { font-size: 26px; }

  .subtitle { font-size: 12px; }

  .bio { margin-top: 36px; }

  .bio p {
    padding-left: 24px;
    font-size: 13px;
  }

  .bio p + p { margin-top: 14px; }

  .links { margin-top: 36px; }

  .link {
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "k label arrow"
      "k desc  arrow";
    column-gap: 12px;
    row-gap: 2px;
    padding: 12px 14px;
  }

  .link .k     { grid-area: k;     align-self: center; }
  .link .label { grid-area: label; font-size: 14px; }
  .link .desc  { grid-area: desc;  font-size: 11px; }
  .link .url   { display: none; }
  .link .arrow { grid-area: arrow; align-self: center; }

  footer { margin-top: 36px; }
}
