*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: normal;
  color: #111;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: none;
  -webkit-text-size-adjust: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 100%;
  font-weight: 400;
}

.page {
  position: relative;
  z-index: 1;
}

.homepage {
  width: min(500px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 5rem 0 2.5rem;
}

body:not(.project) .homepage {
  padding-top: 65px;
}

@media (max-width: 768px) {
  .homepage {
    padding: 2rem 0 2.5rem;
  }

  body:not(.project) .homepage {
    padding-top: 17px;
  }
}

.article,
.writing {
  width: 100%;
}

.article > header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0 0.5rem;
}

header h1 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
}

header time {
  display: block;
  font-size: 0.875rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
  color: rgba(0, 0, 0, 0.4);
}

.article p {
  margin: 0;
  padding-top: 1rem;
  font-size: 0.875rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
}

#week-line:not(.is-ready) .flip-week {
  visibility: hidden;
}

.flip {
  display: inline-block;
  vertical-align: bottom;
  perspective: 1100px;
  perspective-origin: 50% 50%;
}

.flip-card {
  display: grid;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  animation: upright 7.5s infinite;
}

.flip-card.is-driven {
  animation: none;
}

.flip-week .flip-card {
  position: relative;
  display: inline-grid;
}

.flip-week {
  max-width: 100%;
}

.flip-week .flip-face {
  overflow-wrap: break-word;
}

.flip-week .flip-back {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
}

.flip-face {
  grid-area: 1 / 1;
  white-space: nowrap;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-front {
  transform: translateZ(0.6px);
}

.flip-back {
  transform: rotateX(180deg) translateZ(0.6px);
}

@keyframes upright {
  0% {
    transform: rotateX(0deg);
    animation-timing-function: cubic-bezier(0.45, 0.02, 0.18, 1);
  }
  16% {
    transform: rotateX(-180deg);
    animation-timing-function: linear;
  }
  50% {
    transform: rotateX(-180deg);
    animation-timing-function: cubic-bezier(0.45, 0.02, 0.18, 1);
  }
  66% {
    transform: rotateX(-360deg);
    animation-timing-function: linear;
  }
  100% {
    transform: rotateX(-360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flip-card {
    animation: none;
  }

  .flip-back {
    display: none;
  }
}

.article em,
.article em strong,
.article strong em {
  color: #000;
  font-family: Newsreader, Georgia, serif;
  font-size: 0.9375rem;
  font-style: italic;
  font-weight: 430;
  letter-spacing: 0.01rem;
  font-variation-settings: "opsz" 10;
}

.basic-link {
  position: relative;
  color: inherit;
  text-decoration: none;
}

.basic-link::before {
  pointer-events: none;
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  border-radius: 2px;
  background: rgba(17, 17, 17, 0.22);
}

.basic-link:hover::before {
  background: rgba(17, 17, 17, 0.55);
}

.writing {
  padding-top: 3rem;
}

.writing h3 {
  margin: 0;
  padding-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 460;
  line-height: normal;
  letter-spacing: -0.00563rem;
  color: rgba(0, 0, 0, 0.4);
}

.years,
.years ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  font-weight: 460;
  letter-spacing: -0.00563rem;
}

.years > li {
  position: relative;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
}

.year {
  position: absolute;
  left: 0;
  top: 0.735rem;
  width: 6.75rem;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.875rem;
  font-weight: 460;
  letter-spacing: -0.00563rem;
}

.years a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.735rem 0 0.735rem 6.75rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 460;
  letter-spacing: -0.00563rem;
}

.years a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 6.75rem;
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
}

.years > li ul > li:last-child a::after {
  display: none;
}

@media (hover: hover) {
  .years a {
    transition: opacity 0.08s linear;
  }

  .years:hover a:not(:hover) {
    opacity: 0.3;
  }
}

.years h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 460;
  line-height: normal;
  letter-spacing: -0.00563rem;
}

.years time {
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.875rem;
  font-weight: 460;
  line-height: normal;
  letter-spacing: -0.00563rem;
  font-variant-numeric: tabular-nums;
}

footer {
  margin-top: 0;
  padding-top: 2.5rem;
}

@media (max-width: 520px) {
  .year {
    width: 3rem;
  }

  .years a {
    padding-left: 3rem;
  }

  .years a::after {
    left: 3rem;
  }
}

#local-time {
  margin: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.8125rem;
  font-weight: 460;
  letter-spacing: -0.0025rem;
  line-height: normal;
  font-variant-numeric: tabular-nums;
}

@keyframes staggerIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .homepage > .article > *,
  .homepage > .writing,
  .homepage > footer {
    animation: staggerIn 0.5s ease both;
  }

  .homepage > .article > :nth-child(1) {
    animation-delay: 0s;
  }

  .homepage > .article > :nth-child(2) {
    animation-delay: 0.035s;
  }

  .homepage > .article > :nth-child(3) {
    animation-delay: 0.07s;
  }

  .homepage > .article > :nth-child(4) {
    animation-delay: 0.105s;
  }

  .homepage > .article > :nth-child(5) {
    animation-delay: 0.14s;
  }

  .homepage > .article > :nth-child(6) {
    animation-delay: 0.175s;
  }

  .homepage > .article > :nth-child(7) {
    animation-delay: 0.21s;
  }

  .homepage > .article > :nth-child(8) {
    animation-delay: 0.245s;
  }

  .homepage > .article > :nth-child(n + 9) {
    animation-delay: 0.28s;
  }

  .homepage > .writing {
    animation-delay: 0.45s;
  }

  .homepage > footer {
    animation-delay: 0.52s;
  }

  .homepage > .article > #week-line {
    animation-delay: 0s;
  }
}

html:has(body.project),
body.project {
  height: 100%;
  overflow: hidden;
}

.project .page {
  height: 100%;
  overflow: auto;
  scroll-padding-top: 80px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 56px,
    #000 calc(100% - 72px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 56px,
    #000 calc(100% - 72px),
    transparent 100%
  );
}

.project .homepage {
  padding-top: 80px;
  padding-bottom: 5rem;
}

.project-nav {
  display: none;
}

.project-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 24px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.875rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
  text-decoration: none;
}

.project-back:hover {
  color: #111;
}

.project-toc-title {
  margin: 28px 0 8px;
  min-height: 1.25rem;
  opacity: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.project-toc-title.is-visible {
  opacity: 1;
}

.project-toc {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-toc a {
  display: block;
  padding: 2px 0;
  color: rgba(18, 18, 18, 0.4);
  font-size: 0.8125rem;
  font-weight: 460;
  line-height: 1.2;
  letter-spacing: -0.0025rem;
  text-decoration: none;
}

.project-toc a:hover,
.project-toc a.is-active {
  color: #111;
}

.has-note {
  position: relative;
}

.margin-note {
  display: none;
}

@media (min-width: 1080px) {
  html:has(body.project) {
    scroll-padding-top: 80px;
  }

  .project-back-inline {
    display: none;
  }

  .project-nav {
    display: block;
    position: fixed;
    top: 82px;
    left: 82px;
    width: 168px;
    z-index: 3;
  }

  .project-nav .project-back {
    margin: 0;
  }

  .margin-note {
    display: block;
    position: absolute;
    left: calc(100% + 28px);
    top: 16px;
    width: 180px;
    color: #4a4a4a;
    font-family: Newsreader, Georgia, serif;
    font-size: 0.9375rem;
    font-style: italic;
    font-weight: 430;
    letter-spacing: 0.01rem;
    font-variation-settings: "opsz" 10;
  }
}

.project .article h2 {
  margin: 48px 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  letter-spacing: -0.00813rem;
}

.project .article figure {
  margin: 40px 0 0;
}

.project .article figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.project figcaption {
  margin: 8px 0 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.8125rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.0025rem;
}

.project .article figure.diagram {
  margin: 32px 0 0;
}

.project .article figure.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.d-node,
.d-line {
  fill: none;
  stroke: rgba(17, 17, 17, 0.22);
  stroke-width: 1;
}

.d-lane {
  fill: none;
  stroke: rgba(17, 17, 17, 0.12);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.d-head {
  fill: rgba(17, 17, 17, 0.3);
  stroke: none;
}

.d-name {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.00563rem;
  fill: #111;
}

.d-sub {
  font-size: 11px;
  font-weight: 460;
  letter-spacing: -0.00563rem;
  fill: rgba(0, 0, 0, 0.4);
}

.project .files {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.project .files li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
}

.project .files li:last-child {
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
}

.project .files span {
  flex: 0 1 auto;
  text-align: right;
  font-weight: 460;
  color: rgba(0, 0, 0, 0.4);
}

.d-sealed {
  fill: none;
  stroke: rgba(17, 17, 17, 0.22);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.d-strong {
  fill: none;
  stroke: rgba(17, 17, 17, 0.4);
  stroke-width: 1;
}

.project-light {
  color: #1d4e9c;
}

.project-light header time,
.project-light figcaption,
.project-light .files span,
.project-light .d-sub {
  color: rgba(29, 78, 156, 0.5);
}

.project-light .d-sub {
  fill: rgba(29, 78, 156, 0.5);
}

.project-light .article em,
.project-light .article em strong,
.project-light .article strong em,
.project-light .margin-note {
  color: rgba(29, 78, 156, 0.82);
}

.project-light .basic-link {
  text-decoration-color: rgba(29, 78, 156, 0.35);
}

.project-light .basic-link:hover {
  text-decoration-color: #1d4e9c;
}

.project-light .project-back,
.project-light .project-toc a {
  color: rgba(29, 78, 156, 0.45);
}

.project-light .project-back:hover,
.project-light .project-toc a:hover,
.project-light .project-toc a.is-active {
  color: #1d4e9c;
}

.project-light .files li,
.project-light .files li:last-child {
  border-color: rgba(29, 78, 156, 0.18);
}

.project-light .d-node,
.project-light .d-line,
.project-light .d-sealed {
  stroke: rgba(29, 78, 156, 0.35);
}

.project-light .d-lane {
  stroke: rgba(29, 78, 156, 0.2);
}

.project-light .d-head {
  fill: rgba(29, 78, 156, 0.45);
}

.project-light .d-name {
  fill: #1d4e9c;
}

.project-light .d-strong {
  stroke: rgba(29, 78, 156, 0.55);
}

.corner {
  position: absolute;
  top: 65px;
  right: 24px;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: 0.875rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
}

@media (min-width: 1080px) {
  .corner {
    right: 82px;
  }
}

@media (max-width: 768px) {
  .corner {
    top: 17px;
    right: 1rem;
  }
}

.magic {
  color: #111;
  font-family: Newsreader, Georgia, serif;
  font-size: 0.9375rem;
  font-style: italic;
  font-weight: 430;
  letter-spacing: 0.01rem;
  font-variation-settings: "opsz" 10;
  text-decoration: none;
}

.magic::before {
  content: "✦";
  display: inline-block;
  margin-right: 4px;
  font-style: normal;
}

.magic:hover {
  color: rgba(0, 0, 0, 0.4);
}

@media (prefers-reduced-motion: no-preference) {
  .magic {
    background: linear-gradient(100deg, #111 40%, #bbb 50%, #111 60%) 100% 0 / 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3.2s ease-in-out infinite;
  }

  .magic::before {
    -webkit-text-fill-color: #111;
    animation: twinkle 1.6s ease-in-out infinite alternate;
  }

  .magic:hover {
    -webkit-text-fill-color: rgba(0, 0, 0, 0.4);
  }
}

@keyframes shimmer {
  to {
    background-position: 0 0;
  }
}

@keyframes twinkle {
  from {
    transform: scale(0.7) rotate(0deg);
    opacity: 0.5;
  }
  to {
    transform: scale(1.15) rotate(90deg);
    opacity: 1;
  }
}

.sub {
  color: rgba(0, 0, 0, 0.4);
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(17, 17, 17, 0.22);
  text-underline-offset: 3px;
}

.text-button:hover {
  text-decoration-color: rgba(17, 17, 17, 0.55);
}

.scores {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.scores span {
  color: rgba(0, 0, 0, 0.4);
}

.scores .is-turn {
  color: #111;
  font-weight: 600;
}

/* contact chat */
.chat {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 4rem 1rem;
}

.chat > div {
  width: min(560px, 100%);
}

.chat-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(640px, calc(100dvh - 8rem));
  overflow: hidden;
  background: #fff;
}

/* before the first message the window hugs the greeting and input, so both sit mid-screen */
.chat-window.is-idle {
  height: auto;
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 20px 18px;
  overflow-y: auto;
  list-style: none;
  font-size: 0.875rem;
  font-weight: 460;
  line-height: 1.25rem;
  letter-spacing: -0.00563rem;
}

.chat-log > :first-child {
  margin-top: auto;
}

.msg {
  align-self: flex-start;
  max-width: 78%;
  padding: 9px 14px;
  border-radius: 18px 18px 18px 6px;
  background: #f2f2f2;
  overflow-wrap: anywhere;
  animation: staggerIn 0.25s ease both;
}

.msg.me {
  align-self: flex-end;
  border-radius: 18px 18px 6px 18px;
  background: #111;
  color: #fff;
}

.msg + .msg.me,
.msg.me + .msg:not(.me) {
  margin-top: 8px;
}

.msg .basic-link::before {
  background: rgba(17, 17, 17, 0.4);
}

.msg-note {
  align-self: center;
  margin-top: 10px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.8125rem;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  animation: typing 1s ease-in-out infinite;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  outline: 0;
  background: #f2f2f2;
  color: #111;
  font: inherit;
  font-size: 1rem;
  font-weight: 460;
}

.chat-form input:focus {
  border-color: rgba(17, 17, 17, 0.2);
  background: #fff;
}

.chat-form input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

.chat-form button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #111;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.chat-form button:disabled {
  opacity: 0.2;
  cursor: default;
}

.chat-form button:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.55);
  outline-offset: 2px;
}

.chat-fine {
  margin: 14px 0 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.8125rem;
  font-weight: 460;
  text-align: center;
}

.chat-back {
  position: fixed;
  top: 17px;
  left: 1rem;
  z-index: 2;
  margin: 0;
}

@media (max-width: 600px) {
  .chat {
    padding: 52px 0 0;
    place-items: stretch;
  }

  .chat-window {
    width: 100%;
    height: calc(100dvh - 52px);
  }

  .chat-fine {
    display: none;
  }

  .chat:has(.is-idle) {
    align-items: center;
  }
}

/* neelinavolu.com: CAD drawing beside the homepage column */
html,
body {
  overflow-x: clip; /* hidden would make body a scroll box and break the sticky drawing */
}

.home {
  display: grid;
  grid-template-columns: min(500px, calc(100% - 2rem));
  justify-content: center;
}

.home .homepage {
  width: 100%;
  margin: 0;
}

/* the drawing only shows when the window fits it whole at full height
   (index.html adds .is-on); otherwise the page is text only */
.home-cad {
  display: none;
}

.home:has(.home-cad.is-on) {
  grid-template-columns: 500px auto;
  column-gap: 4rem;
  align-items: start;
}

.home-cad.is-on {
  display: block;
  position: sticky;
  top: 0;
}

.home-cad img {
  display: block;
  width: 75vh; /* 2138x2852 drawing, so this makes it exactly 100vh tall */
  height: auto;
}

.page:has(.home-cad.is-on) .corner {
  background: #fff;
}

/* hover preview for Peeped, Lucid and Pace links */
.preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: min(480px, calc(100vw - 32px));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f3f3;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.preview.is-on {
  opacity: 1;
}

.preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
