:root {
  --ink: #17211d;
  --muted: #68726d;
  --line: rgba(23, 33, 29, 0.14);
  --paper: #f1f0e9;
  --signal: #e95d2a;
}

@font-face {
  font-family: "Hurricane";
  src: url("Hurricane.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.home {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 100svh;
  overflow-x: clip;
  padding: 10px clamp(24px, 5vw, 76px) 9px;
  isolation: isolate;
}

.home::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent 4%, black 40%, transparent 96%);
  content: "";
  opacity: 0.34;
}

.ambient {
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.9;
}

.ambientOne {
  top: -18vw;
  right: -9vw;
  width: min(58vw, 720px);
  aspect-ratio: 1;
  background: radial-gradient(circle at 42% 45%, rgba(233, 93, 42, 0.3), rgba(233, 93, 42, 0));
}

.ambientTwo {
  bottom: -30vw;
  left: -20vw;
  width: min(68vw, 860px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(109, 139, 122, 0.22), rgba(109, 139, 122, 0));
}

.siteHeader,
.siteFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icpRecord {
  color: inherit;
  text-decoration: none;
  transition: opacity 180ms ease;
}

.icpRecord:hover,
.icpRecord:focus-visible {
  opacity: 0.58;
}

.siteHeader {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.brand,
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brandMark {
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--paper);
  background: var(--ink);
}

.status {
  color: var(--muted);
}

.statusDot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #268c5b;
  box-shadow: 0 0 0 4px rgba(38, 140, 91, 0.12);
}

.hero {
  padding: clamp(64px, 8vh, 88px) 0 clamp(28px, 4vh, 44px);
}

.eyebrow {
  margin: 0 0 24px;
  color: var(--signal);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(11px, 1.2vw, 13px);
  letter-spacing: 0.18em;
}

h1 {
  width: fit-content;
  margin: 0;
  font-family: "Hurricane", "SignPainter", "Brush Script MT", cursive;
  font-size: clamp(132px, 21.81vw, 250px);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.08;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}

.intro {
  max-width: 560px;
  margin: 40px 0 0 clamp(4px, 10vw, 150px);
  color: var(--muted);
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.8;
}

.labSections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  margin-bottom: 0;
}

.labPanel {
  display: flex;
  min-height: 96px;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  padding: 14px clamp(18px, 2.5vw, 34px) 15px 0;
  transition: background-color 180ms ease;
}

.labPanel + .labPanel {
  padding-left: clamp(18px, 2.5vw, 34px);
}

.labPanel:last-child {
  border-right: 0;
}

.labPanel:hover,
.labPanel:focus-visible {
  background: rgba(23, 33, 29, 0.04);
  outline: none;
}

.labPanelNumber {
  color: var(--signal);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
}

.labPanel h2 {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 400;
  letter-spacing: -0.04em;
}

.labPanelSoon h2 {
  color: var(--muted);
}

.siteFooter {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
}

.subpage {
  grid-template-rows: auto 1fr auto;
}

.detailHero {
  align-self: center;
  max-width: 820px;
  padding: clamp(76px, 12vh, 132px) 0;
}

.detailKicker {
  margin: 0 0 22px;
  color: var(--signal);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detailHero h1 {
  font-family: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: clamp(56px, 10vw, 124px);
  letter-spacing: -0.06em;
  line-height: 0.95;
  transform: none;
}

.detailIntro {
  max-width: 560px;
  margin: 36px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 21px);
  letter-spacing: 0.03em;
  line-height: 1.7;
}

.backLink {
  display: inline-block;
  margin-top: 42px;
  border-bottom: 1px solid currentColor;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.catalogPage {
  grid-template-rows: auto auto 1fr auto;
}

.catalogIntro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.56fr);
  align-items: end;
  gap: clamp(36px, 8vw, 132px);
  padding: clamp(52px, 8vh, 82px) 0 clamp(32px, 5vh, 52px);
}

.catalogIntro .detailKicker {
  margin-bottom: 14px;
}

.catalogIntro h1 {
  font-family: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: clamp(56px, 8vw, 104px);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.9;
  transform: none;
}

.catalogIntro > p {
  max-width: 470px;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: clamp(14px, 1.4vw, 18px);
  letter-spacing: 0.025em;
  line-height: 1.65;
}

.projectMenu {
  border-top: 1px solid var(--line);
}

.projectItem {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(220px, 1.2fr) minmax(210px, 0.78fr) 112px;
  align-items: center;
  min-height: clamp(104px, 15vh, 132px);
  gap: clamp(16px, 2.5vw, 38px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}

.projectItem::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(23, 33, 29, 0.055);
  content: "";
  transform: translateX(-102%);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.projectItemLive:hover::before,
.projectItemLive:focus-visible::before {
  transform: translateX(0);
}

.projectItemLive:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

.projectIndex,
.projectMeta,
.projectAction {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
}

.projectIndex {
  color: var(--signal);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.projectTitle {
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 1;
  transition: letter-spacing 520ms cubic-bezier(0.22, 1, 0.36, 1), transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.projectItemLive:hover .projectTitle,
.projectItemLive:focus-visible .projectTitle {
  letter-spacing: -0.025em;
  transform: translateX(8px);
}

.projectMeta {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.45;
}

.projectState {
  width: fit-content;
  color: var(--ink);
  letter-spacing: 0.14em;
}

.projectItemLive .projectState {
  color: #268c5b;
}

.projectAction {
  justify-self: end;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  transition: color 240ms ease;
}

.projectItemLive:hover .projectAction,
.projectItemLive:focus-visible .projectAction {
  color: var(--ink);
}

.projectItemReserved {
  color: var(--muted);
}

.projectItemReserved::before {
  display: none;
}

.catalogPage .siteFooter a {
  border-bottom: 1px solid transparent;
  transition: border-color 180ms ease, color 180ms ease;
}

.catalogPage .siteFooter a:hover,
.catalogPage .siteFooter a:focus-visible {
  border-color: currentColor;
  color: var(--ink);
  outline: none;
}

@media (max-width: 640px) {
  .home {
    min-height: 100dvh;
    padding:
      max(8px, env(safe-area-inset-top))
      max(20px, env(safe-area-inset-right))
      max(7px, env(safe-area-inset-bottom))
      max(20px, env(safe-area-inset-left));
  }

  .siteHeader {
    min-height: 32px;
  }

  .hero {
    padding: clamp(42px, 8vh, 68px) 0 clamp(28px, 5vh, 42px);
  }

  h1 {
    font-size: clamp(66px, 19vw, 92px);
    line-height: 1.08;
  }

  .intro {
    margin: 24px 0 0 4px;
    font-size: 16px;
    line-height: 1.65;
  }

  .labSections {
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .labPanel,
  .labPanel + .labPanel {
    min-height: 76px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 11px 0 12px;
  }

  .labPanel:last-child {
    border-bottom: 0;
  }

  .labPanel h2 {
    font-size: 24px;
  }

  .detailHero {
    padding: 12vh 0;
  }

  .catalogIntro {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 8vh 0 5vh;
  }

  .catalogIntro h1 {
    font-size: clamp(54px, 20vw, 78px);
  }

  .catalogIntro > p {
    max-width: 34ch;
    font-size: 14px;
  }

  .projectItem {
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 126px;
    gap: 10px 14px;
    padding: 18px 0;
  }

  .projectIndex {
    grid-row: 1 / span 2;
    align-self: start;
    padding-top: 5px;
  }

  .projectTitle {
    font-size: clamp(28px, 9.5vw, 40px);
  }

  .projectMeta {
    grid-column: 2;
  }

  .projectAction {
    display: none;
  }

  .siteFooter span:first-child {
    display: none;
  }

  .siteFooter {
    justify-content: flex-end;
  }

  .catalogPage .siteFooter {
    justify-content: space-between;
    gap: 16px;
    font-size: 10px;
  }
}

@media (max-width: 390px) and (max-height: 700px) {
  .home:not(.catalogPage) .labPanel,
  .home:not(.catalogPage) .labPanel + .labPanel {
    min-height: 64px;
    padding: 8px 0 9px;
  }

  .home:not(.catalogPage) .labPanel h2 {
    font-size: 21px;
  }

  .home:not(.catalogPage) .hero {
    padding: 28px 0 22px;
  }

  .home:not(.catalogPage) .eyebrow {
    margin-bottom: 12px;
  }

  .home:not(.catalogPage) h1 {
    font-size: clamp(60px, 18vw, 72px);
  }

  .home:not(.catalogPage) .intro {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.5;
  }

  .catalogIntro {
    gap: 16px;
    padding: 32px 0 22px;
  }

  .catalogIntro h1 {
    font-size: 54px;
  }

  .catalogIntro > p {
    font-size: 12px;
    line-height: 1.5;
  }

  .projectItem {
    min-height: 102px;
    padding: 12px 0;
  }

  .projectTitle {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    animation: reveal 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero h1 {
    animation-delay: 80ms;
  }

  .hero .intro {
    animation-delay: 160ms;
  }

  .catalogIntro > * {
    animation: catalogReveal 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .catalogIntro > p {
    animation-delay: 90ms;
  }

  .projectItem {
    animation: catalogReveal 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .projectItem:nth-child(1) { animation-delay: 120ms; }
  .projectItem:nth-child(2) { animation-delay: 190ms; }
  .projectItem:nth-child(3) { animation-delay: 260ms; }

  .isLeaving .home {
    animation: catalogExit 260ms cubic-bezier(0.4, 0, 1, 1) both;
    pointer-events: none;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes catalogReveal {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes catalogExit {
  to {
    opacity: 0;
    transform: scale(0.992) translateY(-8px);
  }
}
