/* Shared site styling — black-and-white, with a centered, sticky top navigation. */
:root {
  --max-width: 1100px;
  --background: #000;
  --surface: #000;
  --text: #fff;
  --muted: #fff;
  --border: #505050;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--background);
  line-height: 1.6;
}
a { color: inherit; }
a:focus-visible { outline: 2px solid #fff; outline-offset: 5px; }

/* The navigation remains at the top of the window while you scroll. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #000;
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--max-width);
  min-height: 72px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 4vw, 3.5rem);
}
.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.98rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] { border-bottom-color: #fff; }

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}
.hero, .section { margin-bottom: 4rem; }
.hero h1, h1 {
  margin-top: 0;
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 1.05;
}
h2 { margin-top: 0; }
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .8rem;
}
.social-links {
  display: flex;
  flex-direction: row;
  gap: .6rem;
  margin-top: 1.25rem;
}
.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  transition: border-color .15s ease;
}
.social-links a:hover,
.social-links a:focus-visible {
  border-color: #fff;
  outline: none;
}
.placeholder {
  border: 1px dashed var(--border);
  background: var(--surface);
  padding: 1.25rem;
  color: var(--text);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card {
  display: block;
  min-height: 180px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: #000;
  text-decoration: none;
}
.card:hover { border-color: #fff; }
.card p { color: var(--muted); }
.entry { padding: 1.5rem 0; border-top: 1px solid var(--border); }
.entry:first-child { border-top: 0; }
.entry-meta { color: var(--muted); margin-top: -.75rem; }

/* Experience page: tabs + timeline */
.tabs-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-bottom: 3rem;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
}
.tab-button {
  appearance: none;
  border: 1px solid var(--border);
  background: #000;
  color: #fff;
  padding: .4rem .9rem;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.tab-button:hover,
.tab-button:focus-visible,
.tab-button.is-active { border-color: #fff; }
.tab-button.is-active { background: #fff; color: #000; }
.tab-button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.timeline {
  --meta-width: 270px;
  position: relative;
  display: grid;
  grid-template-columns: var(--meta-width) 1fr;
  column-gap: 1.5rem;
  row-gap: 3rem;
}
.timeline[hidden] { display: none; }
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--meta-width) + .75rem);
  width: 1px;
  background: var(--border);
}
.timeline-entry { display: contents; }
.timeline-meta { text-align: right; }
.timeline-meta h2 { margin: 0; font-size: 1.3rem; white-space: nowrap; }
.timeline-location,
.timeline-dates { margin: .4rem 0 0; color: var(--muted); font-size: .85rem; }
.timeline-content h3 { margin: 0; font-weight: 400; font-size: 1.15rem; }
.timeline-content p { margin: .65rem 0 0; color: var(--muted); }
.timeline-content ul {
  list-style: none;
  margin: .65rem 0 0;
  padding: 0;
  color: var(--muted);
}
.timeline-content li {
  margin-top: .4rem;
  padding-left: 1.1rem;
  text-indent: -1.1rem;
}
.timeline-content li:first-child { margin-top: 0; }
.timeline-content li::before {
  content: "\2022";
  display: inline-block;
  width: 1.1rem;
  text-indent: 0;
  color: #fff;
  font-size: 1.3em;
  line-height: 1;
  vertical-align: -0.06em;
}

/* Tab panels cross-fade (see src/tabs.ts). */
.timeline[data-panel] { transition: opacity .16s ease, transform .16s ease; }
.timeline[data-panel].is-leaving { opacity: 0; transform: translateY(4px); }
.timeline[data-panel].is-entering { opacity: 0; transform: translateY(-4px); transition: none; }

/* Experience block: title + summary, click to unfold the bullet points. */
.exp-card {
  align-self: start;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  background: #000;
  transition: border-color .15s ease;
}
.exp-card:hover,
.exp-card:focus-within,
.exp-card.is-open { border-color: #fff; }
.exp-card[data-expandable] { cursor: pointer; }
.timeline-content.exp-card h3 { font-size: 1.15rem; }
.exp-toggle {
  appearance: none;
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}
.exp-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.exp-chevron { flex: none; transition: transform .25s ease; }
[data-expandable].is-open > :is(h2, h3) .exp-chevron { transform: rotate(180deg); }
.timeline-content .exp-summary { margin-top: .5rem; }

/* Height animates between 0fr and 1fr, so the unfolded size needs no JS. */
.exp-details {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .3s ease, visibility 0s linear .3s;
}
[data-expandable].is-open > .exp-details {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .3s ease, visibility 0s;
}
.exp-details-inner { overflow: hidden; min-height: 0; }
.exp-details-inner > ul { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.timeline.no-rail::before { display: none; }

@media (max-width: 700px) {
  .timeline { grid-template-columns: 1fr; row-gap: 2rem; }
  .timeline::before { display: none; }
  .timeline-meta { text-align: left; }
  .timeline-meta h2 { white-space: normal; }
}
@media (max-width: 500px) {
  .filters-row { justify-content: center; }
}
.site-footer { border-top: 1px solid var(--border); background: #000; }
.site-footer > div {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem;
  color: var(--text);
}
@media (max-width: 600px) {
  main { padding-top: 2rem; }
  .nav { min-height: 64px; }
  .nav-links { gap: .7rem 1.2rem; }
  .nav-links a { font-size: .91rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .timeline[data-panel],
  .exp-card,
  .exp-chevron,
  .exp-details { transition: none; }
}

/* Smooth page-to-page navigation (cross-document view transitions). The
   header gets its own name so it stays put while the page content fades. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .2s; }

/* Project filtering page */
.project-hero { margin-bottom: 2rem; }
.filters {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.filter-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}
.filter-button {
  appearance: none;
  border: 1px solid var(--border);
  background: #000;
  color: #fff;
  padding: .2rem .5rem;
  font: inherit;
  font-size: .72rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}
.filter-button:hover,
.filter-button:focus-visible,
.filter-button.is-active {
  border-color: #fff;
}
.filter-button.is-active {
  background: #fff;
  color: #000;
}
.filter-button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Always occupies its space (via visibility, not display) so it showing up
   or going away never shifts anything else in the row. Works no matter how
   many .filter-button items are added later, since it doesn't participate
   in their layout at all. */
.filter-clear {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: .72rem;
  color: #999;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  visibility: hidden;
}
.filter-clear.is-visible { visibility: visible; }
.filter-clear:hover,
.filter-clear:focus-visible { color: #fff; }
.filter-clear:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.filter-item[hidden] { display: none; }
.project-card {
  border: 1px solid var(--border);
  background: #000;
  overflow: hidden;
  transition: border-color .15s ease;
  order: var(--order, 0);
}
.project-card:hover,
.project-card:focus-within { border-color: #fff; }
.project-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.project-card-link:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.project-card-top {
  display: flex;
  min-height: 240px;
}
.project-card-content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}
.project-card-image {
  flex: 0 0 42%;
  width: 42%;
  object-fit: cover;
}
.project-card-image[hidden] { display: none; }
.project-card h2 {
  margin: 1rem 0 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}
.project-summary {
  margin: .65rem 0 0;
  color: var(--muted);
}
.tech-stack {
  margin-top: .75rem;
  color: #999;
  font-size: .82rem;
}
.tech-stack span:not(:first-child)::before {
  content: "\00b7";
  margin: 0 .55rem;
  color: var(--border);
  font-size: 1.4em;
  vertical-align: -0.08em;
}
.project-links {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
}
.project-links a {
  display: inline-flex;
}
.project-links img { display: block; }
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.project-tags span {
  border: 1px solid var(--border);
  padding: .2rem .5rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.no-results {
  padding: 2rem 0;
  color: var(--muted);
}

@media (max-width: 600px) {
  .project-card-top { flex-direction: column; }
  .project-card-image { width: 100%; flex: 0 0 160px; }
}

.architecture-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 1.5rem 0;
}

.arch-node {
  width: min(100%, 520px);
  padding: 14px 18px;
  border: 1px solid currentColor;
  border-radius: 8px;
  text-align: center;
}

.arch-node strong {
  display: block;
  margin-bottom: 4px;
}

.arch-node span {
  font-size: 0.85rem;
  opacity: 0.7;
}

.arch-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.arch-arrow span {
  font-size: 0.75rem;
  opacity: 0.65;
}

.arch-fpga {
  width: min(100%, 700px);
}

.fpga-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.fpga-pipeline span {
  padding: 6px 9px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 0.8rem;
  opacity: 1;
}
/* Blog listing and article pages */
.blog-entry { margin-bottom: 1rem; }
.blog-entry-link {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: #000;
  text-decoration: none;
  transition: border-color .15s ease;
}
.blog-entry-link:hover,
.blog-entry-link:focus-visible { border-color: #fff; }
.blog-entry-link:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.blog-read-more { text-decoration: underline; text-underline-offset: 3px; }
.blog-article { max-width: 780px; }
.blog-back-link { display: inline-block; margin-bottom: 2rem; }
.blog-article .section h2:not(:first-child) { margin-top: 2rem; }
.nav-links a[aria-current="location"] { border-bottom-color: #fff; }
.blog-tags { margin-top: 1.25rem; }

/* Project write-up pages: divider-separated, click-to-expand sections with
   optional nested sub-expansions. Animation is shared with .exp-details. */
.project-links[hidden] { display: none; }
.project-links { margin-top: 1.25rem; }
.proj-section { border-top: 1px solid var(--border); }
.proj-section:last-of-type { border-bottom: 1px solid var(--border); }
.proj-section > h2,
.proj-sub > h3 { margin: 0; }
.proj-section > h2 { font-size: 1.4rem; }
.proj-sub > h3 { font-size: 1.05rem; font-weight: 400; }
.proj-section > h2 .exp-toggle { padding: 1rem 0; }
.proj-sub > h3 .exp-toggle { padding: .7rem 0; }
.proj-body { padding: 0 0 1.25rem; }
.proj-body > :first-child { margin-top: 0; }
.proj-body p { margin: 0 0 .75rem; color: var(--muted); }
.proj-body ul { margin: 0 0 .75rem; padding-left: 1.25rem; }
.proj-subhead { margin: 1.25rem 0 .5rem; font-size: 1.05rem; }
.proj-sub { margin-left: 1rem; border-left: 1px solid var(--border); padding-left: 1rem; }
.proj-sub + .proj-sub { margin-top: .25rem; }
