:root {
  --ink: #1f1f1d;
  --paper: #ffffff;
  --panel: #fafaf8;
  --border: #e4e2dc;
  --accent: #b30a48;
  --muted: #6e6e6e;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background-color: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Arial", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-weight: 600;
  margin: 0 0 0.6rem;
}

section {
  padding: 3.5rem 1.5rem;
  max-width: 46rem;
  margin: 0 auto;
}

section > p.lead {
  color: var(--muted);
  margin-top: -0.2rem;
  margin-bottom: 1.5rem;
}

.featured-articles {
  max-width: 52rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  position: relative;
  isolation: isolate;
}

.featured-articles::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(50% - 50vw);
  background: #f5f4ef;
}

.section-heading .eyebrow {
  margin-bottom: 0.35rem;
}

.featured-articles h2 {
  margin-bottom: 1.2rem;
  font-size: 1.35rem;
}

.article-carousel {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.article-track {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.article-slide {
  display: grid;
  grid-template-columns: minmax(9rem, 30%) 1fr;
  gap: 1.5rem;
  color: var(--ink);
  text-decoration: none;
}

.article-thumb {
  width: 100%;
  height: 100%;
  min-height: 12rem;
  object-fit: cover;
  background: var(--border);
}

.article-content {
  padding: 1.5rem 1.75rem 1.5rem 0;
}

.article-slide:hover h3 {
  color: var(--accent);
}

.article-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-slide h3 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  transition: color 0.2s ease;
}

.article-slide p {
  max-width: 38rem;
  margin: 0 0 1rem;
  color: var(--muted);
}

.article-cta {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.panel + .panel,
.panel-top {
  margin-top: 1rem;
}

button {
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
}

.btn {
  background: var(--ink);
  color: var(--paper);
  padding: 0.2rem 0.5rem;
}

.btn:hover {
  opacity: 0.85;
}

.btn-accent {
  background: var(--accent);
  color: var(--paper);
}

.btn-accent:hover {
  opacity: 0.85;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 0.2rem 0.5rem;
}

.btn-ghost:hover {
  border-color: var(--accent);
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  background: var(--paper);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* nav */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1.4rem;
  padding: 0.9rem 1.5rem;
  overflow-x: auto;
  font-size: 0.9rem;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}

nav a:hover {
  color: var(--ink);
}

/* hero */
#home {
  text-align: left;
  padding-top: 3rem;
  padding-bottom: 2.5rem;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 2rem;
  align-items: center;
  max-width: 58rem;
  margin: 0 auto;
}

.img-wrap {
  display: inline-block;
  padding-right: 4px;
}

.portfolio-favicon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

#home h1 {
  font-size: clamp(1.8rem, 4.3vw, 2.6rem);
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

#home .accent {
  color: var(--accent);
}

.hero-bio {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  margin: 0 0 1rem;
  max-width: 36rem;
}

.highlights {
  padding-left: 1.1rem;
  color: var(--ink);
  margin: 0 0 1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
}

.hero-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

#carTrigger {
  width: min(15rem, 60vw);
  height: auto;
  aspect-ratio: 1 / 1;
  margin-top: 0.2rem;
  animation: stretch 0.3s ease-in-out infinite;
  cursor: pointer;
}

@keyframes stretch {
  0%,
  100% {
    transform: scaleX(1);
  }

  25% {
    transform: scaleX(1.02);
  }

  50% {
    transform: scaleX(0.98);
  }

  75% {
    transform: scaleX(1.02);
  }
}

/* car menu */
.car-menu-wrap {
  position: relative;
  display: inline-block;
}

.car-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(18rem, 82vw);
  z-index: 5;
}

.car-menu.open {
  display: block;
}

.menu-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);
}

.menu-title {
  margin: 0 0 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  margin-bottom: 0.55rem;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.project-card strong {
  display: block;
  font-size: 0.92rem;
}

.project-card small {
  display: block;
  color: var(--muted);
  margin-top: 0.15rem;
  font-size: 0.76rem;
}

.card-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.social-links a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.82rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(31, 31, 29, 0.05);
}

.social-links a:hover {
  background: var(--border);
}

@media (max-width: 760px) {
  .hero-shell {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    justify-content: center;
  }
}

hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: 46rem;
  margin: 0 auto;
}

/* binary counter */
.byte-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.bit {
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  user-select: none;
}

.bit.on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.bit-values {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.bit-values span {
  width: 2.6rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.binary-readout {
  text-align: center;
  margin-top: 1rem;
  font-family: var(--mono);
}

.binary-readout .decimal {
  font-size: 1.8rem;
}

.binary-controls {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1rem;
}

/* notes */
.note-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.note-form textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.note-form-row {
  display: flex;
  gap: 0.6rem;
}

.note-form-row input {
  flex: 1;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.note-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.note-card h3 {
  font-size: 1rem;
}

.note-card p {
  font-size: 0.88rem;
  color: var(--ink);
  white-space: pre-wrap;
  margin: 0;
  flex: 1;
}

.note-card .row {
  display: flex;
  gap: 0.5rem;
}

.note-card button {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.8rem;
}

.shared-banner {
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}

.shared-banner .tag {
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.shared-banner h3 {
  margin-top: 0.4rem;
}

.shared-banner p {
  white-space: pre-wrap;
  margin: 0 0 0.7rem;
}

/* hanoi */
.hanoi-controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.hanoi-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.hanoi-board {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2.5rem;
  height: 11rem;
  padding: 0 1rem;
}

.peg {
  position: relative;
  width: 7rem;
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  cursor: pointer;
  border-bottom: 4px solid var(--ink);
}

.peg::before {
  content: "";
  position: absolute;
  bottom: 0;
  width: 6px;
  height: 90%;
  background: var(--border);
  border-radius: 3px;
}

.peg.selected::before {
  background: var(--accent);
}

.disc {
  position: relative;
  height: 1.15rem;
  margin-bottom: 3px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hanoi-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.9rem;
}

.hanoi-status.win {
  color: var(--accent);
  font-weight: 600;
}

/* subnetting */
.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.8rem;
}

.rule-grid .panel h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.rule-grid .panel ul,
.rule-grid .panel p {
  font-size: 0.85rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink);
}

.rule-grid .panel li {
  margin-bottom: 0.3rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
  font-family: var(--mono);
}

thead th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tbody td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.table-scroll {
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.table-scroll table thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
}

.calc-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.calc-form label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.calc-error {
  color: var(--accent);
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

.calc-results {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.7rem;
}

.calc-results div {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}

.calc-results div span.label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.calc-results div span.value {
  font-family: var(--mono);
  font-size: 0.95rem;
}

/* roblox games carousel */
.carousel {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.carousel-arrow {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  padding: 0;
}

.carousel-arrow:hover {
  border-color: var(--ink);
}

.carousel-track {
  flex: 1;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.carousel-slide {
  display: block;
  text-decoration: none;
  color: var(--ink);
}

.carousel-slide img {
  width: 100%;
  display: block;
  aspect-ratio: 500 / 280;
  object-fit: cover;
  background: var(--border);
}

.carousel-caption {
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: var(--paper);
}

.carousel-caption h3 {
  margin: 0;
  font-size: 1rem;
}

.carousel-cta {
  font-size: 0.85rem;
  color: var(--accent);
  white-space: nowrap;
}

.carousel-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.9rem;
}

.carousel-dots .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  border: 0;
  padding: 0;
}

.carousel-dots .dot.active {
  background: var(--ink);
}

/* footer */
.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

@media (max-width: 30rem) {
  .hanoi-board {
    gap: 1rem;
  }

  .peg {
    width: 5.4rem;
  }

  .carousel {
    gap: 0.5rem;
  }

  .carousel-arrow {
    width: 2rem;
    height: 2rem;
    font-size: 0.95rem;
  }

  .article-slide {
    display: block;
  }

  .article-thumb {
    height: 9rem;
    min-height: 0;
  }

  .article-content {
    padding: 1rem;
  }

  .article-meta {
    flex-direction: column;
    gap: 0.2rem;
  }
}

/* ===== about ===== */
.about-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: start;
}

.about-banner {
  width: 100%;
  height: auto;
  margin-bottom: 1.2rem;
}

.about-photo-slot {
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.about-photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-photo-placeholder {
  font-family: var(--mono);
  font-size: 1.6rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.about-bio {
  color: var(--ink);
  line-height: 1.7;
  margin: 0 0 0.9rem;
  max-width: 34rem;
}

.quick-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.9rem 1.5rem;
  margin: 1.2rem 0 0;
}

.quick-facts div {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.quick-facts dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.quick-facts dd {
  margin: 0;
  font-size: 0.92rem;
}

@media (max-width: 30rem) {
  .about-shell {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .quick-facts {
    text-align: left;
  }
}

/* ===== projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1rem;
}

.project-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.project-tile-head {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.project-tile-head h3 {
  font-size: 1rem;
  margin: 0;
}

.project-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.project-tile p {
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.project-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* ===== experience timeline ===== */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}

.timeline li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.timeline li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.timeline-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.timeline h3 {
  font-size: 0.98rem;
  margin: 0 0 0.3rem;
}

.timeline p {
  font-size: 0.88rem;
  color: var(--ink);
  margin: 0;
  line-height: 1.55;
}

@media (max-width: 30rem) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}

/* ===== skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.8rem;
}

.skills-grid .panel h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.skills-grid .panel ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--ink);
}

.skills-grid .panel li {
  margin-bottom: 0.3rem;
}

/* ===== education ===== */
.education-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.education-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.education-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.education-list h3 {
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
}

.education-list p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.education-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.cert-details summary {
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
  padding: 0.4rem 0;
}

.cert-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.cert-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.84rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.cert-list li:last-child {
  border-bottom: none;
}

.cert-date {
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== playground tabs ===== */
.playground-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.3rem;
}

.tab-btn {
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.tab-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.tab-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ===== contact ===== */
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.contact-actions a {
  text-decoration: none;
}
