:root {
  --ink: #111111;
  --paper: #ffffff;
  --soft: #f4f4f1;
  --line: rgba(17, 17, 17, 0.22);
  --content: 1280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* 初期表示は必ず Drool Puppy #1（#00C3F2）から始まる。JSが同じ値を入れるので、
     ここを合わせておくとリロード時に色が切り替わって見えることがない。
     初期作品を変えるときは、この色と .hero / .site-header の初期色も合わせて変更する。 */
  background-color: #00c3f2;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

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

a {
  text-decoration: none;
}

.site-header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 108px;
  padding-inline: max(24px, calc((100vw - var(--content)) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  color: #ff3c0d; /* = 初期作品 #00C3F2 の反転色。JSが同じ値を入れるのでリロード時に切り替わらない */
  transition: opacity 300ms ease, color 240ms ease;
}

.site-header.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 0.35em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(18px, 2vw, 27px);
  font-weight: 700;
  letter-spacing: 0;
}

.site-header nav {
  display: flex;
  gap: clamp(24px, 4vw, 60px);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.site-header a:hover,
.site-header a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.hero {
  min-height: min(900px, 100svh);
  padding: 132px max(24px, calc((100vw - var(--content)) / 2)) 48px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: clamp(36px, 6vw, 100px);
  background: #00c3f2;
  transition: background-color 240ms ease;
}

.hero-art-wrap {
  display: grid;
  place-items: center;
  min-width: 0;
}

.hero-art {
  width: min(100%, 640px, 66vh);
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.hero-info {
  align-self: center;
  width: min(100%, 640px);
  min-height: 286px;
}

.hero-controls {
  width: min(100%, 420px);
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  align-items: center;
  margin-bottom: 40px;
  border-block: 1px solid currentColor;
}

.arrow-button {
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 27px;
}

.arrow-button:hover,
.arrow-button:focus-visible {
  background: rgba(255, 255, 255, 0.38);
  outline: none;
}

.hero-number {
  margin: 0;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.hero-title {
  width: 100%;
  height: 164px;
  max-width: 640px;
  margin: 0 0 6px;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(34px, 5vw, 76px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.07em;
}

.hero-title-viewport {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.hero-title-track,
.hero-title-token {
  display: block;
  width: max-content;
  max-width: none;
}

.hero-title-track.is-scrolling {
  will-change: transform;
}

.opensea-link {
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 1px solid currentColor;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.opensea-link.is-unavailable {
  visibility: hidden;
  pointer-events: none;
}

.section {
  width: min(calc(100% - 48px), var(--content));
  margin-inline: auto;
  padding-block: clamp(90px, 12vw, 180px);
}

.eyebrow {
  margin: 0 0 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.section h2 {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.07em;
}

.about {
  width: 100%;
  max-width: none;
  padding-inline: max(24px, calc((100vw - var(--content)) / 2));
  background: #cde3ee;
  min-height: 720px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "heading copy"
    "mark copy";
  gap: 72px clamp(48px, 8vw, 140px);
  align-items: start;
}

.section-heading {
  grid-area: heading;
}

.about .section-heading h2 {
  line-height: 1.08;
}

.about-copy {
  grid-area: copy;
  max-width: 600px;
  margin-top: 34px;
  font-size: clamp(18px, 2.1vw, 29px);
  line-height: 1.45;
}

.about-copy p:first-child {
  margin-top: 0;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.about-palette {
  grid-area: mark;
  width: clamp(320px, 34vw, 500px);
  margin-top: calc(-1 * clamp(12px, 3.04vw - 26px, 26px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.about-palette span {
  aspect-ratio: 1;
  background: var(--swatch);
}

.gallery {
  width: 100%;
  max-width: none;
  padding-inline: max(24px, calc((100vw - var(--content)) / 2));
  background: var(--soft);
}

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 60px;
}

.gallery-note {
  margin: 0 0 5px;
  color: #666;
  font-size: 12px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 36px) clamp(12px, 1.8vw, 28px);
}

.gallery-card {
  min-width: 0;
}

.gallery-open {
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.gallery-open img {
  width: 100%;
  aspect-ratio: 1;
  transition: transform 160ms steps(2, end);
  image-rendering: pixelated;
}

.gallery-open:hover img,
.gallery-open:focus-visible img {
  transform: scale(1.035);
}

.gallery-open:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.gallery-title {
  margin: 10px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

footer {
  min-height: 160px;
  padding-inline: max(24px, calc((100vw - var(--content)) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.art-dialog {
  width: min(88vw, 760px);
  max-width: none;
  max-height: 92svh;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: white;
}

.art-dialog::backdrop {
  background: rgba(0, 0, 0, 0.88);
}

.art-dialog img {
  width: min(78vw, 680px);
  margin-inline: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.dialog-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: 1px solid white;
  border-radius: 50%;
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.dialog-meta {
  width: min(78vw, 680px);
  margin: 14px auto 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.dialog-meta p {
  margin: 0;
}

.dialog-meta a {
  border-bottom: 1px solid currentColor;
}

body.dialog-open {
  overflow: hidden;
}

noscript {
  display: block;
  padding: 24px;
  text-align: center;
}

@media (max-width: 900px) {
  .hero {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 138px;
    padding-bottom: 70px;
  }

  .hero-art {
    width: min(78vw, 520px);
  }

  .hero-info {
    width: 100%;
    max-width: 520px;
    min-width: 0;
    min-height: 0;
    margin-inline: auto;
    text-align: center;
  }

  .hero-controls {
    margin-inline: auto;
    margin-bottom: 28px;
  }

  .hero-title {
    height: 1.12em;
    max-width: 100%;
    display: block;
    margin-bottom: 24px;
    margin-inline: auto;
    text-align: center;
  }

  .hero-title-track:not(.is-scrolling) {
    margin-inline: auto;
  }

  .hero-title-token {
    display: none;
  }

  .about {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "copy"
      "mark";
    gap: 48px;
  }

  .about-copy {
    margin-top: 0;
  }

  .about-palette {
    margin-top: 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .site-header {
    width: 100%;
    min-height: 82px;
    padding-inline: 16px;
  }

  .brand {
    font-size: 14px;
  }

  .site-header nav {
    gap: 18px;
    font-size: 10px;
  }

  .hero {
    padding: 112px 16px 54px;
  }

  .hero-art {
    width: min(88vw, 430px);
  }

  .hero-title {
    font-size: clamp(31px, 11vw, 48px);
  }

  .section {
    width: calc(100% - 32px);
    padding-block: 84px;
  }

  .about {
    width: 100%;
    padding-inline: 16px;
  }

  .about-copy {
    font-size: 18px;
  }

  .about-palette {
    width: 100%;
    max-width: 400px;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
  }

  .gallery {
    width: 100%;
    padding-inline: 16px;
  }

  .gallery-heading {
    align-items: start;
    flex-direction: column;
    margin-bottom: 36px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 12px;
  }

  .gallery-title {
    font-size: 10px;
  }

  footer {
    padding: 30px 16px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .dialog-meta {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
