/* site.css styles the portfolio as a single readable column. Hierarchy comes
   only from size, weight, spacing and hairlines: no motion, no gradients, no
   web fonts. Dark mode swaps the same five colours. */
:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --text: #1c1c1b;
  --muted: #6b6b68;
  --rule: #e4e4e0;
  --link-line: #b9b9b4;
  --measure: 720px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161616;
  --text: #e6e6e3;
  --muted: #9a9a96;
  --rule: #2c2c2a;
  --link-line: #5a5a57;
}

/* Without JavaScript the theme attribute is never set, so follow the system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #161616;
    --text: #e6e6e3;
    --muted: #9a9a96;
    --rule: #2c2c2a;
    --link-line: #5a5a57;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 48px);
  padding: 0 24px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: currentColor; }

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

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }

/* Header: motto on the left, language and theme on the right. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 24px;
  padding: 32px 0 0;
  font-size: 15px;
}

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

.controls { display: flex; gap: 16px; margin-left: auto; }

.controls[hidden] { display: none; }

.languages { display: flex; gap: 2px; }

.controls button {
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.controls button:hover,
.languages button[aria-pressed="true"] { color: var(--text); }

.languages button[aria-pressed="true"] {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Sections: generous space above each heading does the separating. */
main { padding: 48px 0 60px; }

/* Intro: photo on the left, the introduction beside it. */
.intro {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
  gap: 36px;
}

.portrait {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  background: var(--rule);
  /* Dimmed so the photo does not outshine the text beside it. */
  filter: brightness(0.85);
}

.intro h1 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.intro .role { color: var(--muted); margin-bottom: 16px; }

.links { display: flex; flex-wrap: wrap; gap: 4px 20px; }

.intro .links { margin-top: 20px; }

section + section { margin-top: 44px; }

h2 {
  font-size: 15px;
  font-weight: 600;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

h2 + p { margin-top: 16px; }

section > p + p { margin-top: 12px; }

/* Projects: a plain list, one hairline between entries. */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  column-gap: 48px;
  list-style: none;
  padding: 0;
}

.project { padding: 12px 0; border-top: 1px solid var(--rule); }

/* The section heading's rule already sits above the first row. */
.project:nth-child(-n + 2) { border-top: 0; }

.project h3 { font-size: 18px; font-weight: 600; line-height: 1.5; margin-bottom: 4px; }

/* A title row with a small note pushed to the right. */
.project-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 12px;
  margin-bottom: 4px;
}

.project-title h3 { margin-bottom: 0; }

.project-title small { color: var(--muted); font-size: 13px; }

.detail .project-links { margin: 4px 0 12px; }

.project h3 a { text-decoration: none; }

.project h3 a:hover { text-decoration: underline; text-decoration-color: currentColor; }

.meta,
.project-links,
summary { font-size: 14px; }

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

.project-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; }

details { margin-top: 8px; }

summary {
  display: inline-block;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }

summary::after { content: " +"; }

details[open] summary::after { content: " −"; }

summary:hover { color: var(--text); }

details > .detail {
  margin-top: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--rule);
  font-size: 15px;
}

details dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px 24px;
  margin-top: 16px;
}

details dt { color: var(--muted); font-size: 13px; }

/* Strengths and limits: short plain bullet lists. */
.limits { padding-left: 1.25em; margin-top: 16px; }

.limits li + li { margin-top: 4px; }

/* Strengths and limits sit side by side as two columns. */
.pair {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: start;
  column-gap: 48px;
  margin-top: 44px;
}

.pair > section + section { margin-top: 0; }

.pair + section { margin-top: 44px; }


@media (max-width: 600px) {
  body { padding: 0 20px; }
  .site-header { padding-top: 20px; }
  main { padding-top: 28px; }
  .intro { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .portrait { width: 104px; }
  section + section { margin-top: 32px; }
  .pair { grid-template-columns: minmax(0, 1fr); margin-top: 32px; }
  .pair > section + section, .pair + section { margin-top: 32px; }
  details dl { grid-template-columns: minmax(0, 1fr); }
  .projects { grid-template-columns: minmax(0, 1fr); }
  .project:nth-child(2) { border-top: 1px solid var(--rule); }
}
