:root {
  color-scheme: light dark;
  --paper: #f7f7f3;
  --ink: #171920;
  --muted: #555861;
  --line: #cecfca;
  --blue: #283dd2;
  --tint: #e5e9fc;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: "DM Sans", Arial, sans-serif;
  --display: "Bricolage Grotesque", Arial, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131521;
    --ink: #f4f3ed;
    --muted: #b4b7c6;
    --line: #393c50;
    --blue: #a4afff;
    --tint: #252d57;
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 5px; }
:where(section, article) { scroll-margin-top: 24px; }

.shell {
  width: min(1240px, calc(100% - 112px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 5;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  background: var(--paper);
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

.reading-progress { display: none; }

@supports (animation-timeline: scroll()) {
  .reading-progress {
    display: block;
    position: fixed;
    inset: 0 0 auto;
    z-index: 4;
    height: 3px;
    background: var(--blue);
    pointer-events: none;
    transform-origin: left;
    animation: reading-progress linear both;
    animation-timeline: scroll(root block);
  }

  @keyframes reading-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

.masthead {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.monogram {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.09em;
  text-decoration: none;
}

.monogram span, h1 span { color: var(--blue); }

.masthead nav {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
  align-items: center;
}

.masthead nav a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color .28s ease;
}

.masthead nav a:hover, .work-index a:hover { color: var(--blue); }

.hero {
  display: grid;
  grid-template-columns: .87fr 1fr;
  align-items: center;
  gap: clamp(38px, 6vw, 94px);
  padding-block: clamp(52px, 7vw, 100px) clamp(70px, 8vw, 112px);
}

.greeting {
  margin-bottom: 12px;
  color: var(--blue);
  font: 600 26px / 1.2 var(--display);
}

h1 {
  font-family: var(--display);
  font-size: clamp(76px, 9.25vw, 144px);
  line-height: .83;
  letter-spacing: .015em;
  font-weight: 700;
}

.intro {
  max-width: 39ch;
  margin-top: 30px;
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.55;
  color: var(--muted);
}

.text-link {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  width: fit-content;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 5px;
  transition: text-decoration-color .3s ease;
}

.text-link:hover { text-decoration-color: currentColor; }
.text-link span { transition: transform .45s var(--ease); }
.text-link:hover span { transform: translate(3px, -3px); }

.hero-link { margin-top: 24px; }
.hero-link:hover span { transform: translateY(4px); }

.hero-art {
  position: relative;
  padding: 0 26px 32px 0;
}

.artwork {
  overflow: hidden;
  aspect-ratio: 1.18;
  background: var(--tint);
}

.artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.3s var(--ease);
}

@media (hover: hover) {
  .hero-art:hover .artwork img { transform: scale(1.045); }
}

.portrait {
  position: absolute;
  bottom: 0;
  right: 0;
  width: clamp(96px, 12vw, 166px);
  border: 6px solid var(--paper);
  background: var(--paper);
}

.portrait img {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  height: auto;
  object-fit: cover;
  object-position: center 38%;
}

.work { border-top: 1px solid var(--line); }

.work-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding-block: 54px 42px;
}

.work-header h2 {
  font-family: var(--display);
  font-size: clamp(48px, 6vw, 86px);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.055em;
}

.work-header em {
  color: var(--blue);
  font: 600 1em / .99 var(--display);
  letter-spacing: -.035em;
}

.work-index {
  display: grid;
  min-width: min(250px, 100%);
  gap: 10px;
  padding-bottom: 3px;
}

.work-index a {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: color .28s ease;
}

.work-index span { color: var(--blue); }

.project {
  display: grid;
  grid-template-columns: 1fr .87fr;
  align-items: center;
  gap: clamp(38px, 7vw, 108px);
  padding-block: clamp(34px, 5vw, 64px);
  border-top: 1px solid var(--line);
}

.project--bagai { row-gap: clamp(30px, 4vw, 56px); }
.project--altrubyte { grid-template-columns: .87fr 1fr; }

.project-visual {
  display: grid;
  place-items: center;
  min-height: clamp(270px, 32vw, 420px);
  overflow: hidden;
}

.project-label {
  color: var(--blue);
  font: 500 11px / 1.5 var(--mono);
  letter-spacing: .095em;
  text-transform: uppercase;
}

.project-copy h3 {
  font-family: var(--display);
  margin-block: 10px 15px;
  font-size: clamp(38px, 5vw, 66px);
  font-weight: 800;
  line-height: .99;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.project-copy > p:not(.project-label) {
  max-width: 44ch;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.6;
  color: var(--muted);
}

.project-copy > p.project-note {
  margin-top: 13px;
  font-size: 14px;
}

.project-copy > a { margin-top: 19px; }

.project-meetings {
  grid-column: 1 / -1;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.project-meetings h4 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 28px);
}

.photo-frame {
  display: block;
  padding: clamp(5px, .8vw, 10px);
  border: 1px solid var(--line);
  transition: border-color .35s ease, transform .55s var(--ease);
}

.photo-frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #171920;
}

.project-meetings .photo-frame img { aspect-ratio: 1.95; }

.gallery figcaption, .dictionary-visual figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.project-meetings figcaption { font-size: clamp(14px, 1.35vw, 17px); }

.gallery figcaption a, .dictionary-visual figcaption a {
  text-underline-offset: 3px;
}

.gallery figcaption a:hover, .dictionary-visual figcaption a:hover { color: var(--blue); }
.photo-frame:hover, .photo-frame:focus-visible { border-color: var(--blue); }

.prototype-visual {
  padding: clamp(16px, 2.5vw, 32px);
  background: #e9e5dc;
}

.prototype-visual img {
  width: auto;
  height: clamp(235px, 29vw, 372px);
  box-shadow: 0 6px 22px #241d2c26;
  transition: transform .9s var(--ease);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .prototype-visual:hover img { transform: scale(1.035); }
  .photo-frame:hover { transform: translateY(-4px); }
}

.dictionary-visual {
  display: block;
  padding: clamp(10px, 2vw, 22px);
  background: var(--tint);
}

.dictionary-visual > a { display: block; }
.dictionary-visual img {
  width: 100%;
  height: auto;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 91px;
  border-top: 1px solid var(--line);
}

.site-footer p { font-size: 15px; font-weight: 700; }

html:has(.photo-viewer[open]) { overflow: hidden; }
html { scrollbar-gutter: stable; }

a:has(> img) { cursor: zoom-in; }
.photo-source-hidden { visibility: hidden; }

.photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 64px 24px 32px;
  border: 0;
  background: transparent;
  color: #f7f7f3;
  overflow: hidden;
}

.photo-viewer[open] { display: grid; place-items: center; }

.photo-viewer::backdrop {
  background: rgb(9 11 18 / .76);
  backdrop-filter: blur(12px);
  animation: photo-dim .6s var(--ease) both;
}

.photo-viewer.is-closing::backdrop { animation: photo-undim .4s ease both; }

.photo-viewer figure { display: grid; justify-items: center; gap: 18px; }

.photo-enlarged {
  width: auto;
  height: auto;
  max-width: min(88vw, 1440px);
  max-height: calc(100dvh - 160px);
  object-fit: contain;
  box-shadow: 0 24px 100px rgb(0 0 0 / .35);
  transform-origin: center;
  cursor: zoom-out;
}

.photo-viewer figcaption {
  max-width: min(80vw, 65ch);
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: #dedee4;
  animation: photo-caption .65s .15s both;
}

.photo-close {
  position: absolute;
  top: 16px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid rgb(255 255 255 / .25);
  border-radius: 6px;
  background: rgb(255 255 255 / .08);
  color: inherit;
  font: 500 14px var(--sans);
  cursor: pointer;
  transition: background .2s ease;
}

.photo-close span { font-size: 24px; line-height: 1; }
.photo-close:hover { background: rgb(255 255 255 / .18); }
.photo-close:focus-visible { outline-color: #fff; }
.is-closing :is(.photo-close, figcaption) { opacity: 0; transition: opacity .15s ease; }

@keyframes photo-dim {
  from { background: transparent; backdrop-filter: blur(0); }
  to { background: rgb(9 11 18 / .76); backdrop-filter: blur(12px); }
}

@keyframes photo-undim {
  from { background: rgb(9 11 18 / .76); backdrop-filter: blur(12px); }
  to { background: transparent; backdrop-filter: blur(0); }
}

@keyframes photo-caption {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: settle .98s var(--ease) both; }
  .artwork { animation: unveil 1.18s var(--ease) both; }
  .portrait { animation: settle 1.05s .18s var(--ease) both; }

  .will-reveal:not(.is-visible, :focus-within, :target) :is(.project-visual, .altrubyte-gallery) {
    opacity: 0;
    clip-path: inset(10% 0 0 0);
    transform: translateY(18px);
  }

  .will-reveal:not(.is-visible, :focus-within, :target) .project-copy,
  .work-header.will-reveal:not(.is-visible, :focus-within) {
    opacity: 0;
    transform: translateY(20px);
  }

  .will-reveal :is(.project-visual, .altrubyte-gallery) {
    clip-path: inset(0);
    transition: clip-path 1.15s var(--ease), transform 1.15s var(--ease), opacity .8s ease;
  }

  .will-reveal .project-copy,
  .work-header.will-reveal {
    transition: transform 1.05s var(--ease), opacity .8s ease;
  }

  .will-reveal .project-copy { transition-delay: 100ms; }

  .project-meetings figure.will-reveal {
    transition: transform 1.05s var(--ease), opacity .85s ease;
  }

  .project-meetings figure.will-reveal:nth-child(2) { transition-delay: 100ms; }

  .project-meetings figure.will-reveal:not(.is-visible, :focus-within) {
    opacity: 0;
    transform: translateY(28px);
  }

  @keyframes settle {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes unveil {
    from { clip-path: inset(0 0 0 12%); opacity: 0; }
    to { clip-path: inset(0); opacity: 1; }
  }
}

@media (max-width: 1000px) {
  .shell { width: calc(100% - 72px); }
}

@media (max-width: 760px) {
  .shell { width: calc(100% - 44px); }
  .masthead { min-height: 62px; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 33px;
    padding-block: 49px 52px;
  }

  h1 { font-size: clamp(70px, 14vw, 105px); }
  .greeting { font-size: 23px; }
  .intro { margin-top: 23px; }
  .hero-link { margin-top: 18px; }
  .hero-art { padding: 0 17px 22px 0; }
  .artwork { aspect-ratio: 1.3; }
  .portrait { width: clamp(102px, 20vw, 142px); border-width: 5px; }

  .work-header {
    align-items: start;
    flex-direction: column;
    gap: 24px;
    padding-block: 37px 28px;
  }

  .work-index { gap: 9px; }

  .project, .project--altrubyte {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-block: 27px 33px;
  }

  .project-visual { min-height: clamp(246px, 65vw, 370px); }
  .dictionary-visual { min-height: 0; }
  .project-meetings .gallery { grid-template-columns: minmax(0, 1fr); }
  .project-copy h3 { margin-block: 7px 10px; }
  .site-footer { min-height: 73px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reading-progress { display: none; }
}
