@font-face {
  font-family: Gloock;
  src: url("fonts/gloock-latin.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #000;
  color: #fff;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  --heading-font: Gloock, Georgia, serif;
  --gutter: clamp(20px, 4vw, 64px);
  --layout-width: 76rem;
  --reading-width: 65ch;
  --wide-copy-width: 96ch;
  --column-gap: clamp(32px, 4vw, 64px);
  --muted: #c8c8c8;
  --border: #404040;
  --frame: clamp(5px, .45vw, 12px) solid #fff;
  --entry-text-size: clamp(1.125rem, 1.025rem + .3vw, 1.3125rem);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid #cabaff; outline-offset: 4px; }
.skip-link { position: absolute; z-index: 2; top: 12px; left: 12px; padding: 12px; background: white; color: black; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

main { padding: 0 var(--gutter) clamp(48px, 9vw, 120px); }
.entries {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin: 18px auto 0;
  max-width: var(--layout-width);
}
.entry-control {
  display: flex;
  align-items: center;
  gap: .7em;
  min-height: 48px;
  max-width: 100%;
  padding: 10px clamp(9px, 1.4vw, 22px);
  border: 1px solid #777;
  border-radius: 8px;
  background: #101010;
  color: inherit;
  font: inherit;
  font-size: clamp(1rem, .95rem + .15vw, 1.125rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.entry-control:not(:disabled):hover { background: #242424; border-color: #fff; }
.entry-control:disabled { color: #949494; border-color: var(--border); background: #080808; }
.entry-caption { min-width: 0; }
.entry-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.previous, .next { max-width: min(100%, 32rem); }
.previous { justify-self: start; text-align: left; }
.next { justify-self: end; text-align: right; }
.entry-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 16px;
  height: 16px;
}
.entry-arrow::after {
  content: "";
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateX(-2px) rotate(45deg);
}
.previous .entry-arrow { transform: rotate(180deg); }
.entry-list-button {
  justify-content: center;
  width: 48px;
  padding: 0;
  cursor: pointer;
}
.menu-icon {
  width: 20px;
  height: 14px;
  border-block: 2px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}

article { max-width: var(--reading-width); margin-inline: auto; padding-top: clamp(32px, 5vw, 72px); font-size: var(--entry-text-size); }
article header { margin-bottom: clamp(28px, 3vw, 40px); }
article > header, .lead-copy, .entry-section > .section-copy:only-child {
  width: 100%;
  max-width: var(--reading-width);
  margin-inline: auto;
}
h1, h2 { font-family: var(--heading-font); font-weight: 400; }
h1 { margin: 0; font-size: clamp(2rem, 1.25rem + 4vw, 4.25rem); line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
time { display: block; margin-top: 18px; color: var(--muted); font-size: clamp(1rem, .95rem + .15vw, 1.125rem); }
p { max-width: var(--reading-width); font-size: var(--entry-text-size); line-height: 1.65; margin-block: 0 1.1em; text-wrap: pretty; overflow-wrap: anywhere; }
p:last-child { margin-bottom: 0; }
h2 { margin: 0 0 .6em; font-size: clamp(1.8rem, 1.4rem + 1vw, 2.5rem); line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }

.diary-post { max-width: var(--layout-width); }
.diary-post > header,
.diary-post > .lead-copy {
  max-width: none;
  text-align: start;
}
.diary-post h1 { text-wrap: wrap; overflow-wrap: anywhere; }
.diary-post > .lead-copy,
.diary-post > .entry-section > .section-copy:only-child { margin-inline: 0; }
.diary-post > .lead-copy p,
.diary-post > p.lead-copy,
.diary-post > .entry-section > .section-copy:only-child,
.diary-post > .entry-section > .section-copy:only-child p { max-width: var(--wide-copy-width); }

.entry-section { margin-top: clamp(40px, 5vw, 72px); border-top: 1px solid var(--border); padding-top: clamp(32px, 4vw, 56px); }
figure { margin: 0; }
article figure { margin-top: clamp(22px, 3vw, 46px); }
figure.motion { max-width: 720px; }
.image-preview { position: relative; display: block; cursor: zoom-in; }
.image-preview img, .image-dialog img, video { display: block; width: 100%; height: auto; }
.image-preview img, .image-dialog img, .motion video, .motion iframe { border: var(--frame); }
.motion iframe { display: block; width: 100%; aspect-ratio: 16 / 9; }
.motion video { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; background: #000; }
.video-preview { position: relative; }
.video-preview-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.video-preview-play::before {
  content: "";
  width: 52px;
  height: 52px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: rgb(0 0 0 / 65%);
  grid-area: 1 / 1;
}
.video-preview-play::after {
  content: "";
  border-block: 9px solid transparent;
  border-inline-start: 15px solid currentColor;
  margin-inline-start: 4px;
  grid-area: 1 / 1;
}
.video-preview-play:hover::before,
.video-preview-play:focus-visible::before { background: #000; }
.outfit-videos { display: grid; gap: 20px; margin-top: 22px; }
.outfit-videos iframe, .video-pending {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: var(--frame);
  background: #101010;
}
.video-pending {
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
  font-size: clamp(1rem, 1.2vw, 1.3rem);
}
.video-pending span + span { color: var(--muted); font-size: .9em; }
.enlarge-icon {
  display: grid;
  place-items: center;
  position: absolute;
  inset: auto 16px 16px auto;
  width: 40px;
  height: 40px;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  font-size: 1.65rem;
  line-height: 1;
}
.image-preview:hover .enlarge-icon { background: #000; color: #fff; border-color: #fff; }
figcaption { color: var(--muted); font-size: clamp(1rem, .9vw, 1.35rem); line-height: 1.4; margin-top: 12px; }

.code-example { margin-top: clamp(32px, 4vw, 72px); }
.code-example h3 {
  margin: 0 0 .55em;
  font-family: var(--heading-font);
  font-size: clamp(1.45rem, 2vw, 2.5rem);
  font-weight: 400;
}
.code-editor {
  border: 1px solid #465069;
  border-radius: 8px;
  background: #10131a;
  color: #e7ecf5;
  font: var(--entry-text-size)/1.55 "IBM Plex Mono", Consolas, monospace;
}
.code-language {
  display: block;
  padding: 8px 16px;
  border-bottom: 1px solid #465069;
  border-radius: 7px 7px 0 0;
  background: #1b202b;
  color: #d0d9ea;
  font-size: .78em;
}
.code-editor pre {
  margin: 0;
  padding: clamp(14px, 2vw, 36px);
  overflow: auto;
  font: inherit;
}
.code-editor code { font: inherit; }
.code-keyword { color: #d7adff; }
.code-type { color: #8be0d2; }
.code-function { color: #a8ccff; }
.code-number { color: #ffcf9f; }

html:has(.diary-dialog[open]) { overflow: hidden; }
.diary-dialog {
  width: fit-content;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  background: #101010;
  color: #fff;
  overflow: auto;
}
.diary-dialog::backdrop { background: rgb(0 0 0 / 88%); }
.image-dialog form { display: flex; justify-content: flex-end; padding: 6px; }
.diary-dialog button {
  min-height: 44px;
  padding-inline: 14px;
  border: 1px solid #777;
  background: #101010;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.diary-dialog button:hover { background: #fff; color: #000; }
.image-dialog img {
  width: auto;
  max-width: min(100%, 1800px);
  max-height: calc(100dvh - 180px);
  object-fit: contain;
  margin-inline: auto;
}
.image-dialog figcaption { margin: 0; padding: 12px 14px; }

.entry-list {
  position: fixed;
  inset: 0 auto 0 0;
  margin: 0;
  width: min(440px, calc(100vw - 24px));
  max-width: none;
  height: 100dvh;
  max-height: none;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.entry-list[open] { display: flex; flex-direction: column; }
.entry-list::backdrop { background: rgb(0 0 0 / 65%); }
@media (prefers-reduced-motion: no-preference) {
  .entry-list[open] { animation: open-entry-list 220ms ease-out; }
  @keyframes open-entry-list {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
  }
}
.entry-list > header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid var(--border);
}
.entry-list h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.45rem); }
.drawer-close {
  display: grid;
  place-items: center;
  width: 44px;
  border-radius: 8px;
}
.close-icon { display: grid; place-items: center; }
.close-icon::before, .close-icon::after {
  content: "";
  grid-area: 1 / 1;
  width: 17px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.close-icon::before { transform: rotate(45deg); }
.close-icon::after { transform: rotate(-45deg); }
.entry-list ul {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 8px;
  list-style: none;
}
.entry-list li + li { border-top: 1px solid var(--border); }
.entry-list a {
  display: block;
  padding: 13px clamp(10px, 2vw, 22px);
  text-decoration: none;
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  overflow-wrap: anywhere;
}
.entry-list a[aria-current="page"] { background: #222; }
.entry-list a:hover { background: #303030; }
.entry-list a:focus-visible { outline-offset: -4px; }
.entry-list time { margin-top: 4px; font-size: .9rem; }
.archive-empty { margin: 22px 30px; color: var(--muted); }

.portrait-sheet, .portrait-clip { width: min(100%, 28rem); margin-inline: auto; }
.portrait-clip video { aspect-ratio: 10 / 11; }

@media (width < 70rem) {
  .diary-post > .lead-media,
  .diary-post > .entry-section:has(> :is(figure, .outfit-videos)) {
    max-width: var(--reading-width);
    margin-inline: auto;
  }
}

/* Put lead media beside the intro when both have room. */
@media (min-width: 70rem) {
  article, .entry-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    column-gap: var(--column-gap);
    align-items: start;
  }
  article { max-width: var(--layout-width); grid-template-rows: auto 1fr; }
  article > * { grid-column: 1 / -1; min-width: 0; }
  .diary-post:has(> .lead-media) > .lead-copy { grid-column: 1; }
  .diary-post > .lead-media { grid-column: 2; grid-row: 2; }
  article figure { margin-top: 0; }
  .entry-section > * { min-width: 0; }
  .section-copy { grid-column: 1; }
  .entry-section > .section-copy:only-child { grid-column: 1 / -1; }
  .outfit-videos { grid-column: 2; grid-row: 1; margin-top: 0; }
  .entry-section > figure { grid-column: 2; grid-row: 1; }
  .entry-section > .code-example { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .entries { gap: 8px; grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr); }
  .entry-control:not(.entry-list-button) { gap: .5em; padding-inline: 8px; }
}

.studio-intro, .diary-context { max-width: var(--layout-width); margin: 1.5rem auto; color: var(--muted); font-size: 1rem; line-height: 1.6; }
#entry > ul { line-height: 1.6; padding-left: 1.25rem; }
#entry > ul li { margin-bottom: 1rem; }
#entry > ul time { display: block; color: var(--muted); font-size: .9rem; }
