@font-face {
  font-family: "Satoshi";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/satoshi-400.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-sans-700-latin.woff2") format("woff2");
}

:root {
  --color-bg: #0b0a0e;
  --color-text: #e4e1e8;
  --color-text-muted: #7d7886;
  --color-text-soft: #ddd7e3;
  --color-status: #b9b3c2;
  --color-heart: #e4dce8;
  --color-line: rgba(228, 225, 232, 0.1);
  --color-veil: #0d0c12;
  --color-artwork: #141218;

  --card-border: #10142a;
  --card-shade: rgba(11, 10, 14, 0.86);

  --font-body: "Satoshi", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Noto Sans", "Helvetica Neue", Arial, sans-serif;

  --shadow-text: 0 1px 2px rgba(5, 5, 10, 0.9), 0 0 14px rgba(5, 5, 10, 0.75);
  --shadow-text-strong: 0 0 2px rgba(5, 5, 10, 0.95), 0 1px 10px rgba(5, 5, 10, 0.9);

  --ease-panel: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-draw: cubic-bezier(0.45, 0.05, 0.25, 1);

  --card-size: min(88vw, 82svh, 460px);
  --gutter: clamp(16px, 4vw, 40px);
}

[data-theme="day"] {
  --card-border: #3b3652;
  --card-shade: rgba(32, 28, 46, 0.86);
}

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

body {
  height: 100svh;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s, opacity 0.3s;
}

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

ul {
  list-style: none;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

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

.sky {
  position: fixed;
  inset: -4%;
  z-index: -2;
  transition: opacity 1.2s ease;
}

.sky--night {
  background:
    linear-gradient(rgba(11, 10, 14, 0.35), rgba(11, 10, 14, 0.55)),
    url("../art/bg-stars.jpg") center / cover no-repeat;
  animation: sky-breathe 60s ease-in-out infinite alternate;
}

.sky--day {
  inset: -14%;
  background:
    linear-gradient(rgb(115, 110, 136), rgb(115, 110, 136)),
    url("../art/sky-day.jpg") center / cover no-repeat;
  background-blend-mode: color, normal;
  filter: brightness(0.7) contrast(1.05);
  opacity: 0;
  animation: sky-drift 30s ease-in-out infinite alternate;
}

[data-theme="day"] .sky--day {
  opacity: 1;
}

.sky__stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  animation: fade-in 2.4s ease both;
}

.sky__veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--color-bg);
}

.card {
  position: fixed;
  top: 50%;
  left: 50%;
  width: var(--card-size);
  height: var(--card-size);
  transform: translate(-50%, -50%);
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--card-border);
  text-shadow: var(--shadow-text);
  animation: fade-in 1.6s ease both;
  transition:
    border-color 1.2s ease,
    width 0.8s var(--ease-panel) 0.2s,
    height 0.8s var(--ease-panel) 0.2s;
}

.card.is-open {
  width: min(94vw, 1200px);
  height: 90svh;
  transition:
    border-color 1.2s ease,
    width 0.8s var(--ease-panel) 0.15s,
    height 0.8s var(--ease-panel) 0.15s;
}

.card.is-instant,
.card.is-instant * {
  transition: none !important;
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transition: opacity 1.2s ease;
}

.card::before {
  background:
    linear-gradient(rgba(10, 13, 31, 0.42), rgba(10, 13, 31, 0.42)),
    url("../art/hero.jpg") 82% 40% / cover no-repeat;
}

.card::after {
  background:
    linear-gradient(rgba(38, 33, 60, 0.44), rgba(38, 33, 60, 0.44)),
    linear-gradient(rgb(181, 179, 201), rgb(181, 179, 201)),
    url("../art/box-day.webp") center / cover no-repeat;
  background-blend-mode: normal, multiply, normal;
  opacity: 0;
}

[data-theme="day"] .card::after {
  opacity: 1;
}

.card__shade {
  position: absolute;
  inset: 0;
  background: var(--card-shade);
  opacity: 0;
  transition: opacity 0.6s ease 0.4s;
}

.card.is-open .card__shade {
  opacity: 1;
  transition: opacity 0.6s ease 0.2s;
}

.card__veil {
  position: absolute;
  inset: 0;
  background: var(--color-veil);
}

.sky__veil,
.card__veil {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.is-theme-dipping .sky__veil,
.is-theme-dipping .card__veil {
  opacity: 1;
  transition: opacity 0.45s ease;
}

.is-theme-switching .sky,
.is-theme-switching .card,
.is-theme-switching .card::before,
.is-theme-switching .card::after {
  transition: none !important;
}

.card__intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(24px, 5%, 40px);
  text-align: center;
  transition: opacity 0.5s ease 0.9s, visibility 0s 0.9s;
}

.card.is-open .card__intro {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s 0.25s;
}

.card__header {
  align-self: flex-start;
  text-align: left;
}

.card__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 11vw, 60px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.card__status {
  margin-top: -2px;
  color: var(--color-status);
  font-size: 10.5px;
  line-height: 1.65;
  letter-spacing: 0.06em;
  text-shadow: var(--shadow-text-strong);
}

.card__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.card__bio {
  max-width: 340px;
  color: var(--color-text-soft);
  font-size: clamp(13px, 3.4vw, 14px);
  line-height: 1.65;
  text-shadow: var(--shadow-text-strong);
}

.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 4px;
  color: var(--color-heart);
  opacity: 0.8;
  filter: drop-shadow(0 0 2px rgba(5, 5, 10, 0.95)) drop-shadow(0 0 8px rgba(5, 5, 10, 0.8));
  transition: opacity 0.3s, transform 0.3s;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 1;
  transform: scale(1.08);
}

.theme-toggle:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 2px;
  border-radius: 50%;
}

.theme-toggle__icon {
  width: 20px;
  height: 20px;
  overflow: visible;
}

.theme-toggle__fill {
  fill: currentColor;
}

.theme-toggle__outline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.theme-toggle.is-beating .theme-toggle__icon {
  animation: heart-beat 0.9s ease-in-out;
}

.theme-toggle.is-redrawing .theme-toggle__icon {
  animation: heart-glow 1.15s ease both;
}

.theme-toggle.is-redrawing .theme-toggle__fill {
  animation: heart-unfill 1.15s ease both;
}

.theme-toggle.is-redrawing .theme-toggle__outline {
  animation: heart-trace 1.15s ease both;
}

.links {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 16px;
  line-height: 1.4;
}

.links__link {
  display: grid;
  place-items: center;
  min-height: 38px;
  outline: none;
}

.links__label,
.links__icon {
  grid-area: 1 / 1;
}

.links__label {
  transition:
    opacity 0.4s ease 0.2s,
    transform 0.5s ease 0.2s,
    filter 0.4s ease 0.2s;
}

.links__icon {
  width: 34px;
  height: 34px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 1px 3px rgba(5, 5, 10, 0.9));
  transition: opacity 0.15s 0.3s;
}

.links__icon > * {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.35s ease-in;
}

.links__icon > [data-i="1"] {
  --i: 1;
}

.links__icon > [data-i="2"] {
  --i: 2;
}

.links__icon > [data-i="3"] {
  --i: 3;
}

.links__icon > [data-i="4"] {
  --i: 4;
}

.links__icon > [data-i="5"] {
  --i: 5;
}

.links__icon > [data-i="6"] {
  --i: 6;
}

.links__link:hover .links__label,
.links__link:focus-visible .links__label {
  opacity: 0;
  transform: translateY(-5px);
  filter: blur(4px);
  transition: opacity 0.25s ease, transform 0.35s ease, filter 0.25s ease;
}

.links__link:hover .links__icon,
.links__link:focus-visible .links__icon {
  opacity: 1;
  transition: opacity 0s;
}

.links__link:hover .links__icon > *,
.links__link:focus-visible .links__icon > * {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.7s var(--ease-draw) calc(0.15s + var(--i, 0) * 0.09s);
}

.gallery {
  position: absolute;
  inset: 0;
  padding: 0 clamp(16px, 3vw, 32px) clamp(16px, 3vw, 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(228, 225, 232, 0.2) transparent;
  text-shadow: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s 0.25s;
}

.card.is-open .gallery {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease 0.85s, visibility 0s;
}

.gallery__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  margin-bottom: 14px;
  padding: clamp(16px, 2.5vw, 26px) 0 14px;
  border-bottom: 1px solid var(--color-line);
}

.gallery__back {
  color: var(--color-text-muted);
  font-size: 13px;
  letter-spacing: 0.06em;
  transition: color 0.3s;
}

.gallery__back:hover,
.gallery__back:focus-visible {
  color: var(--color-text);
}

.gallery__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.gallery__note {
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.gallery__grid {
  columns: 4 220px;
  column-gap: 10px;
}

.artwork {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 10px;
  overflow: hidden;
  break-inside: avoid;
  background: var(--color-artwork);
  cursor: zoom-in;
  opacity: 0;
  transition: opacity 1s ease;
}

.artwork.is-visible {
  opacity: 1;
}

.artwork__image {
  width: 100%;
  height: auto;
  transition: opacity 0.4s;
}

.artwork__title {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.4s;
}

.artwork:hover .artwork__image {
  opacity: 0.55;
}

.artwork:hover .artwork__title,
.artwork:focus-visible .artwork__title {
  opacity: 1;
}

.artwork:focus-visible {
  outline: 1px solid var(--color-text);
  outline-offset: 2px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 7, 10, 0.97);
  opacity: 0;
  transition: opacity 0.3s;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox__image {
  width: auto;
  height: auto;
  max-width: min(88vw, 1600px);
  max-height: 82svh;
  object-fit: contain;
}

.lightbox__caption {
  color: var(--color-text-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.lightbox__control {
  position: absolute;
  padding: 16px var(--gutter);
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.08em;
  transition: color 0.2s;
}

.lightbox__control:hover,
.lightbox__control:focus-visible {
  color: var(--color-text);
}

.lightbox__control--close {
  top: 10px;
  right: 0;
}

.lightbox__control--prev,
.lightbox__control--next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__control--prev {
  left: 0;
}

.lightbox__control--next {
  right: 0;
}

.not-found {
  display: grid;
  place-content: center;
  gap: 10px;
  height: 100%;
  padding: var(--gutter);
  text-align: center;
  animation: fade-in 1.2s ease both;
}

.not-found__title {
  font-family: var(--font-display);
  font-size: clamp(40px, 11vw, 60px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.not-found__text {
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

.not-found__link {
  color: var(--color-text);
  border-bottom: 1px solid var(--color-line);
}

.not-found__link:hover,
.not-found__link:focus-visible {
  border-color: var(--color-text);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sky-breathe {
  from { transform: scale(1) rotate(0deg); }
  to { transform: scale(1.05) rotate(0.6deg); }
}

@keyframes sky-drift {
  0% { transform: translate(-7%, 1%) scale(1.04); }
  50% { transform: translate(0, -1.5%) scale(1.1); }
  100% { transform: translate(7%, 1%) scale(1.04); }
}

@keyframes heart-beat {
  0% { transform: scale(1); }
  15% { transform: scale(1.16); }
  30% { transform: scale(0.97); }
  45% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

@keyframes heart-unfill {
  0% { opacity: 1; }
  16%, 66% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes heart-trace {
  0%, 14% { opacity: 1; stroke-dashoffset: 1; }
  64% { opacity: 1; stroke-dashoffset: 0; }
  100% { opacity: 0; stroke-dashoffset: 0; }
}

@keyframes heart-glow {
  0%, 58% { filter: drop-shadow(0 0 0 rgba(255, 236, 248, 0)) drop-shadow(0 0 0 rgba(236, 220, 255, 0)); }
  76% { filter: drop-shadow(0 0 5px rgba(255, 236, 248, 0.95)) drop-shadow(0 0 14px rgba(236, 220, 255, 0.65)); }
  100% { filter: drop-shadow(0 0 0 rgba(255, 236, 248, 0)) drop-shadow(0 0 0 rgba(236, 220, 255, 0)); }
}

@media (max-width: 640px) {
  .card__intro {
    padding: 16px;
  }

  .links {
    gap: 16px;
    font-size: 15px;
  }

  .gallery__grid {
    columns: 2;
    column-gap: 6px;
  }

  .artwork {
    margin-bottom: 6px;
  }

  .lightbox__control--prev,
  .lightbox__control--next {
    top: auto;
    bottom: 10px;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .artwork {
    opacity: 1;
  }
}
