:root {
  --ink: #17201c;
  --muted: #5b6761;
  --paper: #f6f2ea;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(23, 32, 28, 0.14);
  --shadow: 0 24px 70px rgba(20, 29, 25, 0.16);
  --radius: 8px;
  --content: 1120px;
}

body.dark-mode {
  --ink: #edf4ef;
  --muted: #b7c5bd;
  --paper: #101714;
  --panel: rgba(19, 28, 24, 0.88);
  --line: rgba(237, 244, 239, 0.16);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", Arial, sans-serif;
  line-height: 1.6;
}

body.lightbox-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 50;
  padding: 0.65rem 0.9rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.section {
  position: relative;
  min-height: 100vh;
  padding: 112px 28px;
  overflow: hidden;
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.74;
  pointer-events: none;
}

.section-inner {
  position: relative;
  z-index: 1;
  width: min(100%, var(--content));
  margin: 0 auto;
}

.biome-hero {
  background: #e9eee7;
}

body.dark-mode .biome-hero {
  background: #111b17;
}

.biome-hero::before {
  background:
    radial-gradient(circle at 14% 20%, rgba(68, 119, 103, 0.17), transparent 30%),
    linear-gradient(135deg, rgba(30, 50, 46, 0.08) 0 1px, transparent 1px 24px),
    linear-gradient(45deg, rgba(30, 50, 46, 0.05) 0 1px, transparent 1px 28px);
}

.biome-experience {
  background: #eef1ec;
}

body.dark-mode .biome-experience {
  background: #101916;
}

.biome-experience::before {
  background:
    linear-gradient(90deg, rgba(37, 82, 70, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(37, 82, 70, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 80% 10%, rgba(95, 132, 125, 0.18), transparent 28%);
  background-size: 34px 34px, 34px 34px, auto;
}

.biome-projects {
  background: #e8e3d7;
}

body.dark-mode .biome-projects {
  background: #1b1711;
}

.biome-projects::before {
  background:
    linear-gradient(90deg, rgba(59, 53, 42, 0.15) 2px, transparent 2px),
    linear-gradient(0deg, rgba(59, 53, 42, 0.09) 2px, transparent 2px),
    radial-gradient(circle at 18% 22%, rgba(140, 103, 61, 0.18), transparent 26%),
    repeating-linear-gradient(135deg, rgba(92, 82, 61, 0.08) 0 2px, transparent 2px 28px);
  background-size: 78px 78px, 78px 78px, auto, auto;
}

.biome-education {
  background: #e9edf3;
}

body.dark-mode .biome-education {
  background: #111923;
}

.biome-education::before {
  background:
    linear-gradient(120deg, rgba(36, 78, 112, 0.1) 0 1px, transparent 1px 38px),
    radial-gradient(circle at 78% 20%, rgba(59, 107, 145, 0.18), transparent 32%),
    repeating-linear-gradient(0deg, rgba(30, 50, 80, 0.06) 0 1px, transparent 1px 18px);
}

.biome-hobbies {
  background: #ece7df;
}

body.dark-mode .biome-hobbies {
  background: #1a1713;
}

.biome-hobbies::before {
  background:
    repeating-linear-gradient(135deg, rgba(93, 75, 57, 0.08) 0 2px, transparent 2px 18px),
    radial-gradient(circle at 74% 26%, rgba(87, 105, 94, 0.16), transparent 30%);
}

.biome-skills {
  background: #e7edf0;
}

body.dark-mode .biome-skills {
  background: #101a1f;
}

.biome-skills::before {
  background:
    linear-gradient(120deg, rgba(31, 80, 101, 0.1) 0 1px, transparent 1px 36px),
    linear-gradient(30deg, rgba(31, 80, 101, 0.08) 0 1px, transparent 1px 42px);
}

.biome-contact {
  background: #efece4;
}

body.dark-mode .biome-contact {
  background: #191712;
}

.biome-contact::before {
  background:
    radial-gradient(circle at 50% 18%, rgba(122, 103, 70, 0.18), transparent 34%),
    linear-gradient(90deg, rgba(67, 56, 39, 0.06), transparent 45%, rgba(67, 56, 39, 0.06));
}

.section-rail {
  position: fixed;
  left: 20px;
  top: 50%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  transform: translateY(-50%);
}

.theme-toggle {
  position: fixed;
  left: 22px;
  top: calc(50% + 188px);
  z-index: 21;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: #17201c;
  cursor: pointer;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 12px 40px rgba(20, 29, 25, 0.14);
}

.theme-toggle-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #17201c;
  box-shadow: inset -4px -2px 0 rgba(255, 255, 255, 0.95);
}

body.dark-mode .theme-toggle {
  background: rgba(19, 28, 24, 0.9);
  color: #edf4ef;
}

body.dark-mode .theme-toggle-icon {
  background: #f5d36b;
  box-shadow: 0 0 0 3px rgba(245, 211, 107, 0.18);
}

.rail-link {
  position: relative;
  display: grid;
  min-width: 126px;
  min-height: 26px;
  padding-left: 20px;
  color: rgba(23, 32, 28, 0.58);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.72rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0;
  place-items: center start;
  transition: color 180ms ease, min-height 180ms ease, transform 180ms ease;
}

body.dark-mode .rail-link {
  color: rgba(237, 244, 239, 0.6);
}

.rail-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.55);
}

.rail-link.is-active {
  min-height: 56px;
  color: #17201c;
  transform: translateX(6px);
}

body.dark-mode .rail-link.is-active {
  color: #edf4ef;
}

.rail-link.is-active::before {
  width: 12px;
  height: 12px;
  background: #17201c;
}

body.dark-mode .rail-link.is-active::before {
  background: #edf4ef;
}

.hero-single {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 224px);
}

.eyebrow,
.kicker {
  margin: 0 0 0.75rem;
  color: #386255;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-eyebrow {
  margin-bottom: 1rem;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  max-width: 850px;
  font-size: clamp(3.3rem, 10vw, 8.2rem);
}

h2 {
  font-size: clamp(2.25rem, 6vw, 4.8rem);
}

h3 {
  font-size: clamp(1.35rem, 2.5vw, 2.1rem);
}

p {
  margin: 0;
}

.hero-role {
  margin-top: 0.9rem;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 700;
}

.hero-intro {
  max-width: 720px;
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.7rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(23, 32, 28, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: #17201c;
  color: #ffffff;
}

body.dark-mode .button {
  background: rgba(19, 28, 24, 0.74);
  color: #edf4ef;
}

body.dark-mode .button.primary {
  background: #edf4ef;
  color: #101714;
}

.button.linkedin {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #ffffff;
}

.button.youtube {
  background: #ff0033;
  border-color: #ff0033;
  color: #ffffff;
}

.feature-block,
.project-card,
.skill-panel,
.contact-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.section-heading {
  max-width: 820px;
  margin-bottom: 34px;
}

.section-heading p {
  max-width: 700px;
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.lead-copy,
.link-note {
  margin-top: 1rem;
  color: #26312d;
}

.link-note a {
  color: #0a66c2;
  font-weight: 700;
}

.timeline,
.project-stack {
  display: grid;
  gap: 22px;
}

.feature-block,
.project-card {
  padding: clamp(1rem, 2.2vw, 1.65rem);
}

.block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.block-header p,
.project-copy p {
  color: var(--muted);
}

.project-copy p + p {
  margin-top: 0.8rem;
}

.compact-list {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding-left: 1.15rem;
  color: #26312d;
}

body.dark-mode .compact-list,
body.dark-mode .lead-copy,
body.dark-mode .link-note,
body.dark-mode .skill-panel p {
  color: #d4ded8;
}

.expand-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(23, 32, 28, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

body.dark-mode .expand-button,
body.dark-mode .gallery-control {
  background: rgba(19, 28, 24, 0.76);
  color: #edf4ef;
}

.expandable {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  overflow: hidden;
  transition: grid-template-rows 220ms ease, opacity 220ms ease, margin-top 220ms ease;
}

.expandable > * {
  min-height: 0;
  overflow: hidden;
}

.feature-block.is-expanded .expandable {
  grid-template-rows: 1fr;
  margin-top: 1rem;
  opacity: 1;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 24px;
  align-items: center;
}

.text-only-card {
  display: block;
}

.project-card.pcb {
  background: rgba(244, 250, 246, 0.91);
  order: 1;
}

body.dark-mode .project-card.pcb {
  background: rgba(17, 31, 25, 0.91);
}

.project-card.robotics,
.project-card.printing {
  background: rgba(247, 243, 238, 0.91);
}

body.dark-mode .project-card.robotics,
body.dark-mode .project-card.printing {
  background: rgba(31, 25, 19, 0.91);
}

.project-card.robotics {
  order: 2;
}

.project-card.aquatic {
  order: 3;
}

.project-card.aquatic,
.project-card.farm,
.project-card.hobby-wide {
  background: rgba(238, 249, 239, 0.9);
}

body.dark-mode .project-card.aquatic,
body.dark-mode .project-card.farm,
body.dark-mode .project-card.hobby-wide {
  background: rgba(17, 31, 22, 0.9);
}

.project-card.farm {
  order: 4;
}

.project-card.repair,
.project-card.school,
.project-card.fsae {
  background: rgba(238, 244, 248, 0.92);
}

body.dark-mode .project-card.repair,
body.dark-mode .project-card.school,
body.dark-mode .project-card.fsae {
  background: rgba(17, 25, 34, 0.92);
}

.project-card.repair {
  order: 5;
}

.project-card.printing {
  order: 6;
}

.project-card.teaching {
  background: rgba(245, 245, 250, 0.92);
  order: 7;
}

body.dark-mode .project-card.teaching {
  background: rgba(23, 23, 34, 0.92);
}

.drawing-section-card {
  grid-template-columns: minmax(130px, 0.22fr) minmax(0, 1.78fr);
}

.drawing-section-card .project-copy {
  align-self: start;
}

.project-copy p:not(.kicker) {
  margin-top: 1rem;
}

.media-gallery {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.gallery-track {
  display: grid;
  grid-auto-columns: minmax(320px, 88%);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.media-card,
.video-card,
.youtube-embed-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 340px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  place-items: center;
  scroll-snap-align: center;
  text-align: center;
}

.youtube-embed-card {
  background: #0f1311;
  align-content: start;
}

.youtube-embed {
  display: block;
  width: 100%;
  height: 340px;
  border: 0;
  border-radius: var(--radius);
}

.drawing-gallery .gallery-track {
  grid-auto-columns: minmax(520px, 58%);
}

.media-card img {
  width: 100%;
  height: 340px;
  object-fit: contain;
  object-position: center;
  padding: 0;
  opacity: 0;
  transition: opacity 220ms ease;
}

.media-card img.is-loaded {
  opacity: 1;
}

.tight-fit img {
  object-fit: contain;
  transform: scale(1.45);
}

.caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  max-height: 46%;
  overflow: auto;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
  background: rgba(15, 19, 17, 0.74);
  color: #ffffff;
  font-size: 0.78rem;
  text-align: left;
}

.drawing-card {
  min-height: 520px;
}

.drawing-card img {
  height: 520px;
}

.drawing-card .caption {
  max-height: 38%;
}

.single-media .media-card {
  min-height: 420px;
}

.single-media .media-card img {
  height: 420px;
}

.aquarium-entry h4 {
  margin: 1rem 0 0.7rem;
  font-size: 1.05rem;
}

.aquarium-entry h4 span {
  margin-left: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.gallery-control {
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(23, 32, 28, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.6rem;
  place-items: center;
}

.local-video {
  display: block;
  width: 100%;
  max-height: 520px;
  margin-top: 14px;
  border: 1px solid rgba(23, 32, 28, 0.18);
  border-radius: var(--radius);
  background: #111;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.single-video {
  margin-top: 14px;
  grid-template-columns: 1fr;
}

.video-card {
  background:
    linear-gradient(135deg, rgba(14, 31, 38, 0.86), rgba(48, 81, 88, 0.66)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px);
}

.video-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0f1311;
}

.video-card {
  isolation: isolate;
}

.video-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.24);
}

.play-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 82px;
  height: 58px;
  border-radius: 14px;
  background: #ff0033;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  place-items: center;
}

.play-icon::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 21px solid #ffffff;
}

.video-card > span:not(.play-icon) {
  position: relative;
  z-index: 1;
  max-width: 86%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.58);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.8rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.skill-panel {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  padding: 16px;
}

.skill-panel h3 {
  margin-bottom: 0.2rem;
  font-size: 1.2rem;
}

.skill-panel p {
  color: #35423d;
}

.contact {
  min-height: 72vh;
  display: grid;
  align-items: center;
}

.contact-panel {
  padding: clamp(1.5rem, 4vw, 3rem);
}

.contact-panel p {
  max-width: 720px;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  padding: 32px;
  background: rgba(13, 18, 16, 0.9);
}

.lightbox.is-open {
  display: grid;
  place-items: center;
}

.lightbox-content {
  width: min(100%, 1180px);
  max-height: 88vh;
}

.lightbox-frame {
  display: grid;
  gap: 12px;
}

.lightbox-content img,
.lightbox-content iframe {
  display: block;
  width: 100%;
  height: min(74vh, 700px);
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  object-fit: contain;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 48px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
  font-size: 2rem;
  place-items: center;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-caption {
  max-height: 16vh;
  overflow: auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-weight: 600;
}

.youtube-link-panel {
  display: grid;
  min-height: min(64vh, 520px);
  border-radius: var(--radius);
  background: #ff0033;
  color: #ffffff;
  font-size: clamp(1.4rem, 4vw, 2.5rem);
  font-weight: 800;
  place-items: center;
  text-align: center;
  text-decoration: none;
}

.lightbox-close {
  position: absolute;
  right: 24px;
  top: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
}

@media (max-width: 980px) {
  .section {
    padding: 86px 20px;
  }

  .section-rail {
    left: 50%;
    top: auto;
    bottom: 12px;
    flex-direction: row;
    width: min(calc(100% - 24px), 650px);
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 16px 50px rgba(20, 29, 25, 0.16);
    transform: translateX(-50%);
    overflow-x: auto;
  }

  body.dark-mode .section-rail {
    background: rgba(19, 28, 24, 0.94);
    border-color: rgba(237, 244, 239, 0.18);
  }

  .theme-toggle {
    left: auto;
    right: 12px;
    top: auto;
    bottom: 64px;
  }

  .rail-link {
    min-width: auto;
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .rail-link::before {
    display: none;
  }

  .rail-link.is-active {
    min-height: 34px;
    border-radius: var(--radius);
    background: #17201c;
    color: #ffffff;
    transform: none;
  }

  body.dark-mode .rail-link.is-active {
    background: #edf4ef;
    color: #101714;
  }

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

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .section {
    padding: 72px 16px 96px;
  }

  .block-header {
    display: grid;
  }

  .media-gallery {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .gallery-control {
    width: 36px;
    height: 36px;
  }

  .gallery-track {
    grid-auto-columns: 100%;
  }

  .video-grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .media-card,
  .video-card,
  .youtube-embed-card {
    min-height: 240px;
  }

  .youtube-embed {
    height: 240px;
  }

  .media-card img {
    height: 260px;
  }

  .drawing-card img {
    height: 360px;
  }

  .drawing-gallery .gallery-track {
    grid-auto-columns: 100%;
  }

  .lightbox {
    padding: 18px;
  }
}
