:root {
  --bg: #faf9f7;
  --text: #191817;
  --body: #4a4843;
  --muted: #6f6c63;
  --line: #e4e1db;
  --chip: #f1eee9;
  --accent: #b5703a;
  --accent-soft: rgba(181, 112, 58, 0.45);
  --glow: rgba(214, 196, 172, 0.35);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --col: 620px;
  --wide: 1020px;
  --split: 1240px;
  --split-left: 380px;
  --split-gap: 96px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312;
    --text: #f1eee9;
    --body: #bdb8ae;
    --muted: #8e897e;
    --line: #2b2926;
    --chip: #1f1d1b;
    --accent: #d4925a;
    --accent-soft: rgba(212, 146, 90, 0.45);
    --glow: rgba(120, 90, 60, 0.18);
  }
}

:root[data-theme="dark"] {
  --bg: #141312;
  --text: #f1eee9;
  --body: #bdb8ae;
  --muted: #8e897e;
  --line: #2b2926;
  --chip: #1f1d1b;
  --accent: #d4925a;
  --accent-soft: rgba(212, 146, 90, 0.45);
  --glow: rgba(120, 90, 60, 0.18);
}

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

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

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, var(--glow), transparent 40%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding: 0 16px;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

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

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.muted {
  color: var(--muted);
}

.accent {
  color: var(--accent);
}

.col {
  max-width: var(--col);
  margin: 0 auto;
}

.wide {
  max-width: var(--wide);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 6px 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  font-size: 14px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Header */

.site-header {
  max-width: var(--wide);
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav {
  display: flex;
  gap: 24px;
  font-family: var(--mono);
  font-size: 13px;
}

.nav a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav a:first-child,
.nav a:hover {
  color: var(--text);
}

.theme-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-sun {
    display: block;
  }

  :root:not([data-theme]) .icon-moon {
    display: none;
  }
}

/* Intro */

.intro {
  padding-top: 56px;
}

h1 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.intro > .mono {
  margin-top: 10px;
}

.bio {
  margin-top: 36px;
  color: var(--body);
}

.ul {
  color: var(--text);
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.15s ease;
}

.ul:hover {
  border-bottom-color: var(--accent);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 32px;
}

.links a {
  color: var(--body);
  transition: color 0.15s ease;
}

.links a:hover {
  color: var(--accent);
}

/* Sections */

section + section {
  padding-top: 72px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h2 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Works */

.works {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 24px;
  padding-top: 4px;
}

.work {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.work-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--chip);
  margin-bottom: 12px;
  transition: border-color 0.15s ease, transform 0.2s ease;
}

.work:hover .work-thumb,
.work:focus-visible .work-thumb {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
}

.work-name {
  font-weight: 500;
  color: var(--text);
}

.arrow {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.work:hover .arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.work-desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--body);
}

.work-meta {
  margin-top: 6px;
}

/* Tools and stack */

.tools {
  margin-top: 40px;
}

.tools h3 {
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.tool {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

/* The SVG is used as a mask so the icon takes the theme's text colour */
.tool-icon {
  width: 26px;
  height: 26px;
  background-color: var(--muted);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.tool:hover .tool-icon,
.tool:focus-visible .tool-icon {
  background-color: var(--text);
  transform: translateY(-2px);
}

/* Name label above the icon */
.tool::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.tool:hover::after,
.tool:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Roles */

.view-all {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: opacity 0.15s ease;
}

.view-all:hover {
  opacity: 0.75;
}

.role {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.role:first-child {
  padding-top: 4px;
}

.role:last-child {
  border-bottom: none;
}

.role-title {
  font-weight: 500;
  color: var(--text);
}

.role-co {
  color: var(--muted);
}

a.role-co {
  border-bottom: 1px solid var(--accent-soft);
  transition: color 0.15s ease, border-color 0.15s ease;
}

a.role-co:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.role-dates {
  flex-shrink: 0;
  font-size: 14px;
}

.now-title {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.now-desc {
  font-size: 14px;
  color: var(--body);
}

/* Now */

.now-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 40px;
}

.now-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}

/* Footer */

.site-footer {
  margin-top: 120px;
  margin-bottom: 0;
  padding: 24px 0 40px;
  border-top: 1px dashed var(--line);
}

/* Responsive */

@media (max-width: 640px) {
  .intro {
    padding-top: 32px;
  }

  .works {
    grid-template-columns: 1fr;
  }

  .now-grid {
    grid-template-columns: 1fr;
  }

  .role {
    flex-direction: column;
    gap: 2px;
  }

  section + section {
    padding-top: 56px;
  }
}

/* Wide screens: pin the intro on the left, scroll the sections on the right */

@media (min-width: 1100px) {
  .site-header {
    max-width: var(--split);
  }

  main {
    max-width: var(--split);
    margin: 0 auto;
    display: grid;
    grid-template-columns: var(--split-left) 1fr;
    column-gap: var(--split-gap);
    align-items: start;
  }

  main > :is(.col, .wide) {
    grid-column: 2;
    max-width: none;
    margin: 0;
  }

  main > .intro {
    grid-column: 1;
    grid-row: 1 / span 3;
    position: sticky;
    top: 0;
  }

  main > .intro + section {
    padding-top: 56px;
  }

  .site-footer {
    max-width: var(--split);
    padding-left: calc(var(--split-left) + var(--split-gap));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
