@font-face {
  font-family: "Solar Display";
  src: url("assets/fonts/russell-square.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: light;
  --paper: #f6e7cd;
  --paper-light: #fff4df;
  --ink: #17130e;
  --muted-ink: #554a3b;
  --accent: #d95716;
  --line: rgba(69, 45, 20, 0.15);
  --soft-shadow: 0 12px 30px rgba(74, 42, 12, 0.08);
  --font-display: "Solar Display", RussellSquare, "Russell Square", sans-serif;
  --font-body: Seravek, "Gill Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: #f6debf;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.site-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100svh;
  overflow: hidden;
}

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.45rem, 3vw, 2.65rem) clamp(1.4rem, 3.5vw, 3.7rem) 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  padding-top: 0.2rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.065em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-mark {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  border: 1px solid rgba(23, 19, 14, 0.2);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(74, 42, 12, 0.08);
}

.brand:focus-visible,
.projects-menu summary:focus-visible,
.projects-popover a:focus-visible,
.home-footer a:focus-visible {
  outline: 3px solid rgba(217, 87, 22, 0.42);
  outline-offset: 4px;
}

.projects-menu {
  position: relative;
  width: min(100%, 17rem);
  color: var(--accent);
}

.projects-menu summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  min-height: 2rem;
  cursor: pointer;
  font-size: clamp(0.92rem, 1.35vw, 1.25rem);
  font-weight: 600;
  list-style: none;
  white-space: nowrap;
}

.projects-menu summary::-webkit-details-marker {
  display: none;
}

.projects-menu summary::after {
  width: 0.52rem;
  height: 0.52rem;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  content: "";
  transform: translateY(-0.15rem) rotate(45deg);
  transition: transform 160ms ease;
}

.projects-menu:not([open]) summary::after {
  transform: translateY(0.12rem) rotate(-45deg);
}

.projects-popover {
  margin-top: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(255, 247, 230, 0.82);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(10px);
}

.projects-popover a {
  display: block;
  padding: 1.15rem 1.4rem;
  color: var(--ink);
  font-size: clamp(0.9rem, 1.1vw, 1.05rem);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.projects-popover a:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.28);
}

.project-placeholder {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: baseline;
  column-gap: 0.25em;
  row-gap: 0.55rem;
  padding: 1.15rem 1.4rem;
  border-top: 1px solid rgba(69, 45, 20, 0.1);
  color: rgba(48, 40, 31, 0.68);
  background: repeating-linear-gradient(
    135deg,
    rgba(69, 45, 20, 0.025) 0,
    rgba(69, 45, 20, 0.025) 5px,
    rgba(255, 255, 255, 0.13) 5px,
    rgba(255, 255, 255, 0.13) 10px
  );
  box-shadow: inset 3px 0 0 rgba(69, 45, 20, 0.12);
  font-size: clamp(0.9rem, 1.1vw, 1.05rem);
  line-height: 1.2;
  text-align: center;
  cursor: default;
}

.project-placeholder::after {
  grid-column: 1 / -1;
  justify-self: center;
  padding: 0.25rem 0.45rem 0.22rem;
  border-radius: 2px;
  color: #ffe45c;
  background: #111;
  content: "PAGE UNDER CONSTRUCTION";
  font-family: var(--font-body);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1;
  white-space: nowrap;
}

.project-placeholder > span {
  min-width: 0;
  font: inherit;
}

.project-placeholder small {
  color: inherit;
  font: inherit;
  white-space: nowrap;
}

.project-placeholder small::before {
  content: "(";
}

.project-placeholder small::after {
  content: ")";
}

.home-page {
  background:
    radial-gradient(circle at 70% 20%, rgba(255, 244, 223, 0.72), transparent 34rem),
    #f6debf;
}

.home-shell {
  display: block;
  overflow: visible;
}

.home-header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  align-items: center;
  padding: 1rem clamp(1.4rem, 3vw, 3rem) 0.95rem;
  border-bottom: 1px solid rgba(23, 19, 14, 0.52);
  background: rgba(246, 222, 191, 0.88);
  box-shadow: 0 10px 30px rgba(23, 19, 14, 0.05);
  backdrop-filter: blur(12px);
}

.home-header .brand {
  padding-top: 0;
}

.home-header .projects-menu {
  width: min(100%, 18rem);
}

.home-header .projects-popover {
  position: absolute;
  top: calc(100% + 1.05rem);
  right: 0;
  width: 18rem;
  margin: 0;
  max-height: calc(100svh - 6rem);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(23, 19, 14, 0.28);
  border-radius: 0.45rem;
  background: rgba(255, 244, 223, 0.94);
  box-shadow: 0 14px 34px rgba(23, 19, 14, 0.16);
  backdrop-filter: blur(16px);
}

.home-header .projects-popover a {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 3.31rem;
  padding: 0.78rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: center;
  transition: color 160ms ease, background-color 160ms ease;
}

.home-header .projects-popover a:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.32);
}

.home-header .project-placeholder {
  min-height: 3.31rem;
  padding: 0.78rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: center;
}

.home-layout {
  position: relative;
  display: block;
  min-height: 100svh;
  padding: 0;
  overflow: hidden;
}

.lab-splash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

.lab-splash::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(23, 19, 14, 0.02) 45%,
    rgba(23, 19, 14, 0.16) 100%
  );
  content: "";
  pointer-events: none;
}

.lab-splash img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  object-position: center;
  box-shadow: none;
}

.identity-card {
  position: absolute;
  right: clamp(1.4rem, 3vw, 3rem);
  bottom: clamp(3.25rem, 6vh, 5.5rem);
  z-index: 1;
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  align-items: center;
  gap: 1.4rem;
  width: min(42vw, 40rem);
  padding: 1rem;
  border: 1px solid rgba(23, 19, 14, 0.38);
  border-radius: 0.18rem;
  background: rgba(246, 222, 191, 0.94);
  box-shadow: 0 12px 30px rgba(74, 42, 12, 0.065);
  backdrop-filter: blur(12px);
}

.portrait {
  display: block;
  width: 10.5rem;
  height: 10.5rem;
  border-radius: 0.28rem;
  object-fit: cover;
  object-position: 50% 28%;
}

.identity-copy {
  align-self: center;
  min-width: 0;
}

.identity-copy h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.1vw, 2.05rem);
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1;
}

.identity-copy h2::after {
  display: inline-block;
  width: 0.34em;
  height: 0.12em;
  margin-left: 0.28em;
  border-radius: 999px;
  background: var(--accent);
  content: "";
  vertical-align: 0.14em;
}

.title-list {
  display: grid;
  gap: 0.48rem;
  margin: 0;
  padding: 0;
  color: #30281f;
  font-size: clamp(0.72rem, 0.9vw, 0.88rem);
  font-weight: 500;
  line-height: 1.3;
  list-style: none;
}

.title-list li {
  margin: 0;
  padding: 0;
  font: inherit;
}

.home-footer {
  display: grid;
  grid-template-columns: minmax(18rem, 1.6fr) repeat(6, minmax(max-content, 0.55fr));
  align-items: stretch;
  min-height: 4.35rem;
  padding-inline: clamp(1.4rem, 3vw, 3rem);
  border-top: 1px solid rgba(23, 19, 14, 0.52);
  color: #30281f;
  font-size: clamp(0.65rem, 0.78vw, 0.75rem);
  font-weight: 560;
  line-height: 1.25;
  background: #f6debf;
}

.home-footer > * {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.8rem 1.2rem;
  border-left: 1px solid rgba(23, 19, 14, 0.28);
  text-align: center;
}

.home-footer > :first-child {
  justify-content: flex-start;
  padding-left: 0;
  border-left: 0;
  text-align: left;
}

.home-footer a {
  text-decoration: none;
  transition: color 160ms ease;
}

.home-footer a:hover {
  color: var(--accent);
}

.visitor-counter {
  gap: 0.55rem;
  white-space: nowrap;
}

.visitor-counter-label {
  color: rgba(48, 40, 31, 0.72);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.visitor-counter-digits {
  display: inline-block;
  min-width: 6.4em;
  padding: 0.38em 0.46em 0.3em;
  border: 1px solid #090807;
  border-radius: 2px;
  color: #f4c92e;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(1em - 1px),
      rgba(255, 255, 255, 0.13) calc(1em - 1px),
      rgba(255, 255, 255, 0.13) 1em
    ),
    linear-gradient(#191713 49%, #060504 50%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.3);
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 5px rgba(244, 201, 46, 0.42);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .identity-card {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    width: min(48vw, 36rem);
  }

  .portrait {
    width: 8.5rem;
    height: 8.5rem;
  }

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

  .home-footer-statement {
    grid-column: 1 / -1;
    justify-content: center;
    padding-left: 1.2rem;
    border-bottom: 1px solid rgba(23, 19, 14, 0.28);
    text-align: center;
  }

  .home-footer > :nth-child(2),
  .home-footer > :nth-child(4),
  .home-footer > :nth-child(6) {
    border-left: 0;
  }
}

@media (max-width: 860px) {
  .site-shell {
    overflow: visible;
  }

  .home-layout {
    display: block;
    min-height: 100svh;
    padding: 0;
  }

  .lab-splash {
    width: 100%;
  }

  .identity-card {
    position: absolute;
    right: 1.4rem;
    bottom: 1.4rem;
    width: min(calc(100% - 2.8rem), 36rem);
    margin: 0;
  }
}

@media (max-width: 620px) {
  .site-header {
    flex-direction: column;
    gap: 1.1rem;
  }

  .brand {
    white-space: normal;
  }

  .home-header {
    align-items: stretch;
    gap: 0.55rem;
  }

  .projects-menu {
    align-self: stretch;
    width: 100%;
  }

  .projects-menu summary {
    justify-content: flex-end;
  }

  .projects-popover {
    width: min(100%, 17rem);
    margin-left: auto;
  }

  .home-header .projects-popover {
    position: static;
    width: 100%;
    margin-top: 0.35rem;
  }

  .home-layout {
    min-height: 100svh;
    padding: 0;
  }

  .lab-splash img {
    aspect-ratio: auto;
    object-position: 32% center;
  }

  .identity-card {
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: 0.85rem;
    right: 1rem;
    bottom: 1rem;
    width: calc(100% - 2rem);
    margin: 0;
    padding: 0.72rem;
  }

  .portrait {
    width: 6rem;
    height: 6rem;
  }

  .identity-copy h2 {
    margin-bottom: 0.62rem;
    font-size: 1.3rem;
  }

  .title-list {
    gap: 0.3rem;
    font-size: 0.7rem;
  }

  .home-footer {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 1.4rem;
  }

  .home-footer-statement {
    grid-column: auto;
  }

  .home-footer > * {
    justify-content: flex-start;
    padding: 0.78rem 0;
    border-top: 1px solid rgba(23, 19, 14, 0.2);
    border-left: 0;
    text-align: left;
  }

  .home-footer > :first-child {
    border-top: 0;
  }
}

@media (max-width: 390px) {
  .site-header {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .brand {
    gap: 0.58rem;
    font-size: 1.15rem;
    letter-spacing: 0.055em;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .identity-card {
    grid-template-columns: 5rem minmax(0, 1fr);
  }

  .portrait {
    width: 5rem;
    height: 5rem;
  }

  .identity-copy h2 {
    font-size: 1.14rem;
  }

  .title-list {
    font-size: 0.66rem;
  }

  .home-footer {
    padding-inline: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .home-footer a {
    transition: none;
  }
}
