:root {
  --bg: #ffffff;
  --ink: #14213d;
  --muted: #5b6472;
  --rule: #d9dee6;
  --accent: #1f4fd8;
  --accent-ink: #ffffff;
  --note-bg: #fff4d6;
  --note-ink: #6b4a00;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --page: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

/* Dark palette without a media query, for browsers that support light-dark(). */
@supports (color: light-dark(#000, #fff)) {
  :root {
    color-scheme: light dark;
    --bg: light-dark(#ffffff, #10151c);
    --ink: light-dark(#14213d, #e6eaf0);
    --muted: light-dark(#5b6472, #9aa4b2);
    --rule: light-dark(#d9dee6, #2a3340);
    --accent: light-dark(#1f4fd8, #8fb0ff);
    --accent-ink: light-dark(#ffffff, #10151c);
    --note-bg: light-dark(#fff4d6, #3a2f12);
    --note-ink: light-dark(#6b4a00, #f0d48a);
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

[hidden] {
  display: none !important;
}

.masthead,
main,
.site-footer {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.masthead {
  padding-top: clamp(2rem, 6vw, 4.5rem);
}

h1 {
  margin: 0;
  font: 600 clamp(2.25rem, 4vw + 1.25rem, 3.75rem) / 1.05 var(--serif);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede {
  max-width: 38rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.125rem;
}

main {
  padding-block: 2rem 4rem;
}

/* Filters */

.filters {
  padding-block: 1.25rem;
  border-block: 1px solid var(--rule);
}

.filters fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
}

.filters legend {
  float: left;
  width: 6.5rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.filters button[data-group] {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

button.plain {
  margin-left: 0.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.notice {
  margin: 3rem 0;
  color: var(--muted);
}

/* Card grid: one column on phones, more as space allows. auto-fill (not
   auto-fit) keeps the column width steady when filtering leaves few cards. */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 2.5rem 2rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.card {
  min-width: 0;
}

.shot {
  display: block;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--rule);
}

.is-archived .shot img {
  filter: grayscale(1);
}

.card h3 {
  margin: 0.9rem 0 0;
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.card h3 a {
  color: inherit;
  text-decoration: none;
}

.card h3 a:hover {
  text-decoration: underline;
}

.byline {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.badge {
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--note-bg);
  color: var(--note-ink);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.description {
  margin: 0.6rem 0 0;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
}

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

/* Section headings on the index and the profile page */

main h2 {
  margin: 3rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 650;
}

main > section:first-child > h2 {
  margin-top: 0;
}

.byline a {
  color: inherit;
}

/* Free-form fields from the Sheet. Each item sizes itself; no breakpoints. */

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 1rem 2rem;
  margin: 1.5rem 0 0;
}

.fields dt {
  color: var(--muted);
  font-size: 0.8125rem;
}

.fields dd {
  margin: 0.1rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* Student list on the index */

.people ul {
  columns: 14rem;
  column-gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.people li {
  padding-block: 0.25rem;
  break-inside: avoid;
}

.people .count {
  margin-left: 0.4rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Student page */

.back {
  margin: 0;
  font-size: 0.9375rem;
}

.profile {
  max-width: 46rem;
}

.profile-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}

.avatar img {
  display: block;
  width: 6rem;
  height: 6rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  object-fit: cover;
}

.project {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

.profile h2 + .project {
  margin-top: 0;
}

.project h3 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.project .shot {
  margin-top: 1.25rem;
}

.project .shot img {
  aspect-ratio: auto;
}

.project .description {
  margin-top: 1.25rem;
  font-size: 1.0625rem;
}

.links {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.links li + li {
  margin-top: 0.35rem;
}

.url {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.site-footer {
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}
