@font-face {
  font-family: 'Berkeley Mono';
  src: url('public/fonts/BerkeleyMonoVariable.otf') format('opentype');
}

* {
  font-family: 'Berkeley Mono', monospace;
  font-size: 12px;
}

:root {
  /* Mint ticker + magenta accents; links = classic blue */
  --bg: #f5f4ef;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --accent: #ec4899;
  /* Richer than original #a7f3d0 — still mint, less pastel */
  --ticker-bg: #6ee7b7;
  --ticker-fg: var(--text);

  --header-height: 200px;
  /*
    Content width: half the viewport on large windows, but does not keep shrinking as a pure
    50vw would. Below --content-lock-viewport-width, the max width floors at half of that value
    (e.g. 960px at 1920 reference) until the window is narrower, then min(100%, …) follows the viewport.
  */
  --content-lock-viewport-width: 1920px;
  --content-max-width: min(
    100%,
    max(50vw, calc(0.5 * var(--content-lock-viewport-width)))
  );
  /* Matches .thesis-panel-inner body column; project cards use the same lock */
  --thesis-content-max-width: 42rem;
  /* Same inset from the top of each full-height section as thesis (projects matches this) */
  --section-pad-top: 10rem;
  --section-pad-bottom: 3rem;
  --section-pad-inline: 2rem;
}

html {
  scroll-padding-top: var(--header-height);
  overflow-anchor: none;
}

body {
  position: relative;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  overflow-anchor: none;
}

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

a:hover {
  color: var(--link-hover);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  padding-top: 0.35rem;
}

.header-content {
  margin-top: 2rem;
  margin-left: 0;
  margin-right: auto;
  padding: 1rem 2rem;
  max-width: var(--content-max-width);
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.header-brand-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  width: 100%;
}

@media (max-width: 768px) {
  :root {
    --content-max-width: 95vw;
  }

  .header-content {
    padding-left: 1rem;
    padding-right: max(0.35rem, env(safe-area-inset-right, 0px));
  }

  .header-brand-row {
    align-items: flex-start;
    position: relative;
    z-index: 1;
  }

  .section-nav--desktop {
    display: none;
  }

  .section-nav-mobile {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
}

.section-nav {
  margin-bottom: 0;
}

.section-nav--desktop {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
}

.section-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.section-nav-mobile {
  flex-shrink: 0;
  align-self: flex-start;
  position: relative;
}

@media (min-width: 769px) {
  .section-nav-mobile {
    display: none;
  }
}

.section-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.35rem 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.section-nav-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.section-nav-toggle-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 1.5rem;
  pointer-events: none;
}

.section-nav-toggle-bars span {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 1px;
}

.section-nav-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin: 0.2rem 0 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: right;
  z-index: 2;
}

.section-nav-dropdown-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.section-nav-dropdown-nav a {
  text-underline-offset: 2px;
}

.section-nav a {
  text-underline-offset: 2px;
}

.section-nav-sep {
  opacity: 0.45;
  user-select: none;
}

.site-meta {
  font-size: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: default;
}

.site-meta-accent {
  color: var(--accent);
}

.site-meta-muted {
  color: var(--text-muted);
  font-size: 9px;
}

.site-meta-muted #copyright-year {
  font-size: inherit;
}

.main {
  padding-top: var(--header-height);
}

.main-secondary {
  box-sizing: border-box;
  max-width: var(--content-max-width);
  width: 100%;
  margin-left: 0;
  margin-right: auto;
  padding-bottom: var(--projects-end-pad, 0px);
}

.projects-section {
  box-sizing: border-box;
  padding: 2.5rem var(--section-pad-inline) max(8rem, var(--section-pad-bottom));
  max-width: var(--content-max-width);
  width: 100%;
  margin-left: 0;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.investors-section {
  box-sizing: border-box;
  padding: 2.5rem var(--section-pad-inline) var(--section-pad-bottom);
  max-width: var(--content-max-width);
  width: 100%;
  margin-left: 0;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.investors-block {
  width: 100%;
  max-width: var(--thesis-content-max-width);
  box-sizing: border-box;
}

.investors-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.investors-intro {
  width: 100%;
  margin-bottom: 2rem;
}

.investors-heading {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}

.projects-intro,
.thesis-intro {
  width: 100%;
  margin-bottom: 2rem;
}

.projects-heading,
.thesis-heading {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}

.thesis-section {
  display: flex;
  flex-direction: column;
  padding: var(--section-pad-top) var(--section-pad-inline) max(8rem, var(--section-pad-bottom));
  box-sizing: border-box;
  max-width: var(--content-max-width);
  width: 100%;
  margin-left: 0;
  margin-right: auto;
}

.thesis-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.thesis-panels {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  align-items: stretch;
}

.thesis-panel {
  position: relative;
  box-sizing: border-box;
  padding: 0 0 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  opacity: 0.38;
  transition: opacity 0.35s ease;
}

.thesis-panel--active {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .thesis-panel {
    transition: opacity 0.15s ease;
  }
}

.thesis-panel-inner {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--thesis-content-max-width);
  margin-left: 0;
  margin-right: auto;
  text-align: left;
  box-sizing: border-box;
}

.thesis-panel-inner--split {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: clamp(2rem, 5vw, 5.5rem);
  /* Use full thesis column width so body stays at --thesis-content-max-width and notes sit to the right, not sharing one row’s width. */
  max-width: none;
  width: 100%;
}

.thesis-panel-inner--split .thesis-panel-main {
  flex: 0 0 auto;
  width: var(--thesis-content-max-width);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.thesis-panel-notes {
  flex: 0 1 var(--thesis-content-max-width);
  min-width: 0;
  max-width: var(--thesis-content-max-width);
  /* Absorb leftover row width so the notes column hugs the right edge of the thesis column. */
  margin-left: auto;
  position: sticky;
  top: calc(var(--header-height) + 0.75rem);
}

/* Wide layout: hide footnotes on inactive panels. Narrow: footnotes stay in flow — only opacity fades (see below). */
@media (min-width: 52.0625rem) {
  .thesis-panel:not(.thesis-panel--active) .thesis-panel-notes {
    display: none;
  }
}

@media (max-width: 52rem) {
  /* Extra vertical rhythm between stacked sections */
  .thesis-panels {
    gap: 3.75rem;
  }

  .thesis-panel {
    padding-bottom: 5rem;
  }

  .thesis-panel-inner--split {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
  }

  .thesis-panel-inner--split .thesis-panel-main {
    width: 100%;
  }

  .thesis-panel-inner--split .thesis-panel-notes {
    flex-basis: auto;
    width: 100%;
    max-width: none;
    margin-left: 0;
    align-self: stretch;
    position: static;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    /* Always occupies layout height; inactive panels fade out without collapsing */
    display: block;
    transition: opacity 0.35s ease;
  }

  .thesis-panel:not(.thesis-panel--active) .thesis-panel-notes {
    opacity: 0;
    pointer-events: none;
  }

  .thesis-panel--active .thesis-panel-notes {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 52rem) and (prefers-reduced-motion: reduce) {
  .thesis-panel-inner--split .thesis-panel-notes {
    transition: opacity 0.15s ease;
  }
}

.thesis-panel-heading {
  margin: 0 0 1.25rem;
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
}

.thesis-panel-body {
  flex: 0 1 auto;
}

.thesis-panel-body p {
  margin: 0 0 1rem;
  max-width: 100%;
}

.thesis-panel-body p:last-child {
  margin-bottom: 0;
}

.thesis-fn-ref {
  font-size: 0.68em;
  font-weight: inherit;
  line-height: 1;
  vertical-align: super;
  position: relative;
  top: -0.02em;
  color: var(--accent);
}

.thesis-footnotes {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-muted);
  counter-reset: thesis-fn;
  width: 100%;
  box-sizing: border-box;
}

.thesis-footnotes li {
  margin: 0 0 0.65rem;
  padding: 0;
  position: relative;
  padding-left: 1.35rem;
}

.thesis-footnotes li::before {
  content: counter(thesis-fn) '.';
  counter-increment: thesis-fn;
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.thesis-fn-year {
  color: var(--accent);
}

.scroll-hint {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 40;
  margin: 0;
  padding: 0 0 max(1rem, env(safe-area-inset-bottom, 0px)) 2rem;
  font-size: 8px;
  color: var(--text-muted);
  line-height: 1;
  pointer-events: none;
}

.scroll-hint-arrow {
  display: inline-block;
  font-size: 1.5rem;
  line-height: 1;
  will-change: transform;
  animation: scroll-hint-bounce 1.4s ease-in-out infinite;
}

@keyframes scroll-hint-bounce {
  0%,
  100% {
    transform: translateY(-5px);
  }
  50% {
    transform: translateY(5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint-arrow {
    animation: none;
  }
}

.projects-block {
  width: 100%;
}

.projects-inner {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--thesis-content-max-width);
  box-sizing: border-box;
}

::selection {
  background: rgba(37, 99, 235, 0.2);
  color: var(--text);
}

.site-meta a {
  align-self: flex-start;
  cursor: pointer;
  margin-top: 6px;
}

.site-title-row {
  cursor: default;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.site-title-mark {
  /* Whole px size — calc(1.5rem + 1px) often lands on half-pixels and blurs emoji + fallback glyphs */
  font-size: 25px;
  line-height: 1;
  display: inline-block;
  flex-shrink: 0;
}

.site-title-row h5 {
  margin: 0;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 400;
  /* Crisper edges in fixed header: grayscale AA + no legibility pass on tiny type */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

.card-wrap {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.card-under {
  position: absolute;
  inset: 0;
  background: var(--accent);
}

.card-wrap .card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid #000;
  color: var(--text);
  text-decoration: none;
  box-sizing: border-box;
  /* Explicit resting transform so WebKit (esp. iOS) interpolates instead of snapping */
  transform: translate(0, 0);
  transition: transform 100ms ease-in-out;
}

.card-wrap .card:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-title {
  margin: 0;
}

.card-desc {
  margin: 0;
  font-size: 11px;
  max-width: 100%;
  color: var(--text-muted);
}

.card-arrow {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text);
}

.card-wrap:hover .card,
.card-wrap:active .card {
  transform: translate(6px, -6px);
}

.ticker {
  width: 100%;
  overflow: hidden;
  background: var(--ticker-bg);
  padding: 1rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

.ticker-track {
  display: flex;
  flex-shrink: 0;
  width: max-content;
  gap: 0 3rem;
  animation: ticker-scroll 66s linear infinite;
}

.ticker-segment {
  flex-shrink: 0;
  white-space: nowrap;
  color: var(--ticker-fg);
}

@keyframes ticker-scroll {
  to {
    transform: translateX(-50%);
  }
}

html.dark-mode {
  color-scheme: dark;
  --bg: #0c0c0c;
  --surface: #171717;
  --border: #3f3f46;
  --text: #e8e8e8;
  --text-muted: #a3a3a3;
  --link: #60a5fa;
  --link-hover: #93c5fd;
  --accent: #f472b6;
  --ticker-bg: #34d399;
  --ticker-fg: #0f172a;
}

html.dark-mode body {
  background: var(--bg);
  color: var(--text);
}

html.dark-mode .site-header {
  background: var(--bg);
}

html.dark-mode .card-wrap .card {
  background: var(--surface);
  border-color: #e5e5e5;
  color: var(--text);
}
