/* ---------------------------------------------------------------- tokens */

:root {
  --bg:        #fbfbfa;
  --fg:        #161614;
  --muted:     #6b6b63;
  --faint:     #8f8f87;
  --rule:      #e3e3de;
  --rule-soft: #eeeeea;
  --accent:    #b4451f;
  --code-bg:   #f0f0ec;

  --serif: ui-serif, Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 34rem;
  --gutter:  1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #111110;
    --fg:        #e8e8e3;
    --muted:     #9b9b92;
    --faint:     #77776f;
    --rule:      #2a2a27;
    --rule-soft: #1e1e1c;
    --accent:    #e8845c;
    --code-bg:   #1d1d1a;
  }
}

:root[data-theme="dark"] {
  --bg:        #111110;
  --fg:        #e8e8e3;
  --muted:     #9b9b92;
  --faint:     #77776f;
  --rule:      #2a2a27;
  --rule-soft: #1e1e1c;
  --accent:    #e8845c;
  --code-bg:   #1d1d1a;
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color .18s ease, color .18s ease;
}

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

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

code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 3px;
}

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.015em;
}

ul, ol { margin: 0; padding: 0; list-style: none; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--bg);
  padding: .5rem .75rem;
  border: 1px solid var(--rule);
}

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

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 7rem var(--gutter) 5rem;
}

@media (max-width: 40rem) {
  .wrap { padding-top: 4.5rem; }
}

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

.hero {
  margin-bottom: 5.5rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  font-weight: 400;
  letter-spacing: -0.025em;
}

.role {
  margin: .4rem 0 0;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

.lede {
  margin: 2rem 0 0;
  max-width: var(--measure);
  font-size: 1.05rem;
  color: var(--muted);
  text-wrap: pretty;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
  font-family: var(--mono);
  font-size: .82rem;
}

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

/* --------------------------------------------------------------- section */

.section {
  padding-top: 2.25rem;
  margin-top: 3.5rem;
  border-top: 1px solid var(--rule);
}

.section-title {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 2.25rem;
}

/* -------------------------------------------------------------- projects */

.projects {
  display: grid;
  gap: 2.5rem;
}

.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.project h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 400;
}

.project h3 a { border-bottom-color: var(--rule); }

.tag {
  flex: none;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

.project p {
  margin: .6rem 0 0;
  max-width: var(--measure);
  color: var(--muted);
  font-size: .95rem;
  text-wrap: pretty;
}

.more {
  margin: 3rem 0 0;
  font-size: .9rem;
  color: var(--faint);
}

/* --------------------------------------------------------------- entries */

.entries {
  display: grid;
  gap: 3rem;
}

.entry {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.5rem;
}

@media (max-width: 44rem) {
  .entry {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
}

.entry-meta {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  font-family: var(--mono);
  font-size: .74rem;
  line-height: 1.6;
  color: var(--faint);
  padding-top: .3rem;
}

@media (max-width: 44rem) {
  .entry-meta {
    flex-direction: row;
    gap: .75rem;
    padding-top: 0;
  }
  .where::before { content: "· "; }
}

.entry-body h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
}

.org {
  display: block;
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: .2rem;
}

.entry-body ul {
  margin: .85rem 0 0;
  display: grid;
  gap: .5rem;
  max-width: var(--measure);
}

.entry-body li {
  position: relative;
  padding-left: 1.1rem;
  font-size: .93rem;
  color: var(--muted);
  text-wrap: pretty;
}

.entry-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: .3rem;
  height: 1px;
  background: var(--faint);
}

.entry-body > p {
  margin: .85rem 0 0;
  max-width: var(--measure);
  font-size: .93rem;
  color: var(--muted);
  text-wrap: pretty;
}

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

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .78rem;
}

.skills li {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .28rem .8rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------- footer */

.footer {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--faint);
}

.footer p { margin: 0; }

/* ----------------------------------------------------------- theme toggle */

.theme {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 5;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--faint);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}

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

.theme svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Icon shows the theme you would switch *to*: moon while light, sun while dark.
   Mirrors the token cascade above so the two never disagree. */
.theme .sun  { display: none; }
.theme .moon { display: initial; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun  { display: initial; }
  :root:not([data-theme="light"]) .theme .moon { display: none; }
}

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

/* ------------------------------------------------------------------ print */

@media print {
  .theme, .skip { display: none; }
  .wrap { max-width: none; padding: 0; }
  body { font-size: 11pt; }
  a { border-bottom: none; }
}
