
/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --paper: #f3ecdf;
  --ink: #1a1a1a;
  --body: #2f2d29;
  --soft-text: #7a746b;
  --muted-text: #928a7e;
  --faint-text: #9f9689;
  --rule: #bfae99;
  --soft-rule: #cbbba6;
  --glow-rgb: 113, 96, 73;
}

/* Relative sizing gives desktop the preferred 125% scale at normal browser zoom. */
html {
  font-size: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Libre Baskerville', Baskerville, serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: calc(100vh + 1px);
}

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 8.125rem 1fr;
  max-width: 51.25rem;
  margin: 0 auto;
  padding: 5.5rem 2.5rem 8.75rem;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 5.5rem;
  height: fit-content;
  align-self: start;
  padding-right: 1.75rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar a {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 calc(100% - 0.25rem);
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
  display: flex;
  width: fit-content;
  align-items: center;
  min-height: 1.75rem;
  gap: 0.375rem;
}

.sidebar a:hover,
.sidebar a:focus-visible,
.sidebar a.active {
  color: var(--ink);
}

.contact-nav a:hover,
.contact-nav a:focus-visible {
  background-size: 100% 1px;
}

/* Section marker and contact links */
.section-nav {
  position: relative;
}

.section-nav a {
  position: relative;
}

.section-nav a.active::before {
  display: none;
}

.moving-nav-dot {
  position: absolute;
  width: 0.3125rem;
  height: 0.3125rem;
  border-radius: 50%;
  background: var(--ink);
  pointer-events: none;
  z-index: 2;
  will-change: transform;
  top: 0;
  left: 0;
}

@keyframes linkRecoilLeft {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(-0.1875rem); }
  100% { transform: translateX(0); }
}

.recoil-left {
  animation: linkRecoilLeft 0.34s cubic-bezier(0.33, 1, 0.68, 1);
}

.contact-nav {
  margin-top: 1.5rem;
}

.contact-nav span {
  font-size: 0.625rem;
}

.sidebar a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 0.25rem;
}

/* ── Main content ── */
main {
  padding-left: 3.5rem;
}

/* ── Intro ── */
.intro {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.intro.hidden {
  display: none;
}

.intro h1 {
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.01875rem;
  margin-bottom: 0.3125rem;
  line-height: 1.25;
}

.intro .subtitle {
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--muted-text);
  line-height: 1.35;
}

/* ── Lorenz Attractor ── */
.lorenz-widget {
  position: absolute;
  bottom: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3125rem;
  user-select: none;
  cursor: default;
}

.lorenz-canvas {
  width: 3.75rem;
  height: 3.75rem;
  display: block;
}

.lorenz-caption {
  font-size: 0.625rem;
  font-style: italic;
  color: var(--muted-text);
  letter-spacing: 0.02em;
  line-height: 1.35;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.lorenz-widget:hover .lorenz-caption {
  color: var(--ink);
}

/* ── Sections ── */
section {
  display: none;
}

section.active {
  display: block;
}

/* ── View transition crossfade (Josh Bradley style) ── */
main {
  view-transition-name: crossfade;
}

@keyframes hide {
  from { opacity: 1; filter: blur(0); }
  to   { opacity: 0; filter: blur(0.25rem); }
}

@keyframes appear {
  from { opacity: 0; filter: blur(0.25rem); }
  to   { opacity: 1; filter: blur(0); }
}

@supports (view-transition-name: none) {
  @media not (prefers-reduced-motion: reduce) {
    ::view-transition-old(crossfade) {
      animation: 0.4s cubic-bezier(0.6, 0, 0.8, 1) forwards hide;
    }
    ::view-transition-new(crossfade) {
      opacity: 0;
      animation: 0.6s ease 0.2s forwards appear;
    }
  }
}

/* ── Section label ── */
.section-label {
  font-size: 0.625rem;
  font-style: italic;
  color: var(--faint-text);
  margin-bottom: 1.375rem;
}

button.section-label {
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 0;
}

/* ── About ── */
.about-text {
  font-size: 0.8125rem;
  line-height: 1.85;
  color: var(--body);
  margin-bottom: 0.75rem;
}

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.about-list li {
  font-size: 0.8125rem;
  line-height: 1.75;
  color: var(--soft-text);
  padding-left: 1rem;
  position: relative;
}

.about-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--faint-text);
}

/* ── Writing ── */
.writing-item {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
  color: inherit;
  font: inherit;
  text-align: left;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    radial-gradient(
      3.125rem circle at var(--x, 50%) var(--y, 50%),
      rgba(var(--glow-rgb), var(--glow, 0)),
      transparent 100%
    ) border-box,
    linear-gradient(var(--soft-rule), var(--soft-rule)) border-box;
  overflow: hidden;
  cursor: pointer;
}

.writing-item:last-child {
  margin-bottom: 0;
}

.writing-content {
  padding: 1.125rem 1.25rem 1.25rem;
}

.writing-title {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.5625rem;
}

.writing-desc {
  font-size: 0.75rem;
  line-height: 1.75;
  color: var(--soft-text);
}

.writing-list.hidden {
  display: none;
}

.writing-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: default;
  transition: color 0.2s;
}

.writing-back.active {
  cursor: pointer;
}

.writing-back.active:hover {
  color: var(--ink);
}

.writing-back-arrow {
  display: none;
  font-style: normal;
  line-height: 1;
}

.writing-back.active .writing-back-arrow {
  display: inline;
}

.writing-reader {
  display: none;
  border: 1px solid var(--soft-rule);
  border-radius: 0.25rem;
  padding: 1.625rem 1.75rem 1.875rem;
}

.writing-reader.open {
  display: block;
}

.writing-full {
  display: none;
}

.writing-full.active {
  display: block;
}

.writing-full-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.writing-full-title {
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}

.writing-full-date {
  font-size: 0.625rem;
  font-style: italic;
  color: var(--faint-text);
  line-height: 1.7;
  white-space: nowrap;
}

.writing-full p {
  font-size: 0.8125rem;
  line-height: 1.85;
  color: var(--body);
  margin-bottom: 0.875rem;
}

.writing-full p:last-child {
  margin-bottom: 0;
}

/* ── Section header ── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.375rem;
}

.section-header .section-label {
  margin-bottom: 0 !important;
}

.resume-link {
  font-size: 0.625rem;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
}

.resume-link:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

/* ── Experience ── */
.exp-item {
  border: 1px solid transparent;
  border-radius: 0.1875rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    radial-gradient(
      3.125rem circle at var(--x, 50%) var(--y, 50%),
      rgba(var(--glow-rgb), var(--glow, 0)),
      transparent 100%
    ) border-box,
    linear-gradient(var(--soft-rule), var(--soft-rule)) border-box;
}

.exp-item:last-child { margin-bottom: 0; }

.exp-summary {
  padding: 0.875rem 1.125rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.exp-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.exp-company {
  font-size: 0.8125rem;
  font-weight: 400;
}

.exp-role {
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--muted-text);
}

.exp-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.625rem;
  flex-shrink: 0;
}

.exp-date {
  font-size: 0.6875rem;
  color: var(--faint-text);
  white-space: nowrap;
}

.exp-plus {
  font-size: 1rem;
  color: var(--faint-text);
  line-height: 1;
  transition: transform 0.25s ease, color 0.2s;
}

.exp-item.open .exp-plus {
  transform: rotate(45deg);
  color: var(--ink);
}

.exp-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s ease;
  width: 100%;
}

.exp-item.open .exp-body {
  grid-template-rows: 1fr;
}

.exp-inner {
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.exp-desc {
  padding: 0.75rem 1.125rem 1rem;
  font-size: 0.75rem;
  color: var(--soft-text);
  line-height: 1.75;
  border-top: 1px solid var(--soft-rule);
  opacity: 0;
  transition: opacity 0.4s ease 0.15s;
}

.exp-item.open .exp-desc {
  opacity: 1;
}

/* ── Education ── */
.edu-item { margin-bottom: 1.5rem; }
.edu-item:last-child { margin-bottom: 0; }

.edu-school {
  font-size: 0.8125rem;
  font-weight: 400;
  margin-bottom: 0.25rem;
}

.edu-detail {
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--muted-text);
  line-height: 1.7;
}

/* ── Projects ── */
.proj-item {
  display: block;
  border: 1px solid var(--soft-rule);
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.2s;
}

.proj-item:last-child { margin-bottom: 0; }

.proj-item:hover { border-color: var(--muted-text); }

.proj-item-featured {
  position: relative;
}

.proj-primary-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.proj-image {
  display: block;
  width: 100%;
  height: 11.25rem;
  object-fit: cover;
  border-bottom: 1px solid var(--soft-rule);
  filter: sepia(18%) saturate(70%) contrast(92%) brightness(98%);
  mix-blend-mode: multiply;
  opacity: 0.9;
}

.proj-content {
  padding: 1.25rem 1.375rem 1.375rem;
}

.proj-title {
  font-size: 0.8125rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.proj-desc {
  font-size: 0.75rem;
  color: var(--soft-text);
  line-height: 1.75;
}

.proj-recognition,
.recent-project-recognition {
  margin-top: 0.5rem;
  font-size: 0.625rem;
  font-style: italic;
  color: var(--muted-text);
  line-height: 1.75;
}

/* ── About highlights ── */
.about-highlights {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 2rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--soft-rule);
}

.github-contrib,
.recent-project {
  display: grid;
  grid-template-rows: auto minmax(5.875rem, auto) auto;
  align-content: start;
  min-width: 0;
}

.github-contrib-label,
.recent-project-label {
  display: inline-block;
  font-size: 0.625rem;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  margin-bottom: 0.875rem;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
}

.github-contrib-label:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

.github-contrib-label {
  justify-self: start;
}

.github-contrib-chart {
  min-height: 5.875rem;
}

.github-contrib-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 0.5625rem);
  grid-auto-columns: 0.5625rem;
  gap: 0.1875rem;
}

.github-contrib-day {
  width: 0.5625rem;
  height: 0.5625rem;
  border-radius: 0.125rem;
  border: 1px solid rgba(var(--glow-rgb), 0.12);
  background: #d2c4b2;
  cursor: default;
  transition: transform 0.15s ease, outline-color 0.15s ease;
}

.github-contrib-day[data-level="1"] { background: #a99172; }
.github-contrib-day[data-level="2"] { background: #83684b; }
.github-contrib-day[data-level="3"] { background: #65482f; }
.github-contrib-day[data-level="4"] { background: #3f2c1d; }

.github-contrib-day:hover,
.github-contrib-day:focus {
  outline: 1px solid var(--ink);
  outline-offset: 0.125rem;
  transform: scale(1.25);
}

.github-contrib-status,
.github-contrib-stats {
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--muted-text);
  line-height: 1.7;
}

.github-contrib-stats {
  margin-top: 0.75rem;
}

.recent-project-title {
  font-size: 0.75rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.recent-project-meta {
  justify-self: start;
  margin-top: 0.9375rem;
  font-size: 0.625rem;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
}

.recent-project-meta:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

/* ── Local time ── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.colon { animation: blink 1s step-end infinite; }
.local-time {
  position: fixed;
  bottom: 2rem;
  left: 2.5rem;
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--muted-text);
}


/* ── Responsive ── */
@media (min-width: 801px) {
  html {
    font-size: 125%;
  }
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 3rem 1.5rem 6.25rem;
  }

  .sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
    padding-bottom: 1.75rem;
    margin-bottom: 2.75rem;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 1.25rem;
  }

  .contact-nav {
    margin-top: 0.5rem;
  }

  .section-nav a.active::before,
  .moving-nav-dot {
    display: none;
  }

  main {
    padding-left: 0;
  }

  .local-time {
    display: none;
  }

  .lorenz-canvas {
    width: 3rem;
    height: 3rem;
  }

  .about-highlights {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}
