* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #e9ece8;
  color: #111;
}

a {
  color: #1F3D2B;
}

a:hover {
  color: #C9A24D;
}

.pageShell {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  background: #ffffff;
  min-height: 100vh;
  border-left: 1px solid #7a7a7a;
  border-right: 1px solid #7a7a7a;
}

/* Top header */
.topHeader {
  background: #1F3D2B;
  color: #fff;
}

.topHeaderInner {
  padding: 14px 16px 10px;
}

.brandRow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.brand {
  font-size: 34px;
  font-weight: bold;
  letter-spacing: -0.5px;
  color: #FAF8F4;
  text-shadow:
    1px 1px 0 #C9A24D,
    2px 2px 0 #2B2B2B,
    3px 3px 0 rgba(0, 0, 0, 0.35);
}

.topRightLinks {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.topRightLinks a {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}

.searchRow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.searchInput {
  width: 100%;
  max-width: 520px;
  height: 28px;
  border: 1px solid #7f7f7f;
  padding: 4px 8px;
}

.searchSelect,
.searchBtn {
  height: 28px;
  border: 1px solid #7f7f7f;
  background: #fff;
}

.searchBtn {
  padding: 0 12px;
  cursor: pointer;
}

.searchMessage {
  margin: 8px 0 0;
  font-size: 13px;
  color: #ffffff;
}

.searchHighlight {
  background: #fff3a3;
  padding: 0 2px;
}

.altTheme .searchMessage {
  color: #FAF8F4;
}

.navBar {
  background: #6E8FBF;
  padding: 8px 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.tabLink {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}

.tabLink.active {
  font-weight: bold;
  text-decoration: underline;
}

/* Main layout */
.profilePage {
  display: grid;
  grid-template-columns: 330px minmax(0, 860px);
  gap: 18px;
  padding: 14px;
  align-items: start;
  justify-content: start;
}

.leftColumn,
.rightColumn {
  display: grid;
  gap: 18px;
  align-content: start;
}

/* Intro area */
.profileIdentity h1 {
  font-size: 46px;
  margin: 0 0 14px;
  line-height: 1;
}

.profileTop {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.profileImagePlaceholder {
  width: 170px;
  height: 190px;
  border: 1px solid #7f7f7f;
  background: #efefef;
  display: grid;
  place-items: center;
  color: #666;
  font-size: 13px;
  text-align: center;
  padding: 10px;
}

.profileFacts p,
.profileQuickStats p {
  margin: 0 0 8px;
  font-size: 14px;
}

/* Modules */
.module {
  border: 2px solid #6699cc;
  background: #fff;
}

.moduleHeader {
  padding: 6px 10px;
  font-weight: bold;
  font-size: 15px;
}

.moduleHeader.blue {
  background: #6E8FBF;
  color: #ffffff;
}

.moduleHeader.orange {
  background: #C9A24D;
  color: #2B2B2B;
}

.moduleBody {
  padding: 12px;
  font-size: 15px;
}

.moduleBody h3 {
  margin: 0 0 8px;
  color: #cc6600;
  font-size: 16px;
}

.moduleBody p {
  margin: 0 0 12px;
  line-height: 1.4;
}

/* Contact section */
.contactGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.contactGrid a {
  text-decoration: none;
  font-weight: bold;
  color: #0b3b8c;
  font-size: 14px;
}

/* URL box */
.urlBox {
  font-weight: normal;
  font-size: 15px;
  background: #f7fbff;
  border: 1px solid #cddbee;
}

/* Interest table */
.interestTable {
  display: grid;
  gap: 0;
}

.interestRow {
  display: grid;
  grid-template-columns: 120px 1fr;
}

.interestLabel {
  background: #b8d0ee;
  padding: 10px;
  font-weight: bold;
  border-top: 1px solid #fff;
}

.interestValue {
  background: #dce9f8;
  padding: 10px;
  border-top: 1px solid #fff;
}

/* Buttons */
.extrasRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.msButton {
  border: 1px solid #1F3D2B;
  background: #FAF8F4;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: #1F3D2B;
}

.msButton:hover {
  background: #1F3D2B;
  color: #ffffff;
}

/* Right column */
.rightColumn {
  width: 100%;
  max-width: 860px;
}

.contentSection {
  display: none;
}

.contentSection.active {
  display: block;
}

.textLink {
  font-weight: bold;
  text-decoration: none;
  color: #0b3b8c;
}

.tinyNote {
  color: #555;
  font-size: 13px;
}

/* Top 8 */
.top8Grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.topFriend {
  text-decoration: none;
  color: #0b3b8c;
  text-align: center;
  display: block;
  padding: 4px;
}

.topFriendPic {
  aspect-ratio: 1 / 1;
  border: 1px solid #888;
  background: #efefef;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  font-weight: bold;
  color: #555;
  font-size: 42px;
  opacity: 0.9;
}

.topFriendName {
  font-size: 13px;
  font-weight: bold;
}

.topFriend.empty {
  opacity: 0.65;
  pointer-events: none;
}

/* Footer */
.siteFooter {
  background: #1F3D2B;
  color: #FAF8F4;
  text-align: center;
  padding: 18px 12px;
  font-size: 13px;
}

/* Sparkles */
.sparkle {
  pointer-events: none;
  z-index: 9999;
}

/* Cursor Trail */
.cursorDot {
  position: fixed;
  font-size: 10px;
  color: #C9A24D;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.8;
}

/* Theme Toggle */
.altTheme {
  background: #e3e7e2;
  color: #2B2B2B;
}

/* Page container */
.altTheme .pageShell {
  background: #f4f6f2;
}

/* Headers */
.altTheme .topHeader {
  background: #2B2B2B;
}

.altTheme .navBar {
  background: #8aa2c8;
}

/* Module headers */
.altTheme .moduleHeader.blue {
  background: #2B2B2B;
  color: #FAF8F4;
}

.altTheme .moduleHeader.orange {
  background: #d4b26a;
  color: #2B2B2B;
}

.altTheme .brand {
  color: #FAF8F4;
}

.altTheme .siteFooter {
  background: #2B2B2B;
}

.altTheme .siteFooter,
.altTheme .siteFooter * {
  color: #FAF8F4;
}

/* Links */
.altTheme a {
  color: #1F3D2B;
}

/* ThoughtText */
#thoughtText {
  display: inline-block;
  margin: 10px 0 12px 12px;
  padding: 8px 12px;
  background: #f7fbff;
  border: 1px solid #6699cc;
  border-radius: 14px;
  font-size: 13px;
  color: #2B2B2B;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.08);
  max-width: 260px;
}

#thoughtText:empty {
  display: none;
}

/* Profile Area */

.profileTop {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.profilePic {
  position: relative;
  isolation: isolate;
  width: 150px;
  height: 150px;
  overflow: visible;
  background: transparent;
  border: 0;
}

.profilePic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 180ms ease;
}

.profileThreeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 2;
}

.profileThreeReady img {
  opacity: 0;
}

.profileThreeReady .profileThreeCanvas {
  opacity: 1;
}

@media (max-width: 560px) {
  .profileTop {
    grid-template-columns: 1fr;
  }

  .profilePic {
    width: 150px;
    height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profilePic {
    pointer-events: none;
  }
}

/* 3D hover accents */
@media (hover: hover) and (pointer: fine) {
  .module,
  .topFriendPic {
    transition:
      transform 120ms ease,
      box-shadow 120ms ease,
      border-color 120ms ease,
      background 120ms ease;
    transform-style: preserve-3d;
  }

  .module:hover {
    transform: perspective(900px) rotateX(1deg) rotateY(-1deg) translateY(-2px);
    box-shadow: 8px 8px 0 rgba(31, 61, 43, 0.18);
  }

  .topFriend:hover .topFriendPic {
    background: #e6e6e6;
    transform: perspective(700px) translateZ(18px) scale(1.04);
    box-shadow: 5px 5px 0 rgba(31, 61, 43, 0.18);
    cursor: default;
  }
}

/* Bookshelf */

.bookshelf {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0 16px;
}

.book {
  width: 110px;
  text-align: center;
}

.bookCover {
  font-size: 52px;
  margin-bottom: 8px;
  transition: transform 150ms ease;
}

.book:hover .bookCover {
  transform: translateY(-4px) rotate(-3deg);
}

.bookTitle {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
  line-height: 1.3;
}

.bookStatus {
  font-size: 12px;
  color: #666;
}

/* Dev Diary */

.devDiaryFeed {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.diaryEntry {
  border: 1px solid #cddbee;
  background: #f7fbff;
  padding: 10px;
}

.diaryEntryTitle {
  font-weight: bold;
  margin-bottom: 4px;
}

.diaryEntryMeta {
  font-size: 12px;
  color: #666;
}

.diaryEntry a {
  text-decoration: none;
  font-weight: bold;
}

/* Three.js Header Sparkle */

.brandRow {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
}

.headerSparkle {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin-top: 4px;
  margin-left: -1px;
  cursor: default;
}

.headerSparkle canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 560px) {
  .headerSparkle {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    margin-top: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .headerSparkle {
    pointer-events: none;
  }
}

/* Three.js Profile Photo */

.profilePic {
  position: relative;
  isolation: isolate;
}

.profilePic img {
  display: block;
  transition: opacity 180ms ease;
}

.profileThreeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 2;
}

.profileThreeReady img {
  opacity: 0;
}

.profileThreeReady .profileThreeCanvas {
  opacity: 1;
}

/* Top 8 idle 3D movement */

.top8Grid {
  perspective: 900px;
}

.topFriend {
  transform-style: preserve-3d;
  will-change: transform;
  animation: topFriendFloat 5.5s ease-in-out infinite;
}

.topFriendPic {
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* Stagger the movement so all eight do not move together */

.topFriend:nth-child(1) {
  animation-delay: 0s;
}

.topFriend:nth-child(2) {
  animation-delay: -0.7s;
}

.topFriend:nth-child(3) {
  animation-delay: -1.4s;
}

.topFriend:nth-child(4) {
  animation-delay: -2.1s;
}

.topFriend:nth-child(5) {
  animation-delay: -2.8s;
}

.topFriend:nth-child(6) {
  animation-delay: -3.5s;
}

.topFriend:nth-child(7) {
  animation-delay: -4.2s;
}

.topFriend:nth-child(8) {
  animation-delay: -4.9s;
}

@keyframes topFriendFloat {
  0%,
  100% {
    transform:
      translateY(0)
      rotateX(0deg)
      rotateY(0deg)
      translateZ(0);
  }

  25% {
    transform:
      translateY(-2px)
      rotateX(2deg)
      rotateY(-2deg)
      translateZ(5px);
  }

  50% {
    transform:
      translateY(-4px)
      rotateX(-2deg)
      rotateY(2deg)
      translateZ(9px);
  }

  75% {
    transform:
      translateY(-2px)
      rotateX(1deg)
      rotateY(3deg)
      translateZ(5px);
  }
}

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

/* Music Player */

.musicPlayer {
  display: grid;
  gap: 10px;
}

.musicTrackInfo {
  display: grid;
  gap: 3px;
}

.musicTrackInfo strong {
  font-size: 14px;
  color: #1F3D2B;
}

.musicTrackInfo span {
  font-size: 12px;
  color: #666;
}

.musicPlayer audio {
  width: 100%;
  height: 34px;
}

/* Three.js Dev Diary Charm */

.devDiaryHeader {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow: visible;
}

.devDiaryHeader span {
  position: relative;
  z-index: 2;
}

.devDiaryCharm {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;

  margin-left: -10px;
  margin-top: -10px;
  margin-bottom: -10px;

  cursor: default;
}

.devDiaryThreeCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 560px) {
  .devDiaryHeader {
    min-height: 38px;
  }

  .devDiaryCharm {
    width: 44px;
    height: 44px;
    flex-basis: 44px;

    margin-left: -8px;
    margin-top: -8px;
    margin-bottom: -8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .devDiaryCharm {
    pointer-events: none;
  }
}

.projectLinks {
  margin-top: 10px;
  line-height: 1.8;
}

/* Responsive */
@media (max-width: 900px) {
  .profilePage {
    grid-template-columns: 1fr;
  }

  .top8Grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .profileIdentity h1 {
    font-size: 34px;
  }

  .heroStatusInner {
    font-size: 24px;
    padding: 24px 16px;
  }
}

@media (max-width: 560px) {
  .brand {
    font-size: 28px;
  }

  .profileTop {
    grid-template-columns: 1fr;
  }

  .contactGrid {
    grid-template-columns: 1fr;
  }

  .interestRow {
    grid-template-columns: 1fr;
  }

  .top8Grid {
    grid-template-columns: 1fr 1fr;
  }

  .moduleBody {
    font-size: 14px;
  }
}

@media (min-width: 1280px) {
  body {
    background: #d6d6d6;
  }

  .pageShell {
    width: min(1240px, calc(100% - 40px));
  }

  .profilePage {
    grid-template-columns: 330px minmax(0, 860px);
    gap: 18px;
    justify-content: start;
  }

  .moduleBody {
    padding: 12px;
  }
}