@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  padding: 2rem 1.5rem;
  background-color: #fffbf1;
  color: #000000cf;
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-size: 1.125rem;
  line-height: 1.65;
  opacity: 0;
  transition: opacity 0.25s ease, background-color 1s ease;
}

body.page-loaded {
  opacity: 1;
}

body.page-leaving {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  body {
    opacity: 1;
    transition: background-color 1s ease;
  }
}

.ibm-plex-sans-thai-thin {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 100;
  font-style: normal;
}

.ibm-plex-sans-thai-extralight {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 200;
  font-style: normal;
}

.ibm-plex-sans-thai-light {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 300;
  font-style: normal;
}

.ibm-plex-sans-thai-regular {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.ibm-plex-sans-thai-medium {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 500;
  font-style: normal;
}

.ibm-plex-sans-thai-semibold {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 600;
  font-style: normal;
}

.ibm-plex-sans-thai-bold {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-weight: 700;
  font-style: normal;
}

h1 {
  font-family: "IBM Plex Sans Thai", sans-serif;
  font-size: clamp(2.25rem, 8vw, 4.5rem);
  font-weight: 400;
  line-height: 1;
  text-align: center;
  letter-spacing: 0;
  margin: 3rem 0 0;
}

article {
  max-width: 65ch;
  margin-inline: auto;
}

.page-shell {
  max-width: 42rem;
  margin-inline: auto;
}

.back-link {
  display: inline-block;
  margin-top: 1rem;
  color: inherit;
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  opacity: 1;
}

.page-intro {
  max-width: none;
  margin: 0.5rem 0 0;
}

.entry-list {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  max-width: 50ch;
}

.entry-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.entry-item a {
  color: inherit;
  font-size: 1.15rem;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.entry-item a:hover,
.entry-item a:focus-visible {
  opacity: 0.7;
}

.entry-title {
  font-size: 1.15rem;
}

.entry-note {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  color: #00000099;
}

.entry-empty {
  margin-top: 2.5rem;
  color: #00000099;
}

.verse {
  max-width: 40ch;
  margin: 2.5rem 0 0;
  font-size: 1.1rem;
  line-height: 1.8;
  white-space: pre-line;
}

.verse + .verse {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.verse-title {
  margin: 0 0 1rem;
  font-style: italic;
  color: #00000099;
}

.moment {
  max-width: 55ch;
  margin: 2.5rem 0 0;
  font-size: 1.1rem;
  line-height: 1.7;
}

.moment + .moment {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.moment-title {
  margin: 0 0 1rem;
  font-style: italic;
  color: #00000099;
}

.moment p {
  margin: 0 0 1rem;
}

.moment-reader {
  margin-top: 2.5rem;
  min-height: 1px;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.moment-reader.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .moment-reader {
    transition: none;
  }
}

.moment-reader-empty {
  margin-top: 2.5rem;
  color: #00000099;
}

.app-icon.is-open .app-icon-hex::before {
  background: transparent;
}

.app-icon.is-open .app-icon-hex svg,
.app-icon.is-open .app-icon-hex .app-icon-glyph,
.app-icon.is-open .app-icon-hex .app-icon-label {
  color: #fffbf1;
}

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

.dock-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: #fffbf1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

.dock-bar.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.dock-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}

.dock-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dock-title {
  font-size: 1.1rem;
  white-space: nowrap;
}

.dock-socials {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dock-socials a {
  display: inline-flex;
  color: inherit;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dock-socials a:hover,
.dock-socials a:focus-visible {
  opacity: 1;
  transform: scale(1.1);
}

.dock-socials svg {
  width: 1.5rem;
  height: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .dock-bar {
    transition: none;
  }
}

.pages {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 7rem 1.5rem 5rem;
}

.hive {
  --hex-w: clamp(5.5rem, 24vw, 8.5rem);
  --hex-h: calc(var(--hex-w) * 1.1547);
  position: relative;
  width: min(100%, 46rem);
  margin-inline: auto;
  perspective: 600px;
}

.app-icon {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  color: inherit;
  text-decoration: none;
  animation: build-in 0.5s ease-out backwards;
}

@keyframes build-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.notfound-shell {
  text-align: center;
}

.notfound-hive {
  width: auto;
  height: auto;
  margin-top: 3rem;
}

.notfound-home {
  position: static;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .app-icon {
    animation: none;
  }
}

.app-icon-hex {
  position: relative;
  width: var(--hex-w);
  height: var(--hex-h);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: currentColor;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0 0.5rem;
  box-sizing: border-box;
  text-align: center;
}

.app-icon-hex.flipping {
  animation: hex-flip 1s ease-in-out;
}

@keyframes hex-flip {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-icon-hex.flipping {
    animation: none;
  }
}

.app-icon-hex::before {
  content: "";
  position: absolute;
  inset: 1.5px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: #fffbf1;
  transition: background 0.2s ease;
}

.app-icon:hover .app-icon-hex::before,
.app-icon:focus-visible .app-icon-hex::before {
  background: transparent;
}

.app-icon-hex svg,
.app-icon-hex .app-icon-glyph,
.app-icon-hex .app-icon-label {
  position: relative;
  color: inherit;
  transition: color 0.2s ease;
}

.app-icon:hover .app-icon-hex svg,
.app-icon:hover .app-icon-hex .app-icon-glyph,
.app-icon:hover .app-icon-hex .app-icon-label,
.app-icon:focus-visible .app-icon-hex svg,
.app-icon:focus-visible .app-icon-hex .app-icon-glyph,
.app-icon:focus-visible .app-icon-hex .app-icon-label {
  color: #fffbf1;
}

/* Reusable loading indicator — a thin-outline hex that spins in place.
   Usage: <span class="hex-spinner" role="status" aria-label="Loading"></span>
   Resize with style="--spinner-size: 2rem;" if needed. */
.hex-spinner {
  --spinner-size: 2.5rem;
  position: relative;
  display: inline-block;
  width: var(--spinner-size);
  height: calc(var(--spinner-size) * 1.1547);
  perspective: 400px;
}

.hex-spinner::before,
.hex-spinner::after {
  content: "";
  position: absolute;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  backface-visibility: hidden;
  animation: hex-flip 1.2s linear infinite;
}

.hex-spinner::before {
  inset: 0;
  background: currentColor;
}

.hex-spinner::after {
  inset: 1.5px;
  background: #fffbf1;
}

@media (prefers-reduced-motion: reduce) {
  .hex-spinner::before,
  .hex-spinner::after {
    animation: none;
  }
}

.app-icon-hex svg {
  width: 26%;
  height: 26%;
  flex-shrink: 0;
}

.app-icon-glyph {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: calc(var(--hex-w) * 0.26);
  line-height: 1;
}

.app-icon-label {
  font-size: 0.65rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
}