/* ================================================================
   style.css — 暖系手绘风 · Warm Hand-Drawn Style
   ================================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --paper: #FDF6EE;
  --card: #FFFBF5;
  --caramel: #E8813B;
  --mint: #7EB8A0;
  --cocoa: #3D2C2C;
  --mocha: #6B5244;
}

/* ---------- Paper Texture ---------- */
/* Subtle noise grain overlay */
.paper-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
}

/* ---------- Decorative Blobs ---------- */
.deco-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  z-index: 0;
  pointer-events: none;
}
.deco-blob--mint {
  top: -10%;
  right: -5%;
  width: 300px;
  height: 300px;
  background: var(--mint);
  animation: blob-drift 20s ease-in-out infinite alternate;
}
.deco-blob--caramel {
  bottom: 20%;
  left: -8%;
  width: 250px;
  height: 250px;
  background: var(--caramel);
  animation: blob-drift 24s ease-in-out infinite alternate-reverse;
}
.deco-dots {
  position: fixed;
  bottom: 15%;
  right: 5%;
  opacity: 0.5;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}

@keyframes blob-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(30px, -20px) scale(1.1); }
  100% { transform: translate(-10px, 15px) scale(0.95); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

/* ---------- Avatar Frame Hand-Drawn ---------- */
.avatar-frame {
  position: relative;
  width: 130px;
  height: 130px;
}
.avatar-inner {
  width: 110px;
  height: 110px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  overflow: hidden;
  /* hand-drawn thick border with slight irregularity */
  border: 3px solid var(--caramel);
  box-shadow:
    4px 4px 0 rgba(232, 129, 59, 0.15),
    -2px -2px 0 rgba(126, 184, 160, 0.1);
  position: absolute;
  top: 10px;
  left: 10px;
}
/* Doodle ring around avatar */
.doodle-ring {
  position: absolute;
  top: -5px;
  left: -5px;
  width: 140px;
  height: 140px;
  animation: spin-slow 30s linear infinite;
  pointer-events: none;
}
.doodle-ring-path {
  stroke: var(--caramel);
  stroke-width: 2;
  fill: none;
  opacity: 0.3;
  stroke-dasharray: 12 6;
  stroke-linecap: round;
}
.doodle-ring-inner {
  stroke: var(--mint);
  stroke-width: 1.5;
  fill: none;
  opacity: 0.2;
  stroke-dasharray: 5 8;
  stroke-linecap: round;
}
.doodle-star {
  fill: var(--caramel);
  opacity: 0.5;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 0.7; }
}

/* ---------- Scribble Underline ---------- */
.scribble-underline {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 110%;
  pointer-events: none;
}
.scribble-underline--wide {
  width: 130%;
}
.scribble-underline path {
  /* path drawn left-to-right on scroll */
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.scribble-underline.draw path {
  stroke-dashoffset: 0;
}

/* ---------- Typewriter ---------- */
.typewriter-cursor {
  animation: blink 1s step-end infinite;
  color: var(--caramel);
  font-weight: 300;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ---------- Tag Pills ---------- */
.tag-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}
.tag-pill:hover {
  transform: translateY(-1px);
}
.tag-pill--caramel {
  background: rgba(232, 129, 59, 0.12);
  color: var(--caramel);
  border: 1px solid rgba(232, 129, 59, 0.2);
}
.tag-pill--mint {
  background: rgba(126, 184, 160, 0.12);
  color: #5a9a80;
  border: 1px solid rgba(126, 184, 160, 0.2);
}

/* ---------- Scroll Hint ---------- */
.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.scroll-line {
  animation: scroll-line-move 2s ease-in-out infinite;
}
.scroll-arrow {
  animation: bounce-gentle 2s ease-in-out infinite;
}
@keyframes scroll-line-move {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 0.6; }
}
@keyframes bounce-gentle {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ---------- Works Card ---------- */
.work-card {
  background: var(--card);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  border: 2px solid rgba(232, 129, 59, 0.15);
  padding: 0;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
              box-shadow 0.35s ease;
  box-shadow:
    3px 4px 0 rgba(232, 129, 59, 0.08),
    0 2px 10px rgba(61, 44, 44, 0.04);
  /* slight random rotation */
  transform: rotate(var(--card-rotate, 0deg));
}
.work-card:nth-child(odd)  { --card-rotate: 0.3deg; }
.work-card:nth-child(even) { --card-rotate: -0.4deg; }
.work-card:nth-child(3n)   { --card-rotate: 0.2deg; }

.work-card:hover {
  transform: translateY(-6px) rotate(0deg) scale(1.02);
  box-shadow:
    6px 8px 0 rgba(232, 129, 59, 0.12),
    0 12px 30px rgba(61, 44, 44, 0.08);
  border-color: rgba(232, 129, 59, 0.3);
}

/* ---------- Card Thumbnail ---------- */
.work-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(232,129,59,0.08) 0%, rgba(126,184,160,0.08) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.work-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.work-card:hover .work-card-thumb img {
  transform: scale(1.04);
}
/* Placeholder icon for no-image */
.work-card-thumb-placeholder {
  font-size: 3rem;
  opacity: 0.25;
  transition: transform 0.4s ease;
}
.work-card:hover .work-card-thumb-placeholder {
  transform: scale(1.15) rotate(5deg);
}

/* ---------- Card Body ---------- */
.work-card-body {
  padding: 1.25rem;
}

/* ---------- Scribble hover underline for card title ---------- */
.scribble-title-hover {
  position: relative;
  display: inline-block;
}
.scribble-title-hover::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 3px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 60 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2,3 Q10,1 20,4 Q30,5.5 40,2.5 Q48,0.5 58,3' stroke='%23E8813B' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x bottom;
  background-size: 60px 6px;
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.work-card:hover .scribble-title-hover::after {
  width: 100%;
}

/* ---------- Download Button ---------- */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 22px;
  background: var(--caramel);
  color: #fff;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 2px 3px 0 rgba(232, 129, 59, 0.25);
}
.btn-download:hover {
  background: #d97430;
  box-shadow: 4px 6px 0 rgba(232, 129, 59, 0.3);
  transform: translateY(-2px);
}
.btn-download:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0 rgba(232, 129, 59, 0.2);
}
/* Dashed doodle border on focus-visible */
.btn-download:focus-visible {
  outline: 2px dashed var(--mint);
  outline-offset: 3px;
}

/* ---------- Social Links ---------- */
.social-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  color: var(--mocha);
  background: var(--card);
  border: 2px solid rgba(232, 129, 59, 0.2);
  transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: 2px 3px 0 rgba(232, 129, 59, 0.08);
}
.social-link:hover {
  color: var(--caramel);
  border-color: var(--caramel);
  transform: translateY(-3px) rotate(3deg);
  box-shadow: 4px 6px 0 rgba(232, 129, 59, 0.15);
}
.social-icon {
  transition: transform 0.3s ease;
}
.social-link:hover .social-icon {
  transform: scale(1.1);
}
/* Tooltip */
.social-tooltip {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 0.7rem;
  color: var(--mocha);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
}
.social-link:hover .social-tooltip {
  opacity: 0.7;
  transform: translateX(-50%) translateY(0);
}
/* Email copied state */
.email-tooltip.copied {
  color: var(--mint);
  opacity: 1 !important;
}

/* Ensure button.social-link inherits properly */
button.social-link {
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Divider Scribble ---------- */
.divider-scribble {
  opacity: 0.6;
}

/* ---------- NEW Badge ---------- */
.new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--caramel);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  animation: badge-pop 0.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes badge-pop {
  0% { transform: scale(0) rotate(-10deg); }
  80% { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ---------- Work Tag (inside card) ---------- */
.work-tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.7rem;
  color: var(--mocha);
  background: rgba(126, 184, 160, 0.08);
  border: 1px solid rgba(126, 184, 160, 0.18);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  letter-spacing: 0.02em;
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(232, 129, 59, 0.2);
  color: var(--cocoa);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--paper);
}
::-webkit-scrollbar-thumb {
  background: rgba(232, 129, 59, 0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(232, 129, 59, 0.35);
}

/* ---------- Responsive Tweaks ---------- */
@media (max-width: 768px) {
  .deco-blob {
    display: none;
  }
}

/* ---------- Fade-in on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
