@font-face {
  font-family: 'HappyTimesNG';
  src: url('happy-times-NG_regular_master.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'HappyTimesNG';
  src: url('happy-times-NG_bold_master.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'HappyTimesNG';
  src: url('happy-times-NG_italic_master.otf') format('opentype');
  font-weight: normal;
  font-style: italic;
}

:root {
  --bg-color: #F5F5F5;
  --text-color: #000000;
  --card-bg: #f1f1f1;
  --border-color: #000000;
  --font-main: 'HappyTimesNG', serif;
}

/* General styles */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  box-sizing: border-box;
  position: relative;
}

#hero {
  position: relative;
  height: 80vh;
  height: 80dvh;
  width: 100%;
  overflow: hidden;
}

#floating-hero {
  display: none;
}

/* Hero background layout */
#hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
  padding: 25px 29px;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 20px;
  color: var(--text-color);
}

#hero-bg-bio {
  width: 48.3%;
  flex-shrink: 0;
}

#hero-bg-contacts {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: flex-start;
}

#hero-bg-contacts a {
  color: #0056ed;
  text-decoration: none;
  pointer-events: auto;
  white-space: nowrap;
}

#hero-bg-contacts a:hover {
  text-decoration: underline;
}

#floating-hero #bio p,
#floating-hero #contact p {
  margin: 0;
  font-size: clamp(0.8rem, 0.6rem + 0.25vw, 1.05rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
}

#floating-hero #bio {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

#floating-hero #contact a {
  color: var(--text-color);
  pointer-events: auto;
}

.card-header {
  margin-bottom: 10px;
  padding-bottom: 0;
  border-bottom: none;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.box-expand-btn {
  background: none;
  border: none;
  font-family: var(--font-main);
  font-size: clamp(0.9rem, 1.25vw, 1.5rem);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-top: 10px;
}

.box-expand-btn:hover {
  opacity: 0.6;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

#hero-content {
  display: flex;
  flex-direction: column;
}

.box-content {
  transition: max-height 0.2s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease;
  overflow: hidden;
  margin-bottom: 5px;
  position: relative;
}

.box-content.snippet {
  cursor: pointer;
}

.box-content.snippet:hover p {
  text-decoration: underline;
}

.box-content.snippet::after {
  display: none;
}

.box-content.snippet p {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  letter-spacing: -0.02em;
}

.box-content.expanded {
  cursor: default;
}

.box-content.expanded p {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  margin: 0;
  letter-spacing: -0.02em;
}

#floating-index {
  position: absolute;
  top: 20px;
  right: 20px;
  left: auto;
  z-index: 2001;
  text-align: right;
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 10px;
  width: 150px;
  height: auto;
  display: none !important;
  flex-direction: column;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
  overflow: hidden;
}

#contact {
  padding-top: 0;
  margin-top: 0;
}

#contact p {
  margin: 0;
}

#floating-index .card-header h1 {
  line-height: 1.2;
}

#index-list-container {
  border-top: 1px solid var(--border-color);
  padding-top: 0;
}

#floating-index a {
  display: block;
  color: var(--text-color);
  text-decoration: none;
  cursor: pointer;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

#floating-index a:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

#floating-index a:hover {
  text-decoration: underline;
}

.paragraph {
  margin: 0 0 20px 0;
  font-size: 1rem;
  line-height: 1.4;
}

#contact.paragraph {
  margin-bottom: 0;
}

.paragraph p {
  pointer-events: auto;
  font-size: 1rem;
  line-height: 1.4;
}

.draggable {
  position: absolute;
  z-index: 9;
  background-color: var(--card-bg);
  text-align: center;
  border: 1px solid var(--border-color);
  padding: 0;
  cursor: default;
  user-select: none;
  transition: box-shadow 0.3s ease, scale 0.3s ease;
}

.draggable.animating {
  transition: top 1s cubic-bezier(0.25, 1, 0.5, 1), left 1s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease, scale 0.3s ease;
}

.draggable.is-dragging {
  z-index: 4000 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  scale: 1.03;
}

.draggable img {
  display: block;
  max-width: 75vw;
  max-height: 50vh;
  width: auto;
  height: auto;
  pointer-events: none;
}

/* Sticky Notes */
.sticky-note {
  text-align: left;
  background-color: #ffffff;
  color: var(--text-color);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: clamp(16px, 1.2vw, 24px) clamp(18px, 1.3vw, 28px);
  width: clamp(260px, 18vw, 400px);
  max-height: 50vh;
  overflow-y: auto;
  font-family: var(--font-main);
  font-size: clamp(0.8rem, 0.6rem + 0.25vw, 1.05rem);
  line-height: 1.45;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.08);
  transition: none;
}

.sticky-note.note-expanded {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 10000 !important;
  width: auto;
  max-width: 90vw;
  max-height: 71.4vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  cursor: default;
  display: flex;
  flex-direction: column;
  font-size: 1.05rem;
  line-height: 1.55;
}

.sticky-note.note-expanded .note-title {
  font-size: 1.2rem;
}

.sticky-note.note-expanded .note-body {
  flex: 1;
  overflow-y: auto;
}

.sticky-note.note-expanded .arena-gallery {
  min-height: auto;
  height: 100%;
}

.sticky-note.note-expanded .arena-slide img {
  height: auto;
  max-height: 55vh;
  width: 100%;
  object-fit: contain;
}

.sticky-note.note-expanded .arena-counter {
  font-size: 0.85rem;
}

.sticky-note.note-expanded .gallery-nav-btn {
  font-size: 0.9rem;
  padding: 4px 12px;
}

.note-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9999;
}

.sticky-note .note-title {
  font-weight: normal;
  font-size: clamp(0.95rem, 0.75rem + 0.25vw, 1.2rem);
  text-align: center;
  margin: calc(-1 * clamp(16px, 1.2vw, 24px)) calc(-1 * clamp(18px, 1.3vw, 28px)) 10px;
  padding: clamp(14px, 1vw, 20px) clamp(18px, 1.3vw, 28px);
  min-height: 44px;
  box-sizing: border-box;
  cursor: default;
}

.draggable .note-title,
.draggable .note-header-row {
  cursor: grab;
}

.draggable .note-title:active,
.draggable .note-header-row:active {
  cursor: grabbing;
}

.sticky-note .note-body {
  pointer-events: none;
}

.sticky-note .note-body a {
  pointer-events: auto;
  color: var(--text-color);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.3);
  text-underline-offset: 2px;
}

.sticky-note .note-body a:hover {
  text-decoration-color: var(--text-color);
}

.sticky-note .note-body p {
  margin: 0 0 6px 0;
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow: visible;
}

.sticky-note .note-body ul,
.sticky-note .note-body ol {
  margin: 0 0 8px 0;
  padding-left: 18px;
}

.sticky-note .note-body li {
  margin-bottom: 3px;
}

.sticky-projects .note-body {
  text-align: center;
}

.sticky-projects .note-body ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.sticky-projects {
  background-color: #0056ed;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.sticky-projects .note-title {
  color: #ffffff;
}

.sticky-projects .note-body a {
  color: #ffffff;
  text-decoration: none;
}

.sticky-projects .note-body a:hover {
  text-decoration: underline;
}

.note-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: calc(-1 * clamp(16px, 1.2vw, 24px)) calc(-1 * clamp(18px, 1.3vw, 28px)) 10px;
  padding: clamp(10px, 0.7vw, 16px) clamp(18px, 1.3vw, 28px);
  min-height: 44px;
  box-sizing: border-box;
  cursor: grab;
}

.note-header-row:active {
  cursor: grabbing;
}

.note-header-row .note-title {
  margin: 0;
  padding: 0;
  min-height: auto;
  border-bottom: none;
  flex: 1;
  text-align: center;
}

.gallery-nav-btn {
  background: none;
  border: none;
  color: #0056ed;
  font-family: var(--font-main);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 6px 12px;
  min-width: 36px;
  min-height: 36px;
  pointer-events: auto;
  line-height: 1;
}

/* Recipe Sticky Note */
.sticky-recipe {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  overflow: hidden;
}

.sticky-recipe .note-header-row {
  margin: 0;
  flex-shrink: 0;
}

.sticky-recipe .note-body {
  overflow-y: auto;
  pointer-events: auto;
  flex: 1;
  padding: clamp(16px, 1.2vw, 24px) clamp(18px, 1.3vw, 28px);
}

/* Are.na Sticky Note */
.sticky-arena {
  width: clamp(420px, 28vw, 580px);
}

.sticky-arena .note-title {
  text-align: center;
}

.sticky-arena .note-title a.arena-channel-link {
  color: var(--text-color);
  text-decoration: none;
  pointer-events: auto;
}

.sticky-arena .note-title a.arena-channel-link:hover {
  text-decoration: underline;
}

.arena-gallery {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  pointer-events: auto;
}

.arena-gallery::-webkit-scrollbar {
  display: none;
}

.arena-slide {
  flex-shrink: 0;
  scroll-snap-align: start;
}

.arena-slide img {
  display: block;
  width: clamp(385px, 26vw, 540px);
  height: clamp(290px, 19vw, 400px);
  object-fit: cover;
  pointer-events: none;
}

.arena-loading {
  font-size: 0.75rem;
  opacity: 0.4;
}

.arena-counter {
  text-align: center;
  font-size: 0.7rem;
  margin-top: 6px;
  opacity: 0.5;
}

/* Nina Protocol Sticky Note */
.sticky-nina {
  width: 450px;
  max-height: none;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.nina-ascii {
  font-family: monospace;
  font-size: 0.72em;
  line-height: 1.25;
  margin: 0 auto;
  display: inline-block;
  text-align: left;
}

.sticky-nina .note-body {
  padding: 0;
  flex: 1;
  pointer-events: auto;
}

.sticky-nina .note-body iframe {
  display: block;
  border: none;
}

/* Scatter/Organize note */
.sticky-scatter {
  position: absolute;
  bottom: 40px;
  right: 40px;
  width: clamp(146px, 10.08vw, 224px);
  height: clamp(146px, 10.08vw, 224px);
  max-height: none;
  padding: 0;
  border-radius: 50%;
  background-color: #0056ed;
  color: #ffffff;
  border-color: #0056ed;
  display: flex;
  flex-direction: column;
}

@keyframes fadeInBtn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeOutBtn {
  from { opacity: 1; }
  to   { opacity: 0; }
}

#top-btn {
  display: none;
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: clamp(146px, 10.08vw, 224px);
  height: clamp(146px, 10.08vw, 224px);
  border-radius: 50%;
  background-color: #0056ed;
  color: #ffffff;
  border: none;
  font-family: 'Times New Roman', Times, serif;
  font-weight: normal;
  font-size: clamp(1.2rem, 1.67vw, 2rem);
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(18px, 1.3vw, 28px);
  box-sizing: border-box;
  z-index: 5000;
}

#top-btn.visible {
  display: flex;
  animation: fadeInBtn 0.6s ease;
}

#top-btn.hiding {
  display: flex;
  animation: fadeOutBtn 0.5s ease forwards;
}

.sticky-scatter .hero-action-btn {
  color: #ffffff;
}

.sticky-scatter .note-body {
  pointer-events: auto;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
}

.hero-action-btn {
  background: none;
  border: none;
  font-family: 'Times New Roman', Times, serif, sans-serif;
  font-weight: normal;
  font-size: clamp(1.2rem, 1.67vw, 2rem);
  padding: 0;
  cursor: pointer;
  color: var(--text-color);
  white-space: nowrap;
}

.btn-letter {
  display: inline-block;
}

/* Project Sections */
.project-section {
  padding: 0;
  box-sizing: border-box;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.project-info {
  padding: 40px 20px 20px 40px;
  width: 100%;
}

.project-header {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  margin-bottom: 10px;
}

.year {
  font-size: 1rem;
  font-weight: normal;
  margin-right: 10px;
  width: 50px;
  flex-shrink: 0;
}

.project-details {
  max-width: 500px;
  margin-left: 60px;
  cursor: pointer;
  position: relative;
  transition: opacity 0.3s ease;
}

.project-details.content-hidden {
  opacity: 0;
}

.project-section h2 {
  font-size: 1.5rem;
  margin: 0;
  text-transform: uppercase;
  line-height: 1;
}

.project-section .caption {
  font-size: 1rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

.project-meta {
  margin-top: 20px;
  margin-bottom: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--text-color);
  font-size: 0.9rem;
  line-height: 1.4;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.box-content.snippet .project-meta {
  display: none;
}

.project-meta p {
  margin: 0;
}

/* Four-column project layout */
.proj-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  align-items: start;
  padding: 44px 29px;
  font-size: 16px;
  line-height: 20px;
  column-gap: 20px;
  box-sizing: border-box;
}

.proj-desc {
  font-style: italic;
}

.proj-col1 div:last-child {
  font-weight: bold;
}

.slideshow {
  display: flex;
  overflow-x: auto;
  gap: 0;
  padding-bottom: 0;
  width: 100%;
  scrollbar-width: none;
}

.slideshow::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  background: none;
  border: none;
  font-family: var(--font-main);
  font-size: clamp(1.2rem, 1.67vw, 2rem);
  cursor: pointer;
  padding: 0;
  user-select: none;
  transition: opacity 0.3s ease;
  z-index: 10;
  position: absolute;
  top: 0;
  height: 100%;
  width: 15%;
  min-width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0056ed;
  opacity: 0;

}

.slideshow-container:hover .nav-btn {
  opacity: 1;
}

.nav-btn.prev {
  left: 0;
}

.nav-btn.next {
  right: 0;
}

.nav-btn.hidden {
  opacity: 0 !important;
  pointer-events: none;
}

.slideshow-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  overflow: hidden;
}

.slideshow img,
.slideshow video {
  height: 60vh;
  width: auto;
  max-width: none;
  object-fit: contain;
  border: none;
  flex-shrink: 0;
  display: block;
  margin: 0 auto;
}

/* Tablet styles */
@media (min-width: 601px) and (max-width: 1024px) {
  #hero {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  #floating-hero {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    box-sizing: border-box;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
  }

  .gallery {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    padding: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .gallery::-webkit-scrollbar {
    display: none;
  }

  .draggable {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .sticky-note {
    display: none !important;
  }

  #hero main {
    display: none;
  }


  #hero {
    min-height: unset;
  }

  #hero-bg {
    position: relative;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
  }

  #hero-bg-bio {
    width: 100%;
  }

  #hero-bg-contacts {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 24px;
    justify-content: flex-start;
  }

  .proj-row {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 16px;
  }

  .proj-col1 {
    grid-row: auto;
    grid-column: auto;
  }

  .proj-col2 {
    grid-row: auto;
    grid-column: auto;
  }

  .proj-desc {
    grid-row: auto;
    grid-column: auto;
  }

  .project-section {
    flex-direction: column;
  }

  .project-info {
    padding: 30px 24px 20px 24px;
  }

  .project-details {
    margin-left: 60px;
    max-width: 500px;
  }

  .slideshow img,
  .slideshow video {
    height: 60vh;
  }

}

/* Desktop styles */
@media (min-width: 1025px) {
  .draggable img {
    max-width: 37.5vw;
    max-height: 37.5vh;
  }

  .project-section {
    padding: 0;
    flex-direction: column;
  }

  .project-info {
    padding: 60px 60px 40px 40px;
    width: 100%;
    box-sizing: border-box;
  }

  .slideshow {
    width: 100%;
    overflow-x: auto;
  }

  .slideshow img,
  .slideshow video {
    height: 90vh;
    width: auto;
    max-width: none;
    object-fit: contain;
    margin: 0;
  }

  .project-section h2 {
    font-size: 1.5rem;
  }
}

.slide-counter {
  position: absolute;
  bottom: 20px;
  right: 20px;
  left: auto;
  background-color: rgba(255, 255, 255, 0.8);
  color: #000;
  padding: 4px 10px;
  font-family: var(--font-main);
  font-size: 0.8rem;
  z-index: 20;
  pointer-events: none;
  border: 1px solid rgba(0, 0, 0, 0.1);
}


/* Main Footer */
#main-footer {
  padding: 44px 29px;
  border-top: 1px solid var(--border-color);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 20px;
}

/* Mobile */
@media (max-width: 600px) {
  #hero {
    height: auto;
    min-height: auto;
    overflow: visible;
  }


  #hero-bg {
    position: relative;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  #hero-bg-bio {
    width: 100%;
  }

  #hero-bg-contacts {
    flex-direction: column;
    gap: 4px;
    justify-content: flex-start;
  }

  #floating-hero {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    border: none;
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
    box-shadow: none;
  }

  .gallery {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .gallery::-webkit-scrollbar {
    display: none;
  }

  .draggable {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .sticky-note {
    display: none !important;
  }

  #hero main {
    display: none;
  }

  .proj-row {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  .proj-col2 {
    grid-row: auto;
    grid-column: auto;
  }

  .proj-desc {
    grid-row: auto;
    grid-column: auto;
  }

  .project-info {
    padding: 20px 16px;
    width: 100%;
    box-sizing: border-box;
  }

  .project-details {
    margin-left: 0;
    max-width: none;
    width: 100%;
  }

  .project-header {
    flex-direction: column;
    gap: 4px;
  }

  .year {
    width: auto;
  }

  .slideshow img,
  .slideshow video {
    height: 45vh;
  }

  .slide-counter {
    bottom: 10px;
    right: 10px;
  }

  #main-footer {
    padding: 24px 16px;
  }

}

