:root {
  color-scheme: dark;
  --bg: #111716;
  --ink: #fff8ed;
  --muted: #cbbda5;
  --line: rgba(255, 248, 237, 0.24);
  --panel: rgba(10, 14, 14, 0.78);
  --accent: #eeb66f;
  --accent-2: #96d7b0;
  --letter-bg: #fff6e8;
  --letter-ink: #17110d;
  --letter-muted: #6c5548;
  --shadow: rgba(0, 0, 0, 0.42);
  --letter-font: "Arial Black", Impact, ui-sans-serif, system-ui, sans-serif;
  --ui-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui-font);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.app {
  min-height: 100vh;
  background: var(--bg);
}

.login-screen,
.letter-screen {
  min-height: 100vh;
}

.login-screen {
  position: relative;
  display: grid;
  align-items: center;
  padding: clamp(20px, 4vw, 56px);
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 20%, rgba(238, 182, 111, 0.16), transparent 24rem),
    radial-gradient(circle at 20% 82%, rgba(150, 215, 176, 0.12), transparent 22rem),
    #0b0d0c;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(6, 8, 8, 0.72), rgba(6, 8, 8, 0.22) 48%, rgba(6, 8, 8, 0.62)),
    linear-gradient(180deg, rgba(6, 8, 8, 0.06), rgba(6, 8, 8, 0.62));
  pointer-events: none;
}

.photo-album {
  position: absolute;
  inset: -8vh -8vw;
  z-index: 0;
  opacity: 0.95;
  filter: saturate(0.98) sepia(0.1) brightness(1.08);
}

.album-photo {
  position: absolute;
  width: var(--w);
  height: var(--h);
  left: var(--x);
  top: var(--y);
  object-fit: cover;
  border: clamp(8px, 1vw, 15px) solid rgba(255, 248, 230, 0.92);
  border-bottom-width: clamp(18px, 2.6vw, 34px);
  border-radius: 4px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.58);
  transform: rotate(var(--r));
  animation: albumDrift var(--d) ease-in-out infinite alternate;
  animation-delay: var(--delay);
}

.photo-01 {
  --w: clamp(154px, 18vw, 255px);
  --h: clamp(205px, 24vw, 340px);
  --x: 8%;
  --y: 8%;
  --r: -9deg;
  --d: 13s;
  --delay: -2s;
}

.photo-02 {
  --w: clamp(156px, 17vw, 244px);
  --h: clamp(208px, 23vw, 326px);
  --x: 68%;
  --y: 5%;
  --r: 8deg;
  --d: 15s;
  --delay: -6s;
}

.photo-03 {
  --w: clamp(148px, 16vw, 236px);
  --h: clamp(198px, 22vw, 315px);
  --x: 47%;
  --y: 18%;
  --r: -5deg;
  --d: 16s;
  --delay: -11s;
}

.photo-04 {
  --w: clamp(162px, 19vw, 270px);
  --h: clamp(216px, 25vw, 360px);
  --x: 79%;
  --y: 42%;
  --r: -12deg;
  --d: 14s;
  --delay: -4s;
}

.photo-05 {
  --w: clamp(210px, 25vw, 364px);
  --h: clamp(158px, 18.5vw, 273px);
  --x: 29%;
  --y: 66%;
  --r: 5deg;
  --d: 17s;
  --delay: -8s;
}

.photo-06 {
  --w: clamp(142px, 16vw, 222px);
  --h: clamp(190px, 21vw, 296px);
  --x: 4%;
  --y: 58%;
  --r: 11deg;
  --d: 13s;
  --delay: -10s;
}

.photo-07 {
  --w: clamp(146px, 15vw, 218px);
  --h: clamp(195px, 20vw, 291px);
  --x: 88%;
  --y: 0%;
  --r: -6deg;
  --d: 18s;
  --delay: -13s;
}

.photo-08 {
  --w: clamp(220px, 27vw, 390px);
  --h: clamp(165px, 20vw, 293px);
  --x: 53%;
  --y: 68%;
  --r: 7deg;
  --d: 15s;
  --delay: -7s;
}

.photo-09 {
  --w: clamp(150px, 16vw, 236px);
  --h: clamp(200px, 22vw, 315px);
  --x: 23%;
  --y: -2%;
  --r: 4deg;
  --d: 16s;
  --delay: -5s;
}

.photo-10 {
  --w: clamp(148px, 16vw, 230px);
  --h: clamp(198px, 22vw, 307px);
  --x: 63%;
  --y: 33%;
  --r: -3deg;
  --d: 14s;
  --delay: -1s;
}

.login-panel {
  position: relative;
  z-index: 2;
  width: min(100%, 405px);
  padding: clamp(24px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 86px var(--shadow);
  backdrop-filter: blur(22px) saturate(1.06);
}

.network-mark {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 24px;
  margin-bottom: 24px;
}

.signal-bar {
  width: 7px;
  border-radius: 999px 999px 2px 2px;
  background: var(--accent-2);
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent-2), transparent 35%);
}

.signal-bar:nth-child(1) {
  height: 9px;
}

.signal-bar:nth-child(2) {
  height: 16px;
}

.signal-bar:nth-child(3) {
  height: 23px;
}

.eyebrow,
.letter-kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  max-width: 9ch;
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(2.15rem, 8.4vw, 4.15rem);
  line-height: 0.95;
  text-wrap: balance;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 32px;
}

.login-form.is-shaking {
  animation: shake 360ms ease;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 248, 237, 0.08);
  color: var(--ink);
}

input[readonly] {
  color: var(--accent-2);
  caret-color: transparent;
}

input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2), transparent 78%);
}

.hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  animation: hintIn 420ms ease both;
}

.hint span {
  color: var(--ink);
  font-weight: 800;
}

.login-error {
  min-height: 1.2em;
  margin: -4px 0 0;
  color: #ffbdad;
  font-size: 0.88rem;
}

.enter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: #16110b;
  background: linear-gradient(135deg, var(--accent), #ffe1a6);
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.enter-button:active {
  transform: translateY(1px);
}

.button-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.letter-screen {
  display: none;
  padding: clamp(18px, 5vw, 72px);
  overflow-x: hidden;
  background: var(--letter-bg);
  transition: background-color 520ms ease;
}

.app[data-view="letter"] .login-screen {
  display: none;
}

.app[data-view="letter"] .letter-screen {
  display: grid;
  place-items: center;
}

.letter-stage {
  width: min(100%, 1040px);
  min-height: min(84vh, 900px);
  display: flex;
  align-items: center;
  transition:
    color 450ms ease,
    filter 850ms ease,
    opacity 850ms ease,
    transform 850ms ease;
}

.letter-kicker {
  color: var(--letter-muted);
}

h2 {
  color: var(--letter-ink);
  font-family: var(--letter-font);
  max-width: 12ch;
  font-size: clamp(3.2rem, 10.6vw, 9.4rem);
  font-weight: 950;
  line-height: 0.86;
  text-transform: uppercase;
  text-wrap: balance;
}

.letter-wrap {
  width: 100%;
}

.letter-aliases {
  max-width: 820px;
  margin: clamp(16px, 2.2vw, 28px) 0 0;
  color: var(--letter-muted);
  font-family: var(--ui-font);
  font-size: clamp(0.95rem, 1.9vw, 1.45rem);
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.letter {
  max-width: 920px;
  margin-top: clamp(28px, 5vw, 62px);
  color: var(--letter-ink);
  font-family: var(--letter-font);
  font-size: clamp(1.28rem, 3.1vw, 3rem);
  font-weight: 900;
  line-height: 1.06;
  white-space: pre-wrap;
  text-wrap: pretty;
}

.cursor {
  width: 1.1em;
  height: 0.18em;
  margin-top: 18px;
  background: var(--letter-ink);
  animation: blink 920ms steps(1) infinite;
}

.final-message,
.graffiti-message {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(24px, 6vw, 72px);
  color: var(--letter-ink);
  font-family: var(--letter-font);
  font-size: clamp(2rem, 7vw, 6.5rem);
  font-weight: 950;
  line-height: 1.03;
  text-align: center;
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

.final-message {
  z-index: 4;
}

.graffiti-message {
  z-index: 6;
  color: #f7ff00;
  font-family: Impact, "Arial Black", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(3.2rem, 14vw, 12rem);
  font-weight: 950;
  line-height: 0.82;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    -0.055em 0.045em 0 #ff1fb8,
    0.055em -0.035em 0 #00e5ff,
    0.09em 0.09em 0 #111,
    0 0 18px #000,
    0 0 46px #000,
    0 0 26px rgba(247, 255, 0, 0.42);
  transform: rotate(-5deg) scale(0.76);
  -webkit-text-stroke: 0.035em #111;
}

.tommy-carousel {
  position: fixed;
  inset: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.tommy-carousel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.88) 0 30%, rgba(0, 0, 0, 0.42) 48%, rgba(0, 0, 0, 0.78) 80%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.68));
}

.tommy-slide {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: min(42vw, 380px);
  height: min(27vh, 230px);
  object-fit: cover;
  border: clamp(7px, 1vw, 14px) solid #f9f5e8;
  border-bottom-width: clamp(18px, 2.6vw, 36px);
  border-radius: 5px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg)) scale(0.9);
  animation: tommyShow 22s linear infinite;
  animation-delay: var(--delay, 0s);
}

.tommy-slide:nth-child(1) {
  --x: 50%;
  --y: 82%;
  --tilt: -6deg;
  --delay: 0s;
}

.tommy-slide:nth-child(2) {
  --x: 50%;
  --y: 82%;
  --tilt: 5deg;
  --delay: 2s;
}

.tommy-slide:nth-child(3) {
  --x: 50%;
  --y: 82%;
  --tilt: -3deg;
  --delay: 4s;
}

.tommy-slide:nth-child(4) {
  --x: 50%;
  --y: 82%;
  --tilt: 8deg;
  --delay: 6s;
}

.tommy-slide:nth-child(5) {
  --x: 50%;
  --y: 82%;
  --tilt: -8deg;
  --delay: 8s;
}

.tommy-slide:nth-child(6) {
  --x: 50%;
  --y: 82%;
  --tilt: 3deg;
  --delay: 10s;
}

.tommy-slide:nth-child(7) {
  --x: 50%;
  --y: 82%;
  width: min(42vw, 430px);
  height: min(27vh, 230px);
  --tilt: -5deg;
  --delay: 12s;
}

.tommy-slide:nth-child(8) {
  --x: 50%;
  --y: 82%;
  --tilt: 7deg;
  --delay: 14s;
}

.tommy-slide:nth-child(9) {
  --x: 50%;
  --y: 82%;
  --tilt: -4deg;
  --delay: 16s;
}

.tommy-slide:nth-child(10) {
  --x: 50%;
  --y: 82%;
  --tilt: 4deg;
  --delay: 18s;
}

.tommy-slide:nth-child(11) {
  --x: 50%;
  --y: 82%;
  --tilt: -7deg;
  --delay: 20s;
}

.letter-screen.is-dissolving .letter-stage {
  opacity: 0;
  filter: blur(14px);
  transform: translateY(-14px);
}

.letter-screen.is-dissolving .final-message {
  animation: finalBloom 7.5s ease forwards;
}

.letter-screen.is-empty {
  background: #020202;
}

.letter-screen.is-empty .final-message {
  opacity: 0;
}

.letter-screen.show-graffiti .graffiti-message {
  animation: graffitiTag 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.letter-screen.show-graffiti .tommy-carousel {
  animation: carouselIn 900ms ease forwards;
}

.theme-rose {
  --bg: #221519;
  --ink: #fff1f1;
  --muted: #e8bfc3;
  --accent: #f19a9f;
  --accent-2: #f6d29a;
  --letter-bg: #ff4f7b;
  --letter-ink: #1b0710;
  --letter-muted: #fff1c7;
  --letter-font: Georgia, "Times New Roman", serif;
}

.theme-green {
  --bg: #0f1b18;
  --ink: #f0fff7;
  --muted: #afd2c3;
  --accent: #c5d86d;
  --accent-2: #6fd0ba;
  --letter-bg: #0bbb83;
  --letter-ink: #041b14;
  --letter-muted: #ecffd6;
  --letter-font: "Gill Sans", "Trebuchet MS", sans-serif;
}

.theme-ink {
  --bg: #101014;
  --ink: #f5f2e8;
  --muted: #b8b0a0;
  --accent: #d9a441;
  --accent-2: #a8b8ff;
  --letter-bg: #111111;
  --letter-ink: #f6f1e4;
  --letter-muted: #ffcf56;
  --letter-font: "Courier New", Courier, monospace;
}

.theme-dawn {
  --bg: #1c1826;
  --ink: #fff7de;
  --muted: #d4c5e7;
  --accent: #ffb86c;
  --accent-2: #8ed8df;
  --letter-bg: #6f47ff;
  --letter-ink: #fff7de;
  --letter-muted: #9ef6ff;
  --letter-font: Optima, Candara, sans-serif;
}

@keyframes albumDrift {
  0% {
    transform: rotate(var(--r)) translate3d(-6px, -4px, 0) scale(1);
  }
  100% {
    transform: rotate(calc(var(--r) * -0.45)) translate3d(8px, 10px, 0) scale(1.035);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-8px);
  }
  44% {
    transform: translateX(7px);
  }
  66% {
    transform: translateX(-4px);
  }
  88% {
    transform: translateX(3px);
  }
}

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

@keyframes blink {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

@keyframes graffitiTag {
  0% {
    opacity: 0;
    filter: blur(8px) contrast(1.6);
    transform: rotate(-9deg) scale(0.58) translateY(18px);
  }
  58% {
    opacity: 1;
    filter: blur(0) contrast(1.08);
    transform: rotate(-4deg) scale(1.08) translateY(0);
  }
  76% {
    transform: rotate(-5deg) scale(0.98);
  }
  100% {
    opacity: 1;
    filter: blur(0) contrast(1);
    transform: rotate(-5deg) scale(1);
  }
}

@keyframes carouselIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes tommyShow {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--tilt)) scale(0.86);
  }
  4%,
  9% {
    opacity: 0.92;
    transform: translate(-50%, -50%) rotate(var(--tilt)) scale(1);
  }
  13%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(calc(var(--tilt) * -0.45)) scale(1.08);
  }
}

@keyframes finalBloom {
  0% {
    opacity: 0;
    filter: blur(16px);
    transform: scale(0.98);
  }
  18%,
  68% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
  100% {
    opacity: 0;
    filter: blur(28px);
    transform: scale(1.04);
  }
}

@media (max-width: 760px) {
  .login-screen {
    align-items: end;
  }

  .photo-album {
    inset: -4vh -28vw;
  }

  .album-photo {
    opacity: 0.88;
  }

  .photo-01 {
    --x: 0%;
    --y: 2%;
  }

  .photo-02 {
    --x: 54%;
    --y: 1%;
  }

  .photo-09 {
    display: none;
  }

  .photo-03 {
    --x: 27%;
    --y: 19%;
  }

  .photo-07 {
    --x: 77%;
    --y: 22%;
  }

  .photo-04 {
    --x: 70%;
    --y: 48%;
  }

  .photo-05 {
    --x: 5%;
    --y: 52%;
  }

  .photo-08 {
    --x: 47%;
    --y: 72%;
  }

  .login-panel {
    width: 100%;
  }

  h1 {
    max-width: 100%;
  }

  .letter-screen {
    padding: 18px;
  }

  .letter-stage {
    align-items: flex-start;
    min-height: auto;
    padding-block: 12px;
  }

  h2 {
    font-size: clamp(2.75rem, 14vw, 5.35rem);
  }

  .letter {
    line-height: 1.09;
  }

  .tommy-slide {
    --x: 50%;
    --y: 83%;
    width: min(54vw, 230px);
    height: min(24vh, 220px);
  }

  .graffiti-message {
    font-size: clamp(3rem, 18vw, 6.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
