/* Phone layouts. index.php loads this file for small screens only, so the desktop design never sees it. */
:root {
  --screen: 100vh;
  --nav: calc(56px + env(safe-area-inset-bottom));
  --gutter: 20px;
}
@supports (height: 100dvh) {
  :root { --screen: 100dvh; }
}
html { -webkit-text-size-adjust: 100%; }
a, button { -webkit-tap-highlight-color: transparent; }
.screen { height: var(--screen); }
body.at-1 .deck { transform: translateY(calc(var(--screen) * -1)); }
body.at-2 .deck { transform: translateY(calc(var(--screen) * -2)); }
body.at-3 .deck { transform: translateY(calc(var(--screen) * -3)); }
body.at-4 .deck { transform: translateY(calc(var(--screen) * -4)); }
body.is-enter .deck { transform: translateY(var(--screen)); }
body.at-1.is-enter .deck { transform: translateY(0); }
body.at-2.is-enter .deck { transform: translateY(calc(var(--screen) * -1)); }
body.at-3.is-enter .deck { transform: translateY(calc(var(--screen) * -2)); }
body.at-4.is-enter .deck { transform: translateY(calc(var(--screen) * -3)); }

/* The bottom bar replaces the section menus. */
.rail nav, .side nav, .about-rail nav { display: none; }
.phone-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  box-sizing: border-box;
  height: var(--nav);
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid rgba(255,255,255,.12);
  background: #0d0f14;
}
.phone-nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a9abb0;
  font: 600 15px/1 "Nunito Sans", sans-serif;
  letter-spacing: .02em;
  text-decoration: none;
}
.phone-nav a[aria-current] { color: #efa12f; }
.phone-nav a[aria-current]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 28px;
  height: 2px;
  margin-left: -14px;
  background: #efa12f;
}
body.is-reading .phone-nav { display: none; }

/* The logo stays at the top, and content fades out as it scrolls under it. */
.brand { top: 16px; left: var(--gutter); font-size: 17px; }
.brand img { width: 32px; height: 32px; }
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  height: 72px;
  pointer-events: none;
  background: linear-gradient(#0d0f14 62%, rgba(13,15,20,0));
}
body.is-reading::after { display: none; }

/* Home */
.rail {
  left: 0;
  right: 0;
  width: auto;
  box-sizing: border-box;
  padding: 72px var(--gutter) calc(var(--nav) + 44px);
  overflow-y: auto;
  justify-content: safe center;
  pointer-events: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.display { margin: 0 0 24px; font-size: clamp(60px, 19vw, 88px); }
.home-intro { max-width: 460px; margin: 0; font-size: 17px; }
.phone-boxes { display: block; flex: none; margin: 22px 0 0; text-align: center; }
/* The shift centers the boxes themselves, since their shadow widens the picture on one side. */
.phone-boxes img { display: block; width: min(63.8vw, 264px); height: auto; margin: 0 auto; transform: translateX(-5.2%); }
.phone-boxes figcaption { margin-top: 10px; color: #a9abb0; font: 400 14px/1.4 "Nunito Sans", sans-serif; }
.copy { left: var(--gutter); bottom: calc(var(--nav) + 16px); }

/* eureka and Sandbox: one long list of cards, with the whole page scrolling. */
.feed-view { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.feed-view::-webkit-scrollbar { display: none; }
.side {
  position: static;
  width: auto;
  max-width: none;
  padding: 76px var(--gutter) 0;
}
.side h1 { margin-bottom: 12px; font-size: 44px; }
.side .blurb { margin: 0; max-width: 520px; font-size: 16px; }
.work, :is(#sandbox, #portfolio) .work { position: static; padding: 0; overflow: visible; }
:is(#sandbox, #portfolio) .feed-cards {
  height: auto;
  padding: 22px var(--gutter) calc(var(--nav) + 28px);
  overflow: visible;
}
:is(#sandbox, #portfolio) .card-viewport { margin: 0; overflow: visible; }
:is(#sandbox, #portfolio) .card-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  transform: none !important;
}
:is(#sandbox, #portfolio) .card-track > .grid { display: contents; }
:is(#sandbox, #portfolio) .card-chev, :is(#sandbox, #portfolio) .card-dots { display: none; }
/* The newest post is the large one; the rest are compact rows. */
.card { flex-direction: row; }
.card-media { flex: 0 0 36%; min-height: 132px; aspect-ratio: auto; }
.card-body { gap: 6px; min-width: 0; padding: 12px 14px; }
.card-meta { gap: 5px; }
.card h2 { font-size: 18px; }
.excerpt { font-size: 14px; }
.when { padding-top: 2px; font-size: 11px; }
.grid:first-child > .card:first-child { flex-direction: column; }
.grid:first-child > .card:first-child .card-media { flex: none; min-height: 0; aspect-ratio: 4 / 3; }
.grid:first-child > .card:first-child .card-body { gap: 10px; padding: 16px 18px 18px; }
.grid:first-child > .card:first-child h2 { font: 800 30px/1.12 "Nunito Sans", sans-serif; }
.grid:first-child > .card:first-child .excerpt { font-size: 16px; -webkit-line-clamp: 3; }
@media (min-width: 560px) {
  :is(#sandbox, #portfolio) .card-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid:first-child > .card:first-child { grid-column: 1 / -1; }
}
/* Cards rise into place the first time they appear. The page script turns this on. */
.reveal-cards a.card { transition: opacity .55s ease, transform .55s ease; }
.reveal-cards a.card:not(.is-in) { opacity: 0; transform: translateY(26px); }

/* Reading pages. The logo keeps a bar at the top; the way back sits at the bottom, within reach of a thumb. */
.sheet { --bar: 52px; font-size: 17px; line-height: 1.65; }
body.is-reading .brand { top: 10px; }
.piece { position: relative; }
.piece::before { content: ""; flex: none; height: var(--bar); }
.read-bar {
  position: static;
  order: 1;
  gap: 10px;
  height: var(--nav);
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  border-top: 1px solid rgba(255,255,255,.12);
  background: #0d0f14;
}
.read-title, .read-next { display: none; }
.read-short { display: block; color: #a9abb0; white-space: nowrap; }
.read-progress { top: var(--bar); bottom: auto; left: var(--gutter); right: var(--gutter); }
.post {
  display: block;
  padding: 26px var(--gutter) 36px;
  overscroll-behavior: contain;
}
.post-rail, #about-long .about-rail {
  position: static;
  max-height: none;
  margin-bottom: 26px;
  overflow: visible;
}
.post-rail h2 { font-size: clamp(34px, 10vw, 44px); }
.stand { font-size: 18px; }
.post-sketch { max-width: 100%; margin-bottom: 28px; }
.post-hero { height: auto; aspect-ratio: 3 / 2; }
.post-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.post-figs figcaption { font-size: 13px; }
.post-parts section, .about-parts section { display: block; padding: 24px 0; }
.post-parts h3 { margin-bottom: 6px; }
.post-prose { max-width: none; }
.post-prose .moment { padding: 20px; }
.post-prose .moment p { font-size: 19px; }
.post-foot { margin-top: 36px; }
.post-share { font-size: 14px; gap: 10px 16px; }
.can-share .post-share .share-native { display: inline; }
.can-share .post-share .share-label, .can-share .post-share .share-site { display: none; }
.post-next { font-size: 20px; }

/* Long About */
.about-mark { width: 92px; margin: 0 0 0 -14px; }
.about-main h1 { font-size: clamp(30px, 8.6vw, 38px); margin-bottom: 24px; }
.about-photos { --figs: 2; }
.about-lead { margin-top: 28px; }
.about-parts h3 { padding-left: 0; text-indent: 0; }
.about-links { grid-template-columns: minmax(0, 1fr); }

/* About: the timeline becomes a list to scroll down, with each period's full text. */
#about .about-block {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 76px var(--gutter) calc(var(--nav) + 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
#about .about-block::-webkit-scrollbar { display: none; }
.about-col {
  position: static;
  order: -1;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  column-gap: 18px;
  align-items: center;
  width: auto;
  max-width: none;
  margin-bottom: 30px;
}
.portrait { grid-row: 1 / span 2; width: 100%; margin: 0; }
.about-name { align-self: end; margin: 0 0 6px; font-size: 24px; }
.about-menu { align-self: start; margin: 0; }
.about-menu .menu { border: 0; font-size: 16px; }
.about-menu li:not(:has(a[href="/about-long"])) { display: none; }
.about-menu a { padding: 4px 0; color: #efa12f; }
.about-menu a::before, .about-menu .idx { display: none; }
.timeline-wrap { position: static; }
.timeline-wrap::before, .chev, .timeline-dots, .timeline-hint, .pin-detail { display: none !important; }
.timeline { margin: 0; overflow: visible; container-type: normal; }
.timeline ol { display: block; width: auto; }
.pin, .pin:nth-child(even) {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: 16px;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 0 0 30px;
  cursor: default;
}
.pin .node { grid-column: 1; grid-row: 1 / span 3; align-self: start; position: relative; z-index: 1; }
.pin.is-selected .node { width: 48px; height: 48px; border: 1px solid rgba(243,243,243,.55); background: #13151a; }
.pin.is-selected .node svg { width: 18px; height: 18px; color: inherit; }
.pin .pill { grid-column: 2; grid-row: 1; justify-self: start; position: static; margin: 0 0 8px; transform: none; }
.pin .pin-label, .pin:nth-child(even) .pin-label { grid-column: 2; grid-row: 2; width: auto; margin: 0; padding: 0; text-align: left; }
.pin-label span { text-align: left; }
.pin .stem { position: absolute; left: 23.5px; top: 48px; bottom: 0; width: 2px; height: auto; background: rgba(243,243,243,.2); }
.pin .stem::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #efa12f;
  transform: scaleY(var(--fill, 0));
  transform-origin: top;
}
.pin:last-child .stem { display: none; }
.pin-full { display: block; grid-column: 2; grid-row: 3; margin-top: 10px; }
.pin-full h3 { margin: 0 0 6px; color: #fff; font: 700 18px/1.3 "Nunito Sans", sans-serif; }
.pin-full p { margin: 0; color: #e6e6e8; font: 400 16px/1.6 "Nunito Sans", sans-serif; }

/* As you scroll, the line grows down the timeline and each period lights up. The page script turns this on. */
.timeline.is-live .node { transition: background .3s ease, border-color .3s ease, color .3s ease; }
.timeline.is-live :is(.pin-label, .pin-full) { transition: opacity .35s ease; }
.timeline.is-live .pin:not(.is-lit) :is(.pin-label, .pin-full) { opacity: .5; }
.timeline.is-live .pin.is-lit .node { border-color: #efa12f; background: #efa12f; color: #16181c; }
.timeline.is-live .pin.is-lit .node svg { color: #16181c; }
.timeline.is-live .pin.is-lit > .pill { border-color: #efa12f; color: #efa12f; }

/* Very short screens, such as a phone turned sideways. */
@media (max-height: 720px) {
  #home .copy { display: none; }
  .rail { padding-bottom: calc(var(--nav) + 20px); }
}
@media (max-height: 500px) {
  .display { margin-bottom: 14px; font-size: 44px; }
}
