/* ---------------------------------------------------------------------------
   Theme tokens

   The drawing sheet. Everything here comes from engineering drafting: a cool
   grey table (--paper), lighter sheets laid on it (--sheet), graphite ink, and
   hairline construction lines. One accent only — --marker, a teal marker pen
   for marking a drawing up. It is reserved for links, the current nav item, and
   the tick corners that appear when you hover a sheet.

   Type is JetBrains Mono everywhere, so hierarchy comes from size, weight,
   tracking, and case rather than a second family. Structural labels are
   lowercase; nothing is set in tracked-out caps.
   ------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --paper: #eceeef;
  --sheet: #f7f8f8;
  --sheet-sunk: #e3e6e8;

  --graphite: #23282c;
  --pencil: #5b656c;
  --pencil-soft: #79838a;

  --construction: #c3c9cc;
  --construction-strong: #a7b0b5;

  --marker: #33879b;
  --marker-hover: #286d7d;
  /* Text in the accent color. --marker itself is 3.6:1 on --paper, fine for
     rules and ticks (3:1) but short of AA for body-size text (4.5:1). */
  --marker-text: #2c7586;
  --marker-text-hover: #1f5a68;
  --marker-wash: rgba(51, 135, 155, 0.13);

  --grid-line: rgba(35, 40, 44, 0.042);
  --grid-line-minor: rgba(35, 40, 44, 0.026);
  --grid-step: 26px;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  /* Reading face, used only for long project prose. Everything structural —
     nav, cards, labels, headings, code — stays mono. */
  --serif: "Source Serif 4", Charter, Georgia, serif;

  /* Aliases kept so MDX project bodies and any scoped styles that still speak
     the old token names keep rendering. New work should use the names above. */
  --bg: var(--paper);
  --surface: var(--sheet);
  --surface-2: var(--sheet-sunk);
  --border: var(--construction);
  --border-strong: var(--construction-strong);
  --ink: var(--graphite);
  --text: var(--graphite);
  --text-soft: #3b444a;
  --text-muted: var(--pencil);
  --text-dim: var(--pencil);
  --text-faint: var(--pencil-soft);
  --accent: var(--marker);
  --accent-hover: var(--marker-hover);
  --accent-soft: var(--marker-wash);
  --coral: var(--marker);

  --code-bg: var(--sheet-sunk);
  --code-text: var(--graphite);
  --code-border: var(--construction);
}

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

html {
  height: 100%;
  background-color: var(--paper);
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text-soft);
  background-color: var(--paper);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.7;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
}

aside,
main,
nav,
section,
article {
  display: block;
}

img {
  max-width: 100%;
  border: 0;
  vertical-align: middle;
  display: inline-block;
}

.w-inline-block {
  max-width: 100%;
  display: inline-block;
}

/* ---------------------------------------------------------------------------
   The ground: a true isometric construction grid — three line families at
   30deg, 150deg, and vertical. It sits behind everything, fixed, so the page
   reads as sheets moving across a drafting table.
   ------------------------------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      30deg,
      transparent 0 calc(var(--grid-step) - 1px),
      var(--grid-line) calc(var(--grid-step) - 1px) var(--grid-step)
    ),
    repeating-linear-gradient(
      150deg,
      transparent 0 calc(var(--grid-step) - 1px),
      var(--grid-line) calc(var(--grid-step) - 1px) var(--grid-step)
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(var(--grid-step) - 1px),
      var(--grid-line-minor) calc(var(--grid-step) - 1px) var(--grid-step)
    );
}

/* Alternative ground, kept for later: a cutting mat. 26px squares, a heavier
   line every fifth, and ruler ticks along the top and left edges (short every
   26px, long every 130px). To use it, swap these declarations into
   body::before above in place of its background-image.

  background-image:
    linear-gradient(90deg, rgba(35, 40, 44, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 40, 44, 0.18) 1px, transparent 1px),
    linear-gradient(180deg, rgba(35, 40, 44, 0.18) 1px, transparent 1px),
    linear-gradient(180deg, rgba(35, 40, 44, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 40, 44, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(35, 40, 44, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 40, 44, 0.024) 1px, transparent 1px),
    linear-gradient(180deg, rgba(35, 40, 44, 0.024) 1px, transparent 1px);
  background-size:
    26px 6px, 130px 12px,
    6px 26px, 12px 130px,
    130px 130px, 130px 130px,
    26px 26px, 26px 26px;
  background-repeat:
    repeat-x, repeat-x,
    repeat-y, repeat-y,
    repeat, repeat,
    repeat, repeat;
  background-position: 0 0;
*/

.content {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
}

/* ---------------------------------------------------------------------------
   Typography
   ------------------------------------------------------------------------- */
h1 {
  color: var(--graphite);
  font-size: clamp(34px, 5.2vw, 46px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.14;
  margin: 0 0 20px;
}

h3 {
  color: var(--graphite);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.5;
  margin: 0 0 12px;
}

h4 {
  color: var(--graphite);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
  margin: 0;
}

p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  margin: 0 0 12px;
}

ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

/* Inline links: graphite with a hairline marker underline, the way a drawing
   gets marked up. Standalone arrow links override this to marker text. */
a {
  color: var(--graphite);
  text-decoration: underline;
  text-decoration-color: var(--marker);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.15s ease, text-decoration-thickness 0.15s ease;
}

a:hover {
  color: var(--marker-text);
  text-decoration-thickness: 2px;
}

::selection {
  color: var(--graphite);
  background-color: var(--marker-wash);
}

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

/* ---------------------------------------------------------------------------
   Title block — the fixed nav. Flat sheet, hairline border, square corners.
   ------------------------------------------------------------------------- */
.top-nav {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: calc(100% - 32px);
  max-width: 700px;
  padding: 7px 8px 7px 10px;
  background-color: rgba(247, 248, 248, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--construction);
}

.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.top-nav-brand:hover {
  color: inherit;
}

.top-nav-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--construction);
  border-radius: 0;
}

.top-nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.top-nav-name {
  color: var(--graphite);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.top-nav-role {
  color: var(--pencil-soft);
  font-size: 11px;
}

.top-nav-links {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.top-nav-link {
  position: relative;
  color: var(--pencil);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  padding: 6px 11px;
  transition: color 0.15s ease;
}

.top-nav-link:hover {
  color: var(--graphite);
}

/* The current page is marked, not highlighted — a rule under the label. */
.top-nav-link.is-current {
  color: var(--graphite);
  font-weight: 600;
}

.top-nav-link.is-current::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 2px;
  height: 1px;
  background-color: var(--marker);
}

/* Below 560px the single row has to buy back space to keep the wordmark on
   one line; below 400px it stops fitting at all and the block stacks — which
   is what a real title block does when the fields run out of room. */
@media (max-width: 560px) {
  .top-nav {
    padding: 6px 6px 6px 8px;
    gap: 10px;
  }

  .top-nav-role {
    display: none;
  }

  .top-nav-avatar {
    width: 24px;
    height: 24px;
  }

  .top-nav-name {
    font-size: 12px;
  }

  .top-nav-link {
    padding: 4px 6px;
    font-size: 11px;
  }

  .top-nav-link.is-current::after {
    left: 6px;
    right: 6px;
  }
}

@media (max-width: 400px) {
  .top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    width: calc(100% - 24px);
  }

  .top-nav-brand {
    padding: 6px 9px;
    border-bottom: 1px solid var(--construction);
  }

  .top-nav-links {
    justify-content: space-between;
    padding: 3px 3px;
  }

  .top-nav-link {
    padding: 5px 7px;
    font-size: 12px;
  }

  .top-nav-link.is-current::after {
    left: 7px;
    right: 7px;
  }

  .main {
    padding-top: 128px;
  }
}

/* ---------------------------------------------------------------------------
   Page frame
   ------------------------------------------------------------------------- */
.main {
  width: 100%;
  min-height: 100vh;
  background-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 112px 48px 96px;
}

.container {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.content-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.items-container {
  flex-direction: column;
}

/* Prose measure: 640px of JetBrains Mono is roughly 66 characters. */
.lead {
  max-width: 640px;
  color: var(--graphite);
  margin-bottom: 0;
}

.fold-content {
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   Sheets — project cards, patent cards. Flat, square, hairline. The tick
   corners sit outside the border like crop marks and go marker teal on hover.
   ------------------------------------------------------------------------- */
.project-card,
.patent-card {
  position: relative;
  text-decoration: none;
  background-color: var(--sheet);
  border: 1px solid var(--construction);
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.project-card::before,
.project-card::after,
.patent-card::before,
.patent-card::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 0 solid var(--construction-strong);
  transition: border-color 0.18s ease;
}

.project-card::before,
.patent-card::before {
  top: -4px;
  left: -4px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.project-card::after,
.patent-card::after {
  bottom: -4px;
  right: -4px;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

.project-card:hover,
.patent-card:hover {
  border-color: var(--graphite);
  background-color: var(--sheet);
  color: inherit;
}

.project-card:hover::before,
.project-card:hover::after,
.patent-card:hover::before,
.patent-card:hover::after {
  border-color: var(--marker);
}

/* Home page sections */
.home-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-section h3 {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--pencil);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  margin-bottom: 0;
  white-space: nowrap;
}

.home-section h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--construction);
}

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* Renders and drawings have white backgrounds; keep an edge between the
   image and the sheet. */
.project-card-image-container {
  overflow: hidden;
  border-bottom: 1px solid var(--construction);
}

.project-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  filter: saturate(0.82);
  transition: filter 0.25s ease;
}

.project-card:hover .project-card-image {
  filter: none;
}

.project-card-info {
  padding: 13px 15px 15px;
}

.project-card-info h4 {
  margin-bottom: 5px;
}

.project-card-summary {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 0;
}

/* Mini labels: a field name on a drawing. */
.mini-label-white {
  color: var(--pencil-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: lowercase;
  line-height: 1.6;
  margin-top: 28px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--construction);
}

/* Discipline grid (used by long-form project bodies) */
.discipline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}

.discipline {
  border: 1px solid var(--construction);
  padding: 16px;
}

.discipline .mini-label-white {
  margin-top: 0;
}

.discipline-desc {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
   Back nav — a leader line pointing off the sheet.
   ------------------------------------------------------------------------- */
.back-nav-container {
  display: flex;
  align-items: center;
  color: var(--pencil);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: lowercase;
  padding-bottom: 0;
}

.back-nav-img {
  width: 12px;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.back-nav-button {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pencil);
  background-color: transparent;
  border-radius: 0;
  margin-left: -8px;
  padding: 6px 8px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-nav-button:hover {
  color: var(--graphite);
  background-color: transparent;
}

.back-nav-button:hover .back-nav-img {
  opacity: 1;
}

/* ---------------------------------------------------------------------------
   Patents
   ------------------------------------------------------------------------- */
.patent-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.patent-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 20px;
}

.patent-thumbnail {
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  overflow: hidden;
  background-color: #ffffff;
  border: 1px solid var(--construction);
}

.patent-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.patent-content {
  flex: 1;
  min-width: 0;
}

.patent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.patent-status {
  color: var(--pencil);
  background-color: transparent;
  border: 1px solid var(--construction);
  border-radius: 0;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 17px;
  text-transform: lowercase;
}

.patent-status-granted {
  color: var(--sheet);
  background-color: var(--graphite);
  border-color: var(--graphite);
}

.patent-number {
  color: var(--pencil-soft);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.patent-title {
  color: var(--graphite);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.5;
  margin: 0 0 7px;
}

.patent-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
  margin: 0;
}

.patent-also {
  color: var(--pencil-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   Standalone arrow links ("Get in touch →"): marker teal, no underline until hover.
   ------------------------------------------------------------------------- */
.arrow-link {
  color: var(--marker-text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.arrow-link:hover {
  color: var(--marker-text-hover);
  background-color: transparent;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* ---------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media screen and (max-width: 991px) {
  .content {
    flex-direction: column;
  }
}

@media screen and (max-width: 767px) {
  .main {
    padding: 104px 22px 72px;
  }

  .container {
    gap: 44px;
  }

  .patent-card {
    flex-direction: column;
    gap: 14px;
  }

  .patent-thumbnail {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
