@import url("https://api.fontshare.com/v2/css?f[]=satoshi@300,400,500,700&display=swap");

:root {
  --font-satoshi: "Satoshi", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-glide: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 480ms;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  color: inherit;
  background: transparent;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
}

.app-shell {
  --site-x: clamp(28px, 5vw, 82px);
  --site-y: clamp(24px, 3.6vw, 52px);
  --display-size: clamp(32px, 3.8vw, 58px);
  --page-title-size: clamp(46px, 4.7vw, 84px);
  --writing-menu-size: clamp(27px, 2.45vw, 42px);
  --reader-title-size: clamp(34px, 3.05vw, 54px);
  --reader-body-size: clamp(17px, 1.14vw, 20px);
  --reader-line: 1.68;
  --page-rail: minmax(260px, 0.3fr);
  --page-main: minmax(0, 1.06fr);
  --page-gap: clamp(24px, 3vw, 46px);
  --radius: 6px;
  --surface: #f4f0e5;
  --surface-soft: rgba(255, 255, 255, 0.46);
  --surface-solid: rgba(255, 255, 255, 0.7);
  --ink: #171510;
  --ink-soft: #4f4a40;
  --muted: #857d70;
  --line: rgba(23, 21, 16, 0.1);
  --line-strong: rgba(23, 21, 16, 0.22);
  --grain-blend: multiply;
  --shadow-border:
    0 0 0 1px rgba(0, 0, 0, 0.055),
    0 1px 2px -1px rgba(0, 0, 0, 0.05),
    0 8px 26px -24px rgba(0, 0, 0, 0.3);
  --grain-opacity: 0.052;
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-satoshi);
  background: var(--surface);
  transition-property: background, color;
  transition-duration: var(--duration);
  transition-timing-function: var(--ease);
}

.app-shell[data-theme="dark"] {
  --surface: #14130f;
  --surface-soft: rgba(255, 255, 255, 0.055);
  --surface-solid: rgba(255, 255, 255, 0.075);
  --ink: #efeadf;
  --ink-soft: #c9c0af;
  --muted: #9f9687;
  --line: rgba(239, 234, 223, 0.12);
  --line-strong: rgba(239, 234, 223, 0.26);
  --grain-blend: screen;
  --shadow-border: 0 0 0 1px rgba(255, 255, 255, 0.075);
  --grain-opacity: 0.064;
}

.app-shell[data-theme="dark"] img {
  outline-color: rgba(255, 255, 255, 0.1);
}

.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.18' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.34'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23grain)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: var(--grain-blend);
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  min-height: 82px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: var(--site-y) var(--site-x) 0;
  color: var(--ink);
}

.brandmark {
  width: fit-content;
  color: var(--ink);
  font-size: var(--display-size);
  font-weight: 300;
  line-height: 0.88;
  letter-spacing: 0;
  text-wrap: balance;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.page-back,
.theme-toggle {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.page-back {
  width: 44px;
  margin: 0 0 0 -8px;
  display: grid;
  place-items: center;
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 300;
  line-height: 1;
  text-decoration-line: none;
  transition-property: opacity, transform, scale;
  transition-duration: 180ms;
  transition-timing-function: var(--ease);
}

.theme-toggle {
  width: 44px;
  display: grid;
  place-items: center;
  border-radius: 0;
  transition-property: opacity;
  transition-duration: 160ms;
  transition-timing-function: var(--ease);
}

.theme-toggle-mark {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
  border: 1px solid var(--ink);
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(90deg, var(--ink) 50%, var(--surface) 50%);
  rotate: 0deg;
  transition-property: rotate, opacity, scale, filter;
  transition-duration: 620ms;
  transition-timing-function: var(--ease);
}

.theme-toggle-mark::before,
.theme-toggle-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 50%;
  height: 50%;
  border-radius: 50%;
  translate: -50% 0;
}

.theme-toggle-mark::before {
  top: 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 4px var(--ink);
}

.theme-toggle-mark::after {
  bottom: 0;
  background: var(--ink);
  box-shadow: inset 0 0 0 4px var(--surface);
}

.app-shell[data-theme="dark"] .theme-toggle-mark {
  rotate: 180deg;
}

.page-back:hover,
.page-back:focus-visible {
  opacity: 0.62;
  transform: translateX(-2px);
  outline: 0;
}

.page-back:active {
  scale: 0.96;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 0.72;
  outline: 0;
}

.theme-toggle:active .theme-toggle-mark {
  scale: 0.96;
}

.stage {
  position: relative;
  min-height: 100dvh;
  padding: clamp(112px, 15vh, 154px) var(--site-x) clamp(44px, 8vh, 86px);
  color: var(--ink);
  transition-property: opacity, transform, filter;
  transition-duration: 150ms;
  transition-timing-function: ease-in;
}

.app-shell:not([data-page="home"]) .stage {
  padding-top: var(--site-y);
}

.stage.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(4px);
}

.stage.is-entering {
  animation: stage-enter 420ms var(--ease-glide) both;
}

@keyframes stage-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(8px);
  }

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

.home-view,
.page-view {
  height: calc(100dvh - clamp(156px, 23vh, 240px));
  min-height: 440px;
}

.app-shell:not([data-page="home"]) .page-view {
  height: calc(100dvh - var(--site-y) - clamp(44px, 8vh, 86px));
  min-height: 520px;
}

.home-view {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.home-rooms {
  display: grid;
  gap: clamp(8px, 1vw, 16px);
  width: min(56vw, 560px);
}

.room-line {
  position: relative;
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  transition-property: opacity;
  transition-duration: 190ms;
  transition-timing-function: var(--ease);
}

.room-line span {
  --underline-offset: -0.08em;
  display: block;
  font-size: var(--display-size);
  line-height: 1;
  font-weight: 300;
  letter-spacing: 0;
}

.room-line:hover,
.room-line:focus-visible {
  opacity: 0.72;
  outline: 0;
}

.page-view {
  display: grid;
  grid-template-columns: var(--page-rail) var(--page-main);
  gap: var(--page-gap);
  align-items: stretch;
}

.page-header {
  min-width: 0;
  align-self: center;
  display: grid;
  align-content: center;
  color: var(--ink);
}

.content-panel {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(20px, 3vh, 34px);
  align-self: stretch;
}

.content-page-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--display-size);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: 0;
  text-wrap: balance;
}

.content-scroll,
.portrait-wall {
  --edge-fade: 14px;
  min-height: 0;
  height: 100%;
  position: relative;
  align-self: stretch;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      rgba(0, 0, 0, 0.38) 5px,
      #000 var(--edge-fade),
      #000 calc(100% - var(--edge-fade)),
      rgba(0, 0, 0, 0.38) calc(100% - 5px),
      transparent 100%
    );
  mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      rgba(0, 0, 0, 0.38) 5px,
      #000 var(--edge-fade),
      #000 calc(100% - var(--edge-fade)),
      rgba(0, 0, 0, 0.38) calc(100% - 5px),
      transparent 100%
    );
}

.content-scroll::-webkit-scrollbar,
.portrait-wall::-webkit-scrollbar,
.writing-reader-shell::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.content-scroll {
  padding: 8px 0;
}

.writing-content {
  display: grid;
  grid-template-columns: minmax(220px, min(460px, 58%));
  gap: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  align-items: stretch;
  overflow: hidden;
}

.writing-content.is-reading {
  display: block;
}

.writing-index {
  display: grid;
  align-content: start;
  align-self: start;
}

.writing-row {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.writing-trigger {
  width: 100%;
  display: grid;
  padding: clamp(22px, 3vh, 38px) 0;
  text-align: left;
  cursor: pointer;
}

.writing-trigger:focus-visible {
  outline: 0;
}

.writing-title {
  --underline-offset: -0.1em;
  width: fit-content;
  color: var(--ink);
  font-size: var(--writing-menu-size);
  font-weight: 300;
  line-height: 1.16;
  text-wrap: balance;
}

.writing-reader-shell {
  --edge-fade: 16px;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      rgba(0, 0, 0, 0.38) 5px,
      #000 var(--edge-fade),
      #000 calc(100% - var(--edge-fade)),
      rgba(0, 0, 0, 0.38) calc(100% - 5px),
      transparent 100%
    );
  mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      rgba(0, 0, 0, 0.38) 5px,
      #000 var(--edge-fade),
      #000 calc(100% - var(--edge-fade)),
      rgba(0, 0, 0, 0.38) calc(100% - 5px),
      transparent 100%
    );
  animation: reader-slide 460ms var(--ease-glide) both;
}

@keyframes reader-slide {
  from {
    opacity: 0;
    transform: translateX(18px);
    filter: blur(7px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}

.writing-reader {
  max-width: 70ch;
  display: grid;
  gap: 20px;
  padding: 4px 0 42px;
}

.writing-reader p {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--reader-body-size);
  font-weight: 300;
  line-height: var(--reader-line);
  text-wrap: pretty;
}

.writing-reader .writing-reader-dek {
  width: fit-content;
  margin: 2px 0 12px;
  padding-top: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line-strong);
  font-size: clamp(13px, 0.94vw, 15px);
  line-height: 1;
  text-transform: uppercase;
}

.stream-view {
  grid-template-columns: var(--page-rail) var(--page-main);
}

.stream-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1.2vw, 18px);
  grid-auto-rows: auto;
  padding: 10px 0 clamp(12px, 1.2vw, 18px);
}

.content-card {
  position: relative;
  width: 100%;
  min-height: clamp(142px, 16vh, 172px);
  height: auto;
  display: inline-grid;
  align-content: start;
  gap: clamp(12px, 1.2vw, 18px);
  margin: 0;
  padding: clamp(20px, 2vw, 30px);
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-solid);
  box-shadow: var(--shadow-border);
  vertical-align: top;
}

.content-card:has(.content-image) {
  height: clamp(306px, 36vh, 336px);
}

.content-card.is-quote {
  align-content: center;
}

a.content-card:hover,
a.content-card:focus-visible {
  outline: 0;
  z-index: 2;
}

a.content-card:hover .content-link,
a.content-card:focus-visible .content-link {
  color: var(--ink);
}

.content-image {
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px);
  background: var(--surface-soft);
}

.content-image img,
.portrait-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(1) contrast(0.96);
  transition-property: filter;
  transition-duration: 460ms;
  transition-timing-function: var(--ease);
}

a.content-card:hover .content-image img,
a.content-card:focus-visible .content-image img {
  filter: grayscale(0.46) contrast(1.02);
}

.content-body {
  display: grid;
  gap: 10px;
}

.content-title {
  color: var(--ink);
  font-size: clamp(18px, 1.46vw, 25px);
  font-weight: 300;
  line-height: 1.08;
  text-wrap: balance;
}

.content-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(15px, 1vw, 17px);
  font-weight: 300;
  line-height: 1.34;
  text-wrap: pretty;
}

.content-card.is-quote .content-body {
  align-content: center;
}

.content-card .content-quote {
  color: var(--ink);
  font-size: clamp(22px, 2vw, 34px);
  line-height: 1.08;
  text-wrap: balance;
}

.content-link {
  --underline-offset: -0.28em;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
  font-weight: 300;
  line-height: 1;
  transition-property: color;
  transition-duration: 160ms;
  transition-timing-function: var(--ease);
}

.room-line span,
.writing-title,
.content-link {
  position: relative;
  text-decoration: none;
}

.room-line span::after,
.writing-title::after,
.content-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--underline-offset);
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: center;
  transition-property: transform, opacity;
  transition-duration: 620ms, 260ms;
  transition-timing-function: var(--ease);
}

.room-line:hover span::after,
.room-line span:hover::after,
.room-line:focus-visible span::after,
.writing-trigger:hover .writing-title::after,
.writing-title:hover::after,
.writing-trigger:focus-visible .writing-title::after,
.writing-row.is-selected .writing-title::after,
a.content-card:hover .content-link::after,
a.content-link:hover::after,
a.content-card:focus-visible .content-link::after {
  opacity: 1;
  transform: scaleX(1);
  transition-duration: 320ms, 140ms;
}

.influence-view {
  grid-template-columns: var(--page-rail) var(--page-main);
  gap: var(--page-gap);
}

.portrait-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 8px 0;
}

.portrait-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  color: #f4f0e5;
  background: var(--surface-soft);
  box-shadow: var(--shadow-border);
}

.portrait-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 52%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.portrait-card strong {
  position: absolute;
  z-index: 1;
  left: 16px;
  right: 16px;
  bottom: 15px;
  color: #f4f0e5;
  font-size: clamp(18px, 1.65vw, 28px);
  line-height: 0.96;
  font-weight: 300;
  text-wrap: balance;
}

.portrait-card:nth-child(1),
.portrait-card:nth-child(4) {
  min-height: 330px;
}

.portrait-card:nth-child(2),
.portrait-card:nth-child(5) {
  min-height: 260px;
}

.portrait-card:nth-child(3),
.portrait-card:nth-child(6) {
  min-height: 300px;
}

@media (max-width: 1120px) {
  .page-view,
  .stream-view,
  .influence-view {
    --page-rail: minmax(250px, 0.3fr);
    --page-main: minmax(0, 1fr);
    --page-gap: clamp(22px, 3vw, 40px);
  }

  .app-shell {
    --page-title-size: clamp(44px, 5.1vw, 74px);
  }
}

@media (max-width: 960px) {
  .app-shell {
    --site-x: 20px;
    --site-y: 22px;
    --display-size: clamp(30px, 9vw, 46px);
    --page-title-size: clamp(46px, 12vw, 72px);
    --writing-menu-size: clamp(26px, 8vw, 40px);
    --reader-title-size: clamp(34px, 9vw, 48px);
    --reader-body-size: clamp(17px, 4.3vw, 19px);
  }

  .topbar {
    min-height: 70px;
  }

  .stage {
    padding: 104px var(--site-x) 30px;
  }

  .app-shell:not([data-page="home"]) .stage {
    padding-top: var(--site-y);
  }

  .home-view,
  .page-view {
    height: calc(100dvh - 134px);
    min-height: 0;
  }

  .app-shell:not([data-page="home"]) .page-view {
    height: calc(100dvh - var(--site-y) - 30px);
  }

  .home-rooms {
    width: auto;
  }

  .page-view,
  .stream-view,
  .influence-view {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .page-header {
    align-self: end;
  }

  .content-panel {
    gap: 18px;
  }

  .content-scroll,
  .portrait-wall {
    height: auto;
    min-height: 0;
  }

  .content-scroll {
    overflow-y: auto;
  }

  .writing-content {
    grid-template-columns: 1fr;
    gap: 28px;
    height: auto;
    overflow: visible;
  }

  .writing-content.is-reading {
    grid-template-columns: 1fr;
  }

  .writing-reader-shell {
    height: auto;
    max-height: none;
    overflow: visible;
    animation: none;
  }

  .stream-segment {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .content-card {
    height: auto;
    min-height: 176px;
  }

  .content-card:has(.content-image) {
    height: auto;
    min-height: 286px;
  }

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

  .portrait-card:nth-child(n) {
    min-height: 210px;
  }
}

@media (max-width: 560px) {
  .topbar-actions {
    gap: 4px;
  }

  .page-back {
    margin-left: -6px;
  }

  .portrait-wall {
    grid-template-columns: 1fr 1fr;
  }

  .portrait-card:nth-child(n) {
    min-height: 188px;
  }

  .portrait-card strong {
    font-size: 16px;
  }
}

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

  .writing-reader-shell {
    animation: none !important;
  }
}
