@font-face {
  font-family: "CMU Serif";
  src: url("/fonts/cmu-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "CMU Typewriter";
  src: url("/fonts/cmu-typewriter.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* —— palette (academic) —— */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #555555;
  --rule: #d0d0d0;
  --link: #0000cc;
  --visited: #551a8b;
  --accent: #1a3a6b;
  --accent-soft: #e8eef6;
  --body-font: "CMU Serif", "Times New Roman", Times, serif;
  --mono: "CMU Typewriter", "Courier New", Courier, monospace;
  --fs: 16px;
  --fs-meta: 0.85rem;
  --lh: 1.4;
}

html[data-font="cmu"] {
  --body-font: "CMU Serif", "Times New Roman", Times, serif;
}

html[data-font="times"] {
  --body-font: "Times New Roman", Times, serif;
}

html[data-font="palatino"] {
  --body-font: Palatino, "Palatino Linotype", "Book Antiqua", serif;
}

html[data-font="georgia"] {
  --body-font: Georgia, serif;
}

html[data-font="garamond"] {
  --body-font: Garamond, "Apple Garamond", "Times New Roman", serif;
}

html[data-font="baskerville"] {
  --body-font: Baskerville, "Baskerville Old Face", "Times New Roman", serif;
}

html[data-font="arial"] {
  --body-font: Arial, Helvetica, sans-serif;
}

html[data-font="helvetica"] {
  --body-font: Helvetica, Arial, sans-serif;
}

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

html {
  font-size: var(--fs);
  background: var(--bg);
  color: var(--fg);
}

body {
  margin: 0 auto;
  min-height: 100vh;
  padding: 1rem clamp(1.25rem, 4vw, 2.5rem) 1.25rem;
  font-family: var(--body-font);
  line-height: var(--lh);
  max-width: min(1120px, 100%);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:visited {
  color: var(--visited);
}

a:hover {
  text-decoration-thickness: 2px;
}

.mono,
tt,
code,
kbd,
.nav-links,
.footer,
table.dense th,
.status-line,
.shortcuts kbd {
  font-family: var(--mono);
}

h1 {
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--fg);
}

h2 {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 0.45rem;
}

p {
  margin: 0.3rem 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0.5rem 0;
}

/* —— nav —— */
.nav {
  margin: 0;
  color: var(--muted);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
}

.nav-links {
  font-size: 1rem;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.font-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--muted);
  white-space: nowrap;
}

.font-switch select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.05rem 0.25rem;
}

.nav a {
  color: var(--link);
}

.nav .here {
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
}

.tagline {
  color: var(--muted);
  margin: 0 0 0.4rem;
}

/* —— home: use the width —— */
.home {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 0.5rem 3.25rem;
  align-items: stretch;
}

.home-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 100%;
}

.home-main > .status-line {
  margin-top: 0.35rem;
  margin-bottom: 0;
}

.home-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-height: 100%;
}

.home-block h2 {
  margin-top: 0;
}

.gazette {
  border: 2px solid var(--fg);
  padding: 0;
  overflow: hidden;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gazette-masthead {
  text-align: center;
  border-bottom: 2px solid var(--fg);
  padding: 0.4rem 0.5rem 0.35rem;
  background: var(--accent-soft);
  flex: 0 0 auto;
}

.gazette-title {
  font-family: var(--body-font);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.15;
}

.gazette-sub {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 0.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gazette-body {
  display: grid;
  grid-template-columns: minmax(200px, 0.42fr) 1fr;
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 220px;
}

.gazette-photo {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gazette-photo[hidden] {
  display: none !important;
}

.gazette-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 320px;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.15);
  border: 1px solid var(--rule);
  flex: 1 1 auto;
}

.gazette-photo figcaption {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 0.25rem;
  line-height: 1.25;
}

.gazette-heads {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.headline {
  margin: 0;
}

.headline .hed {
  font-family: var(--body-font);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  margin: 0;
}

.headline .hed a {
  color: inherit;
  text-decoration: none;
}

.headline .hed a:hover {
  text-decoration: underline;
  color: var(--link);
}

.headline .dateline {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.35rem;
}

.gazette .field-note {
  padding: 0.3rem 0.5rem 0.35rem;
  border-top: 1px solid var(--rule);
  margin: 0;
  font-size: var(--fs-meta);
  color: var(--muted);
  font-family: var(--mono);
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .gazette-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .gazette-photo img {
    min-height: 160px;
    max-height: 220px;
  }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1.25rem;
}

table.dense {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  margin: 0;
}

.stack {
  margin: 0;
}

.stack dt {
  font-family: var(--mono);
  color: var(--muted);
  margin: 0.55rem 0 0.05rem;
}

.stack dt:first-child {
  margin-top: 0;
}

.stack dd {
  margin: 0;
}

table.dense th,
table.dense td {
  text-align: left;
  vertical-align: top;
  padding: 0.3rem 0.65rem 0.3rem 0;
  border-bottom: 1px solid var(--rule);
}

table.dense th {
  width: 7.5rem;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

table.resume {
  table-layout: fixed;
}

table.resume th {
  width: 14rem;
  padding-right: 1.25rem;
}

table.list th {
  width: auto;
  color: var(--fg);
  font-weight: 700;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.25rem;
}

table.list td,
table.list th {
  padding: 0.2rem 0.55rem 0.2rem 0;
}

table.projects td,
table.projects th {
  padding: 0.7rem 1.25rem 0.7rem 0;
  line-height: 1.4;
}

table.projects th:nth-child(1),
table.projects td:nth-child(1) {
  white-space: nowrap;
  width: 5.5rem;
}

table.projects th:nth-child(2),
table.projects td:nth-child(2) {
  width: 17rem;
}

table.projects th:nth-child(3),
table.projects td:nth-child(3) {
  white-space: nowrap;
  width: 6.5rem;
}

@media (max-width: 820px) {
  table.projects thead,
  table.projects tbody,
  table.projects {
    display: block;
    width: 100%;
  }

  table.projects thead tr,
  table.projects tbody tr {
    display: grid;
    grid-template-columns: 4.75rem 1fr auto;
    column-gap: 0.65rem;
    align-items: start;
    border-bottom: 1px solid var(--rule);
    padding: 0.85rem 0;
  }

  table.projects th,
  table.projects th:nth-child(1),
  table.projects th:nth-child(2),
  table.projects th:nth-child(3),
  table.projects td,
  table.projects td:nth-child(1),
  table.projects td:nth-child(2),
  table.projects td:nth-child(3) {
    width: auto;
    border: 0;
    padding: 0;
  }

  table.projects thead th:nth-child(4) {
    display: none;
  }

  table.projects td.project-desc {
    grid-column: 1 / -1;
    padding-top: 0.55rem;
  }
}

ul.plain {
  margin: 0;
  padding-left: 1.05rem;
}

ul.plain li {
  margin: 0.12rem 0;
}

.status-line {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 0.85rem;
}

.footer {
  margin-top: 0.75rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-meta);
  color: var(--muted);
}

.footer p {
  margin: 0.2rem 0;
}

.footer .sitemap {
  margin-bottom: 0.35rem;
}

.blink {
  animation: blink 1.2s step-end infinite;
}

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

.todo {
  color: #a60;
  font-family: var(--mono);
}

.shortcuts {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  padding: 1.5rem 1rem;
  z-index: 100;
}

.shortcuts.open {
  display: block;
}

.shortcuts .panel {
  max-width: 40rem;
  margin: 0 auto;
  border: 1px solid var(--fg);
  border-top: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  background: var(--bg);
}

.shortcuts h2 {
  margin-top: 0;
}

.shortcuts kbd {
  border: 1px solid var(--rule);
  padding: 0.05rem 0.3rem;
  background: #f4f4f4;
}

#konami-status {
  display: none;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin: 0.35rem 0;
}

#konami-status.show {
  display: block;
}

/* —— responsive —— */
@media (max-width: 820px) {
  .home {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

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

@media (max-width: 560px) {
  body {
    padding: 0.55rem 0.65rem 0.85rem;
  }

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

  table.dense th {
    width: 5.75rem;
  }

  table.resume th {
    width: 12rem;
  }

  .nav-links {
    white-space: nowrap;
  }

  h1 {
    font-size: 1.5rem;
  }
}
