:root {
  --color-page: #f3f0e8;
  --color-surface: #f3f0e8;
  --color-surface-muted: #f3f0e8;
  --color-nav: #f3f0e8;
  --color-method-tag: #f3f0e8;
  --color-border: #171717;
  --color-text: #171717;
  --color-text-muted: #4b4a45;
  --color-heading: #0b0b0b;
  --color-accent: #171717;
  --color-link: #171717;
  --color-link-hover: #171717;
  --color-button: #171717;
  --color-button-hover: #3b3a37;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--color-page);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  margin: 0;
  min-height: 100vh;
}

::selection {
  background: var(--color-text);
  color: var(--color-page);
}

main {
  flex: 1;
}

a {
  text-underline-offset: 0.2em;
}

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

/* One continuous canvas */
header,
footer,
main > section,
.archive-card,
.archive-card-muted,
.archive-tag,
.archive-method-tag,
.pdf-frame,
.resume-frame {
  background: var(--color-page) !important;
}

/* Square geometry throughout */
.rounded,
.rounded-md,
.rounded-lg,
.overflow-hidden.rounded-md {
  border-radius: 0 !important;
}

.shadow-sm {
  box-shadow: none !important;
}

/* Navigation */
body > header {
  border-color: var(--color-border) !important;
  border-top: 5px solid var(--color-text);
}

body > header nav {
  min-height: 5rem;
}

body > header nav > a:first-child {
  color: var(--color-heading);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

body > header nav > div {
  gap: 0.25rem;
}

body > header nav > div a {
  color: var(--color-text-muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 0.5rem 0.65rem;
  text-decoration: none;
  text-transform: uppercase;
}

body > header nav > div a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

body > header nav > div a.font-semibold {
  border-bottom: 2px solid var(--color-text);
  color: var(--color-text);
}

/* Type hierarchy */
.hero-heading,
.archive-heading {
  color: var(--color-heading);
}

.hero-heading {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2.45rem, 4.25vw, 3.9rem) !important;
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 0.98 !important;
  max-width: 60rem;
  text-wrap: balance;
}

.archive-heading {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 750 !important;
  letter-spacing: 0;
  line-height: 1.05;
}

.archive-title {
  color: var(--color-heading);
}

.archive-muted {
  color: var(--color-text-muted);
}

.archive-accent {
  color: var(--color-accent);
}

p.text-sm.leading-6 {
  font-size: 0.96rem;
  line-height: 1.65rem;
}

p.text-lg.leading-8 {
  font-size: 1.16rem;
  line-height: 1.9rem;
}

/* Labels carry the restrained editorial character */
.uppercase,
.archive-accent.uppercase {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

main > section:first-child > p:first-child,
main > article:first-child > p.uppercase {
  align-items: center;
  display: flex;
}

main > section:first-child > p:first-child::before,
main > article:first-child > p.uppercase::before {
  background: var(--color-text);
  content: "";
  height: 0.55rem;
  margin-right: 0.65rem;
  width: 0.55rem;
}

/* Links and controls */
.archive-link {
  color: var(--color-link);
  text-decoration: underline;
}

.archive-link:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

a.rounded-md:not(.project-graphic) {
  border: 1px solid var(--color-text) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

a.rounded-md:not(.project-graphic):hover {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

/* Ruled sections and flat cards */
main > section {
  border-color: var(--color-border) !important;
}

.archive-card,
.archive-card-muted {
  border: 1px solid var(--color-border);
}

.skill-stack > .archive-card:last-child {
  flex: 1;
}

#projects-list > article h3 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

#projects-list > article > .archive-muted {
  color: var(--color-text);
  line-height: 1.7;
}

.project-archive-row {
  padding-block: 1.15rem;
}

.project-archive-heading {
  display: block;
}

.project-archive-cta {
  flex-shrink: 0;
}

.project-archive-side {
  align-items: flex-end;
  display: flex;
  float: right;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 0.75rem 1.5rem;
  width: min(18rem, 38%);
}

.project-archive-thumbnail {
  aspect-ratio: 16 / 9;
  border: 1px solid var(--color-border);
  display: block;
  overflow: hidden;
  width: 100%;
}

.project-archive-thumbnail img {
  filter: grayscale(1) contrast(1.04);
  height: 100%;
  mix-blend-mode: multiply;
  object-fit: contain;
  width: 100%;
}

.project-graphic {
  aspect-ratio: 16 / 9;
  border: 0;
  margin-bottom: 1rem;
}

.project-graphic img {
  filter: grayscale(1) contrast(1.04);
  mix-blend-mode: multiply;
  transition: filter 160ms ease;
}

.project-graphic:hover img {
  filter: grayscale(0) contrast(1);
}

.project-graphic-placeholder {
  color: var(--color-text-muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-tag,
.archive-method-tag {
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.archive-method-tag {
  border-style: dashed;
}

.project-copy p {
  text-wrap: pretty;
}

/* Project archive details */
.writing-panel summary,
.detail-panel summary {
  cursor: pointer;
  list-style: none;
}

.writing-panel summary::-webkit-details-marker,
.detail-panel summary::-webkit-details-marker {
  display: none;
}

.writing-panel summary::after,
.detail-panel summary::after {
  color: var(--color-text);
  content: "+";
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
}

.writing-panel[open] summary::after,
.detail-panel[open] summary::after {
  content: "−";
}

.detail-panel {
  box-shadow: none !important;
}

.detail-panel > div {
  border-color: var(--color-border) !important;
}

.project-detail-flow::after {
  clear: both;
  content: "";
  display: block;
}

.project-meta-card {
  float: right;
  margin: 0 0 1rem 1.5rem;
  width: min(24rem, 42%);
}

/* Essays */
.essay-body {
  max-width: 48rem;
}

.essay-body-wide {
  max-width: none;
}

.essay-body p {
  color: var(--color-text);
  font-size: 1.08rem;
  line-height: 1.85;
  margin-top: 1.25rem;
}

.essay-body h2 {
  color: var(--color-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2rem;
}

.essay-body h3 {
  color: var(--color-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.75rem;
}

.essay-body ul {
  color: var(--color-text);
  font-size: 1.08rem;
  line-height: 1.75;
  list-style: disc;
  margin: 1.5rem 0 0;
  padding-left: 1.5rem;
}

.essay-body li + li {
  margin-top: 0.75rem;
}

.project-figure {
  border: 1px solid var(--color-border);
  margin-bottom: 2rem;
  padding: 0.75rem;
}

.project-figure img {
  display: block;
  height: auto;
}

.project-figure-wrap {
  clear: right;
  float: right;
  margin: 0.5rem 0 1.5rem 2rem;
  width: min(28rem, 48%);
}

.project-figure figcaption {
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
}

.project-table-wrap {
  overflow-x: auto;
}

.project-metrics-table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  width: 100%;
}

.project-metrics-table caption {
  color: var(--color-heading);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding-bottom: 0.75rem;
  text-align: left;
  text-transform: uppercase;
}

.project-metrics-table th,
.project-metrics-table td {
  border: 1px solid var(--color-border);
  padding: 0.65rem 0.8rem;
  text-align: left;
}

.project-metrics-table thead th {
  background: var(--color-text);
  color: var(--color-page);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.project-metrics-table tbody th {
  font-weight: 600;
}

main > article aside.archive-card {
  border-left: 5px solid var(--color-text) !important;
}

/* Embedded documents */
.pdf-frame {
  border: 1px solid var(--color-border);
  min-height: 32rem;
  width: 100%;
}

.resume-frame {
  border: 1px solid var(--color-border);
  min-height: 42rem;
  width: 100%;
}

/* Footer remains part of the same page canvas */
body > footer {
  border-color: var(--color-border) !important;
}

@media (max-width: 767px) {
  body > header nav {
    align-items: flex-start !important;
    flex-direction: column;
    gap: 0.75rem;
  }

  body > header nav > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  body > header nav > div a {
    border: 1px solid var(--color-border);
    text-align: center;
  }

  .hero-heading {
    font-size: clamp(2.2rem, 9.5vw, 3.15rem) !important;
    line-height: 1 !important;
  }

  .project-meta-card {
    float: none;
    margin: 0 0 1.5rem;
    width: auto;
  }

  .project-figure-wrap {
    float: none;
    margin: 1.5rem 0;
    width: 100%;
  }

  .project-archive-heading {
    display: block;
  }

  .project-archive-side {
    margin-left: 1rem;
    width: min(11rem, 42%);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .project-graphic img {
    transition: none;
  }
}
