/* ==========================================================================
   matthewkling.github.io — site stylesheet
   Replaces the creative-portfolio theme's Bootstrap-based CSS.
   ========================================================================== */

:root {
  --bg: #f2f2f2;
  --ink: #1a1a1a;
  --body: #2a2a2a;
  --muted: #444;
  --meta: #5c5c5c;
  --rule: #d4d4d4;
  --rule-strong: #1a1a1a;
  --chip-border: #bdbdbd;
  --accent: #004E66;
  --accent-dark: #00303f;
  --sans: Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Page frame: sidebar + main column
   -------------------------------------------------------------------------- */

.page {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
}

.side {
  flex: 0 1 300px;
  min-width: 240px;
  padding: 48px 32px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.side .brand {
  color: #111;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.side .bio {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  font-weight: 300;
}

.side .snav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 16px;
}
.side .snav a { text-decoration: none; color: #333; }
.side .snav a:hover { color: var(--accent); }
.side .snav a[aria-current="page"],
.side .snav a.active { color: var(--accent); font-weight: 500; }

.side .foot {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: #666;
}
.side .foot .social {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.side .foot .social a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.side .foot .social a:hover { color: var(--accent); }

.main {
  flex: 999 1 560px;
  min-width: 0;
  padding: 48px 40px 96px;
}

.col { max-width: 840px; }
.col-wide { max-width: 900px; }
.col-article { max-width: 760px; }

/* Phone: sidebar collapses into a slim sticky top bar, bio + footer hidden */
@media (max-width: 767px) {
  .side {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 20px;
    padding: 14px 16px;
    border-bottom: 1px solid #cfcfcf;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
  }
  .side .brand { font-size: 15px; }
  .side .bio, .side .foot { display: none; }
  .side .snav { flex-direction: row; flex-wrap: wrap; gap: 0 18px; font-size: 14px; }
  .side .snav a { padding: 12px 0; }
  .main { padding: 20px 16px 64px; }
}

/* --------------------------------------------------------------------------
   Shared bits: labels, section rules, buttons
   -------------------------------------------------------------------------- */

.label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--meta);
}

.section-label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.page-label {
  margin: 0;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--rule-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  border: 1px solid var(--chip-border);
  background: transparent;
  color: #333;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #333; border-color: #333; color: #fff; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

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

/* --------------------------------------------------------------------------
   Thumbnails (shape encodes kind)
   -------------------------------------------------------------------------- */

.thumb-box {
  position: relative;
  flex: none;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.thumb {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: cover;
  background: #e4e4e4;
}
.thumb--paper  { border-radius: 50%; }
.thumb--app    { border-radius: 22%; }
.thumb--viz    { border-radius: 0; }
.thumb--hex {
  width: 104px;
  height: 120px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.thumb--logo { object-fit: contain; background: transparent; }

/* --------------------------------------------------------------------------
   Projects index
   -------------------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--rule-strong);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  font: inherit;
  font-size: 14px;
  background: transparent;
  color: #333;
  border: 1px solid var(--chip-border);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .count { opacity: 0.6; }
.chip svg { width: 15px; height: 15px; fill: currentColor; }

.rows { list-style: none; margin: 0; padding: 0; }

.row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}
.row[hidden] { display: none; }
.row:hover .row-title { color: var(--accent); }
.row:hover .thumb { filter: brightness(1.05); }

.row-text { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; min-width: 0; }
.row-title { font-size: 20px; font-weight: 500; line-height: 1.25; color: var(--ink); }
.row-tagline { font-size: 15px; line-height: 1.45; color: #333; }

@media (max-width: 640px) {
  .row { grid-template-columns: 80px minmax(0, 1fr); gap: 18px; }
  .row .thumb-box { width: 80px; height: 80px; }
  .row .thumb { width: 76px; height: 76px; }
  .row .thumb--hex { width: 70px; height: 80px; }
  .row-title { font-size: 18px; }
}

/* --------------------------------------------------------------------------
   Project page
   -------------------------------------------------------------------------- */

.back {
  display: inline-block;
  padding: 6px 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #555;
  text-decoration: none;
}
.back:hover { color: var(--accent); }

.phead {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin-top: 24px;
}
.phead .thumb-box { width: 104px; height: 120px; }
.phead .thumb { width: 104px; height: 104px; }
.phead .thumb--hex { width: 104px; height: 120px; }
.phead-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.phead h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.phead .tagline { margin: 0; font-size: 18px; line-height: 1.45; color: #333; font-weight: 300; }
.phead + .btn-row { margin-top: 28px; }

@media (max-width: 767px) {
  .phead { grid-template-columns: 64px minmax(0, 1fr); gap: 16px; align-items: start; }
  .phead .thumb-box { width: 64px; height: 74px; }
  .phead .thumb { width: 64px; height: 64px; }
  .phead .thumb--hex { width: 64px; height: 74px; }
  .phead h1 { font-size: 26px; }
  .phead .tagline { font-size: 16px; }
}

.pager {
  margin-top: 72px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}
.pager a { color: #555; text-decoration: none; padding: 8px 0; }
.pager a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Prose (rendered markdown bodies)
   -------------------------------------------------------------------------- */

.prose { margin-top: 40px; font-size: 17px; line-height: 1.68; color: var(--body); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 18px; }

/* Markdown # and ## become small ruled section labels */
.prose h1, .prose h2 {
  margin: 48px 0 18px;
  padding-top: 12px;
  border-top: 1.5px solid var(--rule-strong);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink);
}
.prose h3, .prose h4, .prose h5, .prose h6 {
  margin: 32px 0 12px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}

.prose img { display: block; margin: 8px 0 12px; }
.prose p > img:only-child,
.prose p > a:only-child > img { margin: 8px 0 4px; }

.prose ul, .prose ol { margin: 0 0 20px; padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--meta); }

/* A list whose items open with bold text ("**Point.** detail") reads as a
   ruled list of highlights rather than bullets */
.prose ul:has(> li > strong:first-child) { list-style: none; padding-left: 0; border-top: 1px solid var(--rule); }
.prose ul:has(> li > strong:first-child) > li { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 16px; line-height: 1.6; }

.prose strong { font-weight: 500; color: var(--ink); }

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}
.prose pre {
  margin: 0 0 22px;
  padding: 18px 20px;
  background: #1d1d1d !important;
  color: #ededed;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.65;
  border-radius: 0;
}
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

.prose blockquote {
  margin: 0 0 20px;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--rule);
  color: #555;
}

.prose table { border-collapse: collapse; margin: 0 0 22px; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--rule); }

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.about-photo { display: block; width: 100%; height: auto; margin-top: 32px; }
.about-body { margin-top: 36px; font-size: 17px; line-height: 1.68; color: var(--body); }
.about-body p { margin: 0 0 20px; }
.about-body > p:first-child { font-size: 26px; line-height: 1.4; font-weight: 300; color: var(--ink); }

.facts { margin-top: 52px; }
.facts .section-label { padding-top: 12px; border-top: 1.5px solid var(--rule-strong); }
.fact {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.5;
}
.fact .label { padding-top: 3px; }
.fact .yrs { color: var(--meta); }
@media (max-width: 767px) { .fact { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* --------------------------------------------------------------------------
   CV
   -------------------------------------------------------------------------- */

.cv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.cv-head h1 { margin: 8px 0 0; font-size: 34px; font-weight: 500; line-height: 1.15; }

.cv-jump { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 24px; font-size: 13px; letter-spacing: 0.08em; }
.cv-jump a { color: var(--muted); text-decoration: none; padding: 8px 0; }
.cv-jump a:hover { color: var(--accent); }

.cv-sec {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 32px;
  margin-top: 56px;
  padding-top: 12px;
  border-top: 1.5px solid var(--rule-strong);
  scroll-margin-top: 24px;
}
.cv-sec:first-of-type { margin-top: 28px; }
.cv-sec .sub { display: block; margin-top: 6px; font-size: 13px; color: var(--meta); letter-spacing: 0; text-transform: none; font-weight: 400; }

.cv-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.45;
}
.cv-line .note { display: block; margin-top: 3px; font-size: 13px; color: var(--meta); }
.yrs { font-size: 14px; color: #555; white-space: nowrap; font-variant-numeric: tabular-nums; }

.cv-entry {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.cv-entry .yr { font-size: 15px; font-weight: 300; font-variant-numeric: tabular-nums; }
.cv-entry .yr.repeat { visibility: hidden; }
.cv-entry .body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cv-entry .title { font-size: 16px; font-weight: 500; line-height: 1.4; }
.cv-entry .authors { font-size: 14px; line-height: 1.5; color: var(--muted); }
.cv-entry .authors strong { font-weight: 500; color: var(--ink); }
.cv-entry .venue-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.cv-entry .venue { font-size: 14px; color: #555; font-style: italic; }
.cv-entry .lnk { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; padding: 4px 0; }
.cv-entry .where { font-size: 14px; line-height: 1.45; color: #555; }

.cv-sw {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.cv-sw svg { width: 13px; height: 13px; fill: var(--ink); align-self: center; }
.cv-sw .name { font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; }
.cv-sw a.name:hover { color: var(--accent); }
.cv-sw .type { margin-left: 8px; font-size: 12px; color: var(--meta); letter-spacing: 0.1em; text-transform: uppercase; }
.cv-sw .desc { display: block; margin-top: 3px; font-size: 14px; line-height: 1.45; color: var(--muted); }

@media (max-width: 767px) {
  .cv-sec { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 40px; }
  .cv-entry { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-photo { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; margin-top: 32px; }

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 56px;
  margin-top: 44px;
  align-items: start;
}
@media (max-width: 767px) { .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; } }

.contact-grid h2 { margin: 0; font-size: 22px; font-weight: 500; }
.contact-who { display: flex; flex-direction: column; gap: 20px; }
.contact-who .affil { margin: 6px 0 0; font-size: 15px; line-height: 1.55; color: var(--muted); }

.reach { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.reach li { border-bottom: 1px solid var(--rule); }
.reach a {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  text-decoration: none;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.reach a .label { padding-top: 3px; }
.reach a:hover span:last-child { color: var(--accent); }

.form { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  font: inherit;
  font-size: 15px;
  background: #fff;
  border: 1px solid var(--chip-border);
  border-radius: 0;
  color: var(--ink);
}
.field input { height: 48px; padding: 0 14px; }
.field textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
