/* harry.me */

:root {
  --bg: #fbfbfa;
  --fg: #1a1a18;
  --muted: #706f6b;
  --faint: #b9b8b3;
  --rule: #e9e8e4;
  --hover: #f2f1ed;
  --matte: #f2f2f2;
  --accent: #e5484d;
  --img-dim: 1;

  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --page: 1200px;
  --pad: 24px;
  --gutter: 24px;
  --space: clamp(112px, 16vw, 208px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dot: 8.5px; /* pitch of the dots in the logo marks */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0e;
    --fg: #ededeb;
    --muted: #9c9b96;
    --faint: #55544f;
    --rule: #242422;
    --hover: #191918;
    --matte: #191918;
    --accent: #ff6369;
    --img-dim: 0.9;
  }
}

:root[data-theme="dark"] {
  --bg: #0f0f0e;
  --fg: #ededeb;
  --muted: #9c9b96;
  --faint: #55544f;
  --rule: #242422;
  --hover: #191918;
  --matte: #191918;
  --accent: #ff6369;
  --img-dim: 0.9;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 48px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2 {
  font-size: inherit;
  font-weight: inherit;
}

ul {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 6px;
  z-index: 10;
}

.skip:focus {
  top: 16px;
}

/* ---------- TL;DR ---------- */

:root:not([data-tldr]) .t-tldr,
:root[data-tldr] .t-full {
  display: none;
}

/* ---------- page + grid ---------- */

.page {
  max-width: calc(var(--page) + var(--pad) * 2);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

.g-label {
  grid-column: 1 / span 3;
}

.g-body {
  grid-column: 4 / span 9;
}

/* ---------- header ---------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
}

.bar-id {
  display: flex;
  gap: 10px;
}

.bar-name {
  font-weight: 600;
}

.bar-role {
  color: var(--muted);
}

.bar-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.bar-nav a {
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.bar-nav a:hover,
.bar-nav a[aria-current="page"] {
  color: var(--fg);
}

.theme {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.theme:hover {
  background: var(--hover);
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  background: linear-gradient(90deg, var(--muted) 50%, transparent 50%);
  transition: transform 0.5s var(--ease);
}

.theme:hover .theme-dot {
  transform: rotate(180deg);
}

/* ---------- hero ---------- */

.hero-stage {
  position: relative;
  height: clamp(340px, 66vh, 680px);
  margin: 0 calc(var(--pad) * -1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}

.hero-canvas.is-live {
  opacity: 1;
}

.hero--off .hero-stage,
.hero--off .hero-note {
  display: none;
}

.hero--off {
  padding-top: 12vh;
}

.hero-text {
  row-gap: 32px;
  margin-top: 24px;
}

.hero-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 230px;
}

.hero-form {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.hero-name {
  transition: opacity 0.4s var(--ease);
}

.hero-name.is-swapping {
  opacity: 0;
}

.hero-hint {
  margin-top: 0.5em;
  color: var(--faint);
}

.statement {
  max-width: 21em;
  font-size: clamp(25px, 3.1vw, 38px);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.about {
  max-width: 36em;
  margin-top: 28px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.about a,
.hero-caption a,
.foot a,
.prose a,
.lede a,
.eyebrow a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s var(--ease);
}

.hero-caption a,
.eyebrow a {
  color: inherit;
}

.about a:hover,
.hero-caption a:hover,
.foot a:hover,
.prose a:hover,
.lede a:hover,
.eyebrow a:hover {
  text-decoration-color: var(--fg);
}

/* ---------- companies + work ---------- */

.company,
.list,
.foot {
  margin-top: var(--space);
}

.company-head {
  align-items: baseline;
  margin-bottom: 40px;
}

.company-head h2,
.list > h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.company-id {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.mark {
  display: block;
  height: 64px; /* replaced by rows × --dot once drawn */
  width: auto;
}

.company-info {
  max-width: 36em;
}

.company-years {
  margin-left: 6px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.company-blurb {
  margin-top: 4px;
  color: var(--muted);
}

.works {
  display: grid;
  gap: clamp(64px, 9vw, 120px);
}

.work {
  display: block;
}

.work-img,
.fig-img {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--matte);
}

.work-img::after,
.fig-img::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
  pointer-events: none;
}

.work-img img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  filter: brightness(var(--img-dim));
  transition: transform 0.9s var(--ease);
}

.work:hover .work-img img {
  transform: scale(1.012);
}

.work-meta {
  align-items: baseline;
  padding-top: 16px;
}

.work-title {
  font-weight: 500;
}

.work-tag {
  color: var(--muted);
}

.work:hover .arrow {
  transform: translateX(4px);
  color: var(--fg);
}

/* ---------- company page ---------- */

.case-head .company-id h1 {
  margin-top: 4px;
}

.contents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  margin-top: 28px;
  padding: 0;
  list-style: none;
}

.contents a {
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s var(--ease);
}

.contents a:hover {
  text-decoration-color: var(--fg);
}

.contents-verb {
  margin-left: 4px;
  color: var(--muted);
}

.project {
  margin-top: var(--space);
  scroll-margin-top: 48px;
}

.project-head {
  align-items: baseline;
  row-gap: 12px;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.project h2 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.project .lede {
  margin-top: 18px;
}

.project .case-meta {
  margin-top: 24px;
}

.project .case-close {
  margin-top: clamp(56px, 8vw, 96px);
}

.more {
  margin-top: clamp(40px, 6vw, 64px);
}

.more summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.more summary::-webkit-details-marker {
  display: none;
}

.more summary::before {
  content: "+";
  font-weight: 500;
}

.more[open] summary::before {
  content: "−";
}

.more summary:hover {
  color: var(--fg);
  border-color: var(--faint);
}

.more-close,
.more[open] .more-open {
  display: none;
}

.more[open] .more-close {
  display: inline;
}

.more[open] > .figs {
  margin-top: clamp(40px, 6vw, 64px);
  animation: rise 0.6s var(--ease);
}

/* ---------- rows ---------- */

.list {
  align-items: baseline;
  row-gap: 24px;
}

.rows {
  border-top: 1px solid var(--rule);
}

.soon {
  margin: 0;
  padding: 20px 0;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.rows > li {
  border-bottom: 1px solid var(--rule);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 24px;
  margin: 0 -12px;
  padding: 14px 12px;
  border-radius: 8px;
  transition: background 0.2s var(--ease);
}

a.row:hover {
  background: var(--hover);
}

/* The mark column is as wide as the widest mark in the list, so every title starts on the same line. */
.row--mark {
  grid-template-columns: calc(var(--mark-cols, 12) * var(--dot)) minmax(0, 1fr) auto;
  gap: 24px;
}

.row--mark .mark {
  align-self: center;
}

.row-main {
  display: flex;
  flex-direction: column;
}

.row-title {
  font-weight: 500;
}

.row-desc,
.row-meta {
  color: var(--muted);
}

.row-meta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.arrow {
  display: inline-block;
  color: var(--muted);
  font-weight: 400;
  transition: transform 0.25s var(--ease), color 0.2s var(--ease);
}

a.row:hover .arrow {
  transform: translate(2px, -2px);
  color: var(--fg);
}

/* ---------- footer ---------- */

.foot {
  align-items: baseline;
  row-gap: 8px;
  padding-bottom: 96px;
  color: var(--muted);
}

.foot-meta {
  font-variant-numeric: tabular-nums;
}

.clock:not(:empty)::before {
  content: "· ";
}

/* ---------- case study ---------- */

.case-head,
.note,
.list--page {
  margin-top: clamp(48px, 9vw, 120px);
}

.case-head {
  align-items: baseline;
  row-gap: 16px;
  margin-bottom: clamp(56px, 8vw, 96px);
}

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

.case h1,
.note h1,
.page-head h1 {
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 33em;
  margin-top: 24px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 48px;
  margin-top: 36px;
}

/* optional three-part story under a project's summary: before, after, what I did */
.case-story {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 36px;
  margin-top: 36px;
}

.case-story.n2,
.case-story.n4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 48px;
}

.case-story dt {
  color: var(--muted);
  margin-bottom: 8px;
}

.case-story dd {
  margin: 0;
}

@media (max-width: 820px) {
  .case-story,
  .case-story.n2,
  .case-story.n4 {
    grid-template-columns: 1fr;
  }
}

.case-meta dt {
  color: var(--muted);
}

.figs {
  display: grid;
  gap: clamp(48px, 7vw, 96px);
}

.fig-img img {
  width: 100%;
  cursor: zoom-in;
  filter: brightness(var(--img-dim));
}

/* A frame waiting on its image. The build warns while any of these exist. */
.fig-todo {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border: 1px dashed var(--faint);
  background: transparent;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.fig-todo::after {
  display: none;
}

.fig-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: start;
}

figcaption {
  max-width: 40em;
  padding-top: 14px;
  color: var(--muted);
}

.case-close {
  margin-top: var(--space);
}

.next {
  margin-top: var(--space);
  border-top: 1px solid var(--rule);
}

.next .work-meta {
  padding: 28px 0 0;
}

.next .work-title {
  color: var(--muted);
  font-weight: 400;
}

.next-title {
  font-size: clamp(28px, 4.4vw, 52px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.next .arrow {
  font-weight: 400;
}

.next a:hover .arrow {
  transform: translateX(6px);
  color: var(--fg);
}

/* ---------- notes ---------- */

.note {
  align-items: baseline;
  row-gap: 16px;
}

.page-head {
  margin-bottom: 32px;
}

.prose {
  max-width: 35em;
  margin-top: 40px;
  font-size: 18px;
  line-height: 1.65;
}

.prose > * + * {
  margin-top: 1.2em;
}

.prose p {
  text-wrap: pretty;
}

.prose.t-tldr {
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.3;
  letter-spacing: -0.02em;
  max-width: 24em;
}

.prose h2 {
  margin-top: 2em;
  font-weight: 600;
}

.prose h2 + p {
  margin-top: 0.4em;
}

.prose ul {
  padding-left: 1.2em;
  list-style: disc;
}

.prose blockquote {
  margin: 1.6em 0;
  padding-left: 18px;
  border-left: 1px solid var(--fg);
}

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* ---------- TL;DR switch ---------- */

.tldr {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.06);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  view-transition-name: tldr;
  transition: border-color 0.2s var(--ease);
}

.tldr:hover {
  border-color: var(--faint);
}

.tldr-label {
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tldr-saved {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tldr-saved:empty {
  display: none;
}

.tldr-switch {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--faint);
  transition: background 0.3s var(--ease);
}

.tldr-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.3s var(--ease);
}

.tldr[aria-pressed="true"] .tldr-switch {
  background: var(--fg);
}

.tldr[aria-pressed="true"] .tldr-switch::after {
  transform: translateX(12px);
}

/* ---------- lightbox ---------- */

.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 3vmin;
  border: 0;
  background: transparent;
  cursor: zoom-out;
}

.lightbox[open] {
  display: grid;
  place-items: center;
  animation: fade 0.25s var(--ease);
}

.lightbox::backdrop {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade 0.25s var(--ease);
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 6vmin);
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06), 0 24px 80px rgb(0 0 0 / 0.18);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ---------- motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-text,
  .case-head,
  .note,
  .list--page {
    animation: rise 0.7s var(--ease) 0.05s backwards;
  }

  .figs {
    animation: rise 0.7s var(--ease) 0.15s backwards;
  }
}

/* The TL;DR swap is a quick crossfade of the page. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.28s;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 799px) {
  :root {
    --pad: 20px;
    --gutter: 16px;
  }

  .g-label,
  .g-body {
    grid-column: 1 / -1;
  }

  .bar {
    padding: 18px 0;
  }

  .bar-role {
    display: none;
  }

  .bar-nav {
    gap: 18px;
  }

  .hero-stage {
    height: clamp(300px, 52vh, 460px);
  }

  .hero-text {
    margin-top: 8px;
  }

  .hero-note {
    order: 2;
    max-width: none;
  }

  .company-head {
    row-gap: 6px;
    margin-bottom: 28px;
  }

  .company-id {
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  :root {
    --dot: 6px;
  }

  .work-img,
  .fig-img {
    border-radius: 10px;
  }

  .work-meta {
    padding-top: 12px;
  }

  .next .work-meta {
    row-gap: 6px;
  }

  .prose {
    font-size: 17px;
  }
}

@media (max-width: 599px) {
  .fig-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Title and meta share a line; the description takes the full width below. */
  .row {
    gap: 0 16px;
  }

  .row-main {
    display: contents;
  }

  .row-title {
    grid-column: 1;
  }

  .row-meta {
    grid-column: 2;
    grid-row: 1;
  }

  .row-desc {
    grid-column: 1 / -1;
  }

  .row--mark {
    grid-template-columns: calc(var(--mark-cols, 12) * var(--dot)) minmax(0, 1fr) auto;
    gap: 2px 16px;
  }

  .row--mark .mark {
    grid-row: 1 / span 2;
  }

  .row--mark .row-title {
    grid-column: 2;
  }

  .row--mark .row-meta {
    grid-column: 3;
  }

  .row--mark .row-desc {
    grid-column: 2 / -1;
  }
}

/* ---------- locked pages ---------- */

/* The password takeover: a full-screen dialog over the home page (or over a work page reached by direct link). */
.gate {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--fg);
  background: var(--bg);
  overflow: auto;
}

.gate::backdrop {
  background: var(--bg);
}

.gate[open] {
  display: grid;
  place-items: center;
  animation: gate-in 0.4s var(--ease);
}

.gate[open] .gate-box {
  animation: gate-rise 0.6s var(--ease);
}

@keyframes gate-in {
  from { opacity: 0; }
}

@keyframes gate-rise {
  from { opacity: 0; transform: translateY(14px); }
}

.gate-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(440px, 100% - 48px);
  padding: 96px 0;
}

.gate-box h2 {
  margin: 24px 0 0;
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.gate-note {
  margin: 20px 0 24px;
  color: var(--muted);
}

.gate-close {
  position: fixed;
  top: 20px;
  right: var(--pad);
  padding: 8px 4px;
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.gate-close:hover,
.gate-close:focus-visible {
  color: var(--fg);
}

.lock {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .gate[open],
  .gate[open] .gate-box {
    animation: none;
  }
}

.lock-row {
  display: flex;
  gap: 8px;
}

.lock-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lock input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font: inherit;
  color: var(--fg);
  background: var(--hover);
  border: 1px solid var(--rule);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.lock input:focus-visible {
  border-color: var(--fg);
}

.lock button {
  height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 500;
  color: var(--bg);
  background: var(--fg);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.lock button:disabled {
  opacity: 0.5;
  cursor: default;
}

.lock-msg {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--accent);
}

.lock-ask {
  margin: 4px 0 0;
  color: var(--muted);
}

.lock.is-wrong .lock-row {
  animation: lock-no 0.32s var(--ease);
}

@keyframes lock-no {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .lock.is-wrong .lock-row {
    animation: none;
  }
}

.work[data-open] .work-lock {
  display: none; /* already unlocked in this browser */
}

.work-lock {
  margin-left: 10px;
  padding: 2px 8px;
  font-size: 0.8em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
}
