/* ==========================================================================
   Clean Minimalist Portfolio Stylesheet
   ========================================================================== */

:root {
  --bg-color: #fdfdfc;
  --text-primary: #111111;
  --text-muted: rgba(0, 0, 0, 0.4);
  --border-divider: #f2f2f2;
  --link-underline: #d9d9d9;
  --link-underline-hover: #666666;
  --selection-color: #111111;
  --selection-bg: #ededed;
  --max-content-width: 36.375rem; /* 582px */
}

::selection {
  color: var(--selection-color, #111111);
  background: var(--selection-bg, #ededed);
}

::-moz-selection {
  color: var(--selection-color, #111111);
  background: var(--selection-bg, #ededed);
}

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

html {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: -0.09008px;
  font-weight: 460;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Top Fade Gradient Mask (Fixed overlay so content fades as you scroll)
   -------------------------------------------------------------------------- */
.top-gradient-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 8rem; /* 128px */
  background: linear-gradient(180deg, #fdfdfc 0%, hsla(0, 0%, 100%, 0) 100%);
  pointer-events: none;
  z-index: 50;
}

@media (max-width: 768px) {
  .top-gradient-mask {
    height: 2.5rem; /* 40px */
  }
}

/* --------------------------------------------------------------------------
   Page Layout Container
   -------------------------------------------------------------------------- */
.page-container {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 5rem 1rem 2.5rem; /* 80px 16px 40px */
  position: relative;
  z-index: 10;
}

@media (max-width: 768px) {
  .page-container {
    padding: 2rem 1.5rem 2.5rem; /* 32px 24px 40px */
  }
}

/* --------------------------------------------------------------------------
   Initial Stagger Entrance Animation
   -------------------------------------------------------------------------- */
@keyframes staggerIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.homepage > .article > * {
  animation: staggerIn 0.5s ease both;
}

.homepage > .article > header { animation-delay: 0s; }
.homepage > .article > p:nth-of-type(1) { animation-delay: 0.05s; }
.homepage > .article > p:nth-of-type(2) { animation-delay: 0.10s; }
.homepage > .article > p:nth-of-type(3) { animation-delay: 0.15s; }
.homepage > .article > p:nth-of-type(4) { animation-delay: 0.20s; }
.homepage > .article > p:nth-of-type(5) { animation-delay: 0.25s; }

.homepage > .writing-section-wrapper {
  animation: staggerIn 0.5s ease both 0.35s;
}

.homepage > .site-footer {
  animation: staggerIn 0.5s ease both 0.45s;
}

/* While scribe writing animation is running, disable initial CSS entrance animations */
body.is-writing-page .homepage > .article > *,
body.is-writing-page .homepage > .writing-section-wrapper,
body.is-writing-page .homepage > .site-footer {
  animation: none !important;
}

/* --------------------------------------------------------------------------
   Article / Bio Typography
   -------------------------------------------------------------------------- */
.article-header {
  padding-bottom: 8px;
}

/* Hero writing track and mascot */
.hero-write-track {
  display: inline-flex;
  align-items: center;
  position: relative;
  vertical-align: middle;
}

.hero-write-track .hero-title {
  display: inline-block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: -0.09008px;
  color: var(--text-primary);
  white-space: nowrap;
  vertical-align: middle;
}

/* While writing: smoothly unmask text from left to right with soft ink lead */
.hero-write-track.is-writing .hero-title {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 10px), rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(to right, black calc(100% - 10px), rgba(0, 0, 0, 0) 100%);
}

.blue-circle-character {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  margin-left: 2px;
  cursor: pointer;
  vertical-align: middle;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center bottom;
  will-change: transform;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* While writing all text across the page */
.blue-circle-character.is-traveling {
  position: absolute;
  pointer-events: none;
  margin: 0 !important;
  z-index: 999;
  will-change: left, top, transform;
}

.scribe-char {
  display: inline;
  transition: opacity 0.05s ease-out;
}

.scribe-space {
  display: inline;
}

.blue-circle-character picture,
.blue-circle-character img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}

/* Pen writing bobble / wobble when moving across text */
.blue-circle-character.is-writing-active {
  animation: writingWobble 0.16s infinite ease-in-out alternate;
}

@keyframes writingWobble {
  0% {
    transform: translateY(0px) rotate(-4deg) scale(1);
  }
  50% {
    transform: translateY(-3px) rotate(5deg) scale(1.06, 0.94);
  }
  100% {
    transform: translateY(2px) rotate(-3deg) scale(0.94, 1.06);
  }
}

/* When settled beside the name */
.blue-circle-character.is-settled {
  position: relative;
  margin-left: 8px;
}

/* Landing celebration hop when writing completes */
.blue-circle-character.just-landed {
  animation: mascotLanding 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes mascotLanding {
  0% {
    transform: translateY(0) scale(1, 1);
  }
  30% {
    transform: translateY(-7px) scale(0.88, 1.15) rotate(7deg);
  }
  60% {
    transform: translateY(1.5px) scale(1.15, 0.88) rotate(-3deg);
  }
  80% {
    transform: translateY(-2px) scale(0.97, 1.03) rotate(1deg);
  }
  100% {
    transform: translateY(0) scale(1, 1) rotate(0deg);
  }
}

/* Playful hover state */
.blue-circle-character:hover {
  transform: translateY(-2px) scale(1.2) rotate(6deg);
  filter: drop-shadow(0 3px 8px rgba(16, 132, 234, 0.25));
}

.blue-circle-character:active {
  transform: translateY(1px) scale(0.95) rotate(-2deg);
}

/* Spin flourish on manual trigger click */
.blue-circle-character.is-spinning {
  animation: mascotSpin 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes mascotSpin {
  0% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.25) translateY(-5px) rotate(180deg);
  }
  100% {
    transform: scale(1) translateY(0) rotate(360deg);
  }
}

.article-header time {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 460;
  color: var(--text-muted);
  letter-spacing: -0.09008px;
}

.article p {
  padding-top: 16px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 460;
  letter-spacing: -0.09008px;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Inline Interactive Links (.basic-link)
   -------------------------------------------------------------------------- */
.basic-link {
  position: relative;
  display: inline;
  color: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

.basic-link::before {
  pointer-events: none;
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  border-radius: 2px;
  background: var(--link-underline);
  transition: background-color 0.2s ease, opacity 0.25s ease;
}

.basic-link:hover::before {
  background: var(--link-underline-hover);
}

/* While full-page writing is in progress: hide floating link underlines until written */
body.is-writing-page .basic-link::before {
  opacity: 0;
}

.basic-link.link-revealed::before {
  opacity: 1 !important;
}

/* --------------------------------------------------------------------------
   Writing Section
   -------------------------------------------------------------------------- */
.writing-section-wrapper {
  padding-top: 3rem; /* 48px */
}

/* Hide project section lines and dividers while writing until reached */
body.is-writing-page .writing-section-wrapper {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(8px);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
}

.writing-section-wrapper.section-revealed {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* Hide footer until writing completes */
body.is-writing-page .site-footer {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(8px);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
}

.site-footer.footer-revealed {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

.post-list-title {
  color: var(--text-muted);
  font-size: 14px; /* 0.875rem */
  font-weight: 460;
  letter-spacing: -0.09008px;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-divider);
}

.post-list-items {
  position: relative;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.year-block {
  list-style: none;
  border-bottom: 1px solid var(--border-divider);
}

.year-block > ul {
  list-style: none;
}

.post-link {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40.5px;
  padding: 11.76px 0 11.76px 108px;
  text-decoration: none;
  color: var(--text-primary);
  transition: opacity 0.25s ease;
}

@media (max-width: 520px) {
  .post-link {
    padding-left: 48px;
  }
}

/* Subtle separator line between items inside a year group */
.post-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 108px;
  right: 0;
  border-bottom: 1px solid var(--border-divider);
}

@media (max-width: 520px) {
  .post-link::after {
    left: 48px;
  }
}

/* Last item in a year group does not duplicate the bottom border */
.year-block > ul > li:last-child > .post-link::after {
  display: none;
}

.post-link h2 {
  font-size: 14px;
  font-weight: 460;
  color: var(--text-primary);
  line-height: normal;
  letter-spacing: -0.09008px;
}

.post-link time {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 460;
  color: var(--text-muted);
  line-height: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.09008px;
}

.post-link .day-month {
  color: var(--text-muted);
}

.post-link .slash {
  display: none;
  width: 0;
  height: 0;
  font-size: 0;
}

.post-link .year-label {
  position: absolute;
  left: 0;
  width: 108px;
  color: var(--text-muted);
  font-weight: 460;
  letter-spacing: -0.09008px;
}

@media (max-width: 520px) {
  .post-link .year-label {
    width: 48px;
  }
}

/* Year label only displays on the first row of each year group */
.year-block > ul > li:not(:first-child) .year-label {
  display: none;
}

/* --------------------------------------------------------------------------
   Writing List Hover Dimming (Desktop)
   -------------------------------------------------------------------------- */
@media screen and (min-width: 520px) {
  .post-list-items:hover .post-link {
    opacity: 0.3;
  }

  .post-list-items .post-link:hover {
    opacity: 1.0;
  }

  /* Year column stays crisp */
  .post-list-items:hover .year-label {
    opacity: 1.0 !important;
  }
}

.post-list-container {
  position: relative;
}

/* --------------------------------------------------------------------------
   Minimalist Magnetic Timeline Ruler (Right Margin, 2024 -> 2026)
   -------------------------------------------------------------------------- */
.timeline-ruler {
  position: absolute;
  left: calc(100% + 24px);
  top: 0;
  width: 44px;
  height: 100%;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
}

/* Base muted track rail (runs from 2026 down to 2024) */
.ruler-track {
  position: absolute;
  left: 5px;
  top: 20.25px;
  height: 245px;
  width: 1px;
  background: rgba(0, 0, 0, 0.09);
  transition: background 0.2s ease;
}

.timeline-ruler:hover .ruler-track {
  background: rgba(0, 0, 0, 0.14);
}

/* Active solid fill connecting 2024 up through the timeline */
.ruler-track-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 245px;
  background: #111111;
  transition: height 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: height;
}

/* Precision Ruler Ticks */
.ruler-tick {
  position: absolute;
  left: 2px;
  height: 1px;
  width: 6px;
  background: rgba(0, 0, 0, 0.16);
  transform: translateY(-0.5px);
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s ease;
  will-change: width, background-color;
}

.ruler-tick.year-tick {
  width: 8px;
  background: rgba(0, 0, 0, 0.32);
}

.ruler-tick.is-active {
  width: 12px;
  background: #111111;
}

/* Year Milestone Markers beside track */
.ruler-year-label {
  position: absolute;
  left: 18px;
  font-size: 10px;
  font-weight: 480;
  letter-spacing: -0.01em;
  color: rgba(0, 0, 0, 0.3);
  transform: translateY(-50%);
  user-select: none;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease, font-weight 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ruler-year-label.is-active {
  color: #111111;
  font-weight: 600;
  transform: translateY(-50%) translateX(1px);
}

/* Magnetic Pip / Indicator (Critically Damped, Zero Bounce) */
.magnetic-pip {
  position: absolute;
  left: 5.5px;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #111111;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg-primary, #fdfdfc), 0 1px 3px rgba(0, 0, 0, 0.2);
  transform: translate3d(-50%, 16.75px, 0);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* When scrubbing on ruler, instantaneous 1:1 tactile direct tracking */
.timeline-ruler.is-scrubbing .magnetic-pip,
.timeline-ruler.is-scrubbing .ruler-track-progress {
  transition: none !important;
}

/* List Row focus highlights during ruler scrub */
.post-link.is-ruler-focused {
  opacity: 1.0 !important;
}

.post-list-container.has-scrub .post-link:not(.is-ruler-focused) {
  opacity: 0.32;
}

@media (max-width: 720px) {
  .timeline-ruler {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Footer & Interactive Live Clock
   -------------------------------------------------------------------------- */
.site-footer {
  padding: 40px 0 80px;
}

.footer-container {
  width: 100%;
}

.footer-row {
  display: flex;
  align-items: center;
}

.footer-time-text {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 29px;
  font-weight: 460;
  letter-spacing: -0.04px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.clock-display {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.number-flow {
  font-weight: 460;
  color: var(--text-muted);
}

.meridiem {
  color: var(--text-muted);
  margin-right: 4px;
}

.bunny-button {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-block;
  vertical-align: bottom;
  margin-bottom: -6px;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bunny-button:hover {
  transform: scale(1.12);
}

.bunny-button:active {
  transform: scale(0.92);
}

/* --------------------------------------------------------------------------
   Bunny Ear Keyframe Animations (Exact from live site)
   -------------------------------------------------------------------------- */
.footer-ear-left-awake,
.footer-ear-right-awake,
.footer-ear-left-sleep,
.footer-ear-right-sleep {
  transform-origin: bottom center;
  transform-box: fill-box;
}

@keyframes awakeLeftEarTwitch {
  0%, 9% { transform: rotate(0deg); }
  12% { transform: rotate(-8deg); }
  16%, 34% { transform: rotate(0deg); }
  38% { transform: rotate(-12deg); }
  42% { transform: rotate(-6deg); }
  48%, 58% { transform: rotate(0deg); }
  62% { transform: rotate(-30deg); }
  70% { transform: rotate(-28deg); }
  78% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

@keyframes awakeRightEarTwitch {
  0%, 9% { transform: rotate(0deg); }
  12% { transform: rotate(6deg); }
  16%, 34% { transform: rotate(0deg); }
  38% { transform: rotate(10deg); }
  42% { transform: rotate(4deg); }
  48%, 58% { transform: rotate(0deg); }
  62% { transform: rotate(-30deg); }
  70% { transform: rotate(-28deg); }
  78% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.footer-ear-left-awake {
  animation: awakeLeftEarTwitch 12s ease-in-out infinite;
}

.footer-ear-right-awake {
  animation: awakeRightEarTwitch 12s ease-in-out infinite;
}

@keyframes sleepingLeftEar {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(3deg); }
}

@keyframes sleepingRightEar {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-3deg); }
}

.footer-ear-left-sleep {
  animation: sleepingLeftEar 4s ease-in-out infinite;
}

.footer-ear-right-sleep {
  animation: sleepingRightEar 4s ease-in-out infinite;
}

@keyframes zFloat1 {
  0% { transform: translate(0, 0) scale(0.7); opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(4px, -14px) scale(1); opacity: 0; }
}

@keyframes zFloat2 {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(6px, -16px) scale(0.9); opacity: 0; }
}

@keyframes zFloat3 {
  0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(8px, -18px) scale(0.8); opacity: 0; }
}

.z-float-1 { animation: zFloat1 3s ease-out infinite; }
.z-float-2 { animation: zFloat2 3s ease-out 1s infinite; }
.z-float-3 { animation: zFloat3 3s ease-out 2s infinite; }

/* Awake eye blink animation */
@keyframes eyeBlink {
  0%, 18%, 22%, 49%, 55%, 100% {
    transform: scaleY(1);
  }
  20%, 52% {
    transform: scaleY(0.1);
  }
}

.awake-eye {
  transform-origin: center;
  animation: eyeBlink 5s ease-in-out infinite;
}
