body {
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.12), transparent 28%),
    linear-gradient(180deg, #120d1b 0%, #101827 100%);
}

.page-shell {
  padding-top: 54px;
}

.page-hero {
  margin-bottom: 26px;
}

.page-title {
  margin-bottom: 12px;
}

.page-subtitle {
  max-width: 800px;
}

.category-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.category-card.page-card {
  min-height: 260px;
  padding: 22px;
}

.page-card .icon {
  font-size: 2.5rem;
}

.books-page {
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
}

.books-page .page-title, .books-page .eyebrow {
  color: #dbeafe;
}

.books-page .category-card.page-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(59, 130, 246, 0.12));
}

.experiments-page {
  background: linear-gradient(180deg, #07151a 0%, #10232b 100%);
}

.experiments-page .page-title, .experiments-page .eyebrow {
  color: #bbf7d0;
}

.experiments-page .category-card.page-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(14, 165, 233, 0.14));
}

.d3-page {
  background: linear-gradient(180deg, #1f102c 0%, #2a1244 100%);
}

.d3-page .page-title, .d3-page .eyebrow {
  color: #f3d3ff;
}

.d3-page .category-card.page-card {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18), rgba(99, 102, 241, 0.12));
}

.origami-page {
  background: linear-gradient(180deg, #1a1d1f 0%, #1b2e2a 100%);
}

.origami-page .page-title, .origami-page .eyebrow {
  color: #fef3c7;
}

.origami-page .category-card.page-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(34, 197, 94, 0.14));
}

.page-topbar {
  color: inherit;
}

.page-hero-block {
  padding: 24px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.7);
  box-shadow: var(--shadow);
}

.gallery-item .gallery-visual {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.22), rgba(167, 139, 250, 0.18));
}

.books-page .gallery-item .gallery-visual {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.26), rgba(96, 165, 250, 0.14));
}

.experiments-page .gallery-item .gallery-visual {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(14, 165, 233, 0.16));
}

.d3-page .gallery-item .gallery-visual {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.24), rgba(168, 85, 247, 0.16));
}

.origami-page .gallery-item .gallery-visual {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(134, 239, 172, 0.15));
}

/* About page: Hayk's photo, bio and a timeline that grows over time */
.about-page {
  background: linear-gradient(180deg, #0f1229 0%, #1d1440 100%);
}

.about-page .page-title {
  color: #e9d5ff;
}

.profile {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 32px 0 36px;
}

.profile-intro .page-subtitle {
  margin-bottom: 26px;
  line-height: 1.8;
}

.photo-frame {
  position: relative;
  padding: 5px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  transition: transform 0.3s ease;
}

.photo-frame img {
  width: 100%;
  height: auto;
  border-radius: 19px;
}

.profile-photo figcaption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.profile-heading {
  margin-bottom: 14px;
  font-size: 1.15rem;
}

.profile-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Each interest links to its section and wears that section's colour */
.profile-tags a {
  --tag: 167, 139, 250;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(var(--tag), 0.35);
  border-radius: 14px;
  background: rgba(var(--tag), 0.14);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.profile-tags a.books {
  --tag: 129, 140, 248;
}

.profile-tags a.experiments {
  --tag: 52, 211, 153;
}

.profile-tags a.d3 {
  --tag: 244, 114, 182;
}

.profile-tags a.origami {
  --tag: 251, 191, 36;
}

/* Timeline: the year is written once, its steps hang from the line below it */
.timeline-group + .timeline-group {
  margin-top: 22px;
}

.timeline-year {
  margin-bottom: 12px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.timeline {
  list-style: none;
  display: grid;
  gap: 16px;
  padding-left: 22px;
  border-left: 2px solid rgba(125, 211, 252, 0.3);
  line-height: 1.6;
}

.timeline li {
  position: relative;
}

.timeline li::before {
  content: '';
  position: absolute;
  top: 6px;
  left: -29px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 4px rgba(125, 211, 252, 0.15);
}


@media (hover: hover) {
  .photo-frame:hover {
    transform: translateY(-4px) rotate(-1deg);
  }

  .profile-tags a:hover {
    transform: translateY(-2px);
    background: rgba(var(--tag), 0.26);
    border-color: rgba(var(--tag), 0.55);
  }
}

/* Tablets in portrait and phones: photo on top, smaller */
@media (max-width: 767.98px) {
  .profile {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 16px 0 28px;
  }

  .profile-photo {
    width: min(100%, 280px);
    margin: 0 auto;
  }
}

@media (max-width: 599.98px) {
  .profile-photo {
    width: min(100%, 240px);
  }

  .page-shell {
    padding-top: 24px;
  }

  .page-hero {
    margin-bottom: 16px;
  }

  .page-hero-block {
    padding: 14px;
  }
}

/* Book reading page */
.reader {
  padding-top: 40px;
}

.book-intro {
  display: flex;
  justify-content: center;
  padding: 8px 0 52px;
}

.reader .cover-art {
  width: min(100%, 280px);
}

.story {
  max-width: 680px;
  margin: 0 auto;
  color: #e6eefb;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.25rem);
  font-weight: 400;
  line-height: 1.9;
}

.story p + p {
  margin-top: 1em;
}

.story-page + .story-page {
  position: relative;
  margin-top: 56px;
  padding-top: 56px;
}

/* Between pages: three small orbs in the site's colours instead of page numbers */
.story-page + .story-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 62px;
  height: 10px;
  translate: -50% -50%;
  background:
    radial-gradient(circle, var(--accent) 0 3px, transparent 4px) left center / 10px 10px no-repeat,
    radial-gradient(circle, var(--accent-2) 0 3px, transparent 4px) center / 10px 10px no-repeat,
    radial-gradient(circle, var(--accent-3) 0 3px, transparent 4px) right center / 10px 10px no-repeat;
}

/* A large first letter opens the story */
.story-page:first-child p:first-of-type::first-letter {
  float: left;
  margin: 0.1em 0.12em 0 0;
  color: var(--accent-2);
  font-size: 3.4em;
  font-weight: 800;
  line-height: 0.8;
}

/* Hayk's pictures: a little wider than the text on big screens */
.story-figure {
  width: min(calc(100vw - 32px), 820px);
  margin: 32px 0 32px 50%;
  translate: -50% 0;
}

.story-figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
}

.story-end {
  max-width: 680px;
  margin: 72px auto 0;
  text-align: center;
}

.story-end-mark {
  margin-bottom: 24px;
  color: var(--accent-3);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
}

.story-end-note {
  margin: -12px 0 28px;
  color: var(--muted);
  font-size: 1rem;
}

.story-end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Thin line under the top bar that fills up while reading */
.reading-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform: scaleX(0);
  transform-origin: left center;
}

@supports not (animation-timeline: scroll()) {
  .reading-progress {
    display: none;
  }
}

@media (max-width: 599.98px) {
  .reader {
    padding-top: 24px;
  }

  .book-intro {
    padding-bottom: 36px;
  }

  .reader .cover-art {
    width: min(100%, 220px);
  }

  .story-page + .story-page {
    margin-top: 40px;
    padding-top: 40px;
  }

  .story-figure {
    margin: 24px 0 24px 50%;
  }

  .story-figure img {
    border-radius: 14px;
  }

  .story-end-actions .button {
    flex: 1 1 100%;
  }
}

/* 3D creations: the upright video sits above the objects on narrow screens and beside them on wide ones */
.creations {
  display: grid;
  gap: 28px;
}

.creation-video {
  justify-self: center;
  width: min(100%, 300px);
}

.creation-video video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  background: #000;
  box-shadow: var(--shadow);
}

.creation-video figcaption {
  margin-top: 14px;
  text-align: center;
}

.creation-video h3 {
  font-size: 1.25rem;
}

.gallery-grid.creations-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* Each creation is cut out of its photo and stands whole on a light display surface with a soft shadow */
.gallery-item .gallery-visual.on-display {
  aspect-ratio: 1;
  padding: 22px;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #ece8f3 78%);
}

.gallery-visual.on-display img {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  filter: drop-shadow(0 14px 12px rgba(40, 24, 80, 0.28));
  transition: transform 0.3s ease;
}

@media (hover: hover) {
  .gallery-item:hover .gallery-visual.on-display {
    transform: none;
    filter: none;
  }

  /* Like turning a figurine in your hand */
  .gallery-item:hover .gallery-visual.on-display img {
    transform: scale(1.06) rotate(-3deg);
  }
}

@media (max-width: 599.98px) {
  .creation-video {
    width: min(100%, 240px);
  }
}

@media (min-width: 480px) {
  .gallery-grid.creations-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 700px) and (max-width: 999.98px) {
  .gallery-grid.creations-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .creations {
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
    gap: 32px;
  }

  .creation-video {
    position: sticky;
    top: calc(var(--topbar-height) + 24px);
  }
}
