/* UI trends layer: expressive type, bento grid, scroll reveal, progress bar,
   cross-page transitions. Everything respects prefers-reduced-motion. */

/* ---- Cross-page transition (Chrome/Edge/Safari 18+; others ignore it) ---- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  nav { view-transition-name: site-nav; }
  .dark-toggle { view-transition-name: site-mode; }
  .wt-widget { view-transition-name: site-tune; }
  ::view-transition-old(root) { animation: ui-fade-out .25s ease both; }
  ::view-transition-new(root) { animation: ui-fade-in .35s ease both; }
}
@keyframes ui-fade-out { to { opacity: 0; } }
@keyframes ui-fade-in { from { opacity: 0; } }

/* ---- Scroll progress ---- */
.ui-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1200;
  background: linear-gradient(90deg, #c45ac0, #ffb347);
  transform: scaleX(0); transform-origin: 0 50%; pointer-events: none;
}

/* ---- Scroll reveal ---- */
.reveal-on [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
.reveal-on [data-reveal].is-in { opacity: 1; transform: none; }

/* ---- Hero ---- */
body:has(.hero) { background: #f7f3ea; }
body.dark-mode:has(.hero) { background: #121212; }
.hero {
  overflow: visible !important;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  align-items: center; gap: 56px;
  min-height: 60vh; margin-bottom: 70px !important;
}
.hero-title {
  font-size: clamp(2.8rem, 6.4vw, 5rem);
  line-height: 1.05; letter-spacing: -0.03em; font-weight: 700; margin: 0 0 26px;
}
.hero-title .hand { position: relative; display: inline-block; }
.hero-title .hand svg {
  position: absolute; left: -2%; bottom: -.14em; width: 104%; height: .2em; overflow: visible;
}
.hero-title .hand path {
  fill: none; stroke: #f2b705; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke;
}
.hero-lead {
  max-width: 54ch; margin: 0; font-size: 1.12rem; line-height: 1.65;
  color: #3a3a3a; font-weight: 400;
}
.dark-mode .hero-lead { color: #c9c9c9; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.bento + .hero-cta { margin: -50px 0 90px; }
.btn {
  display: inline-block; padding: 13px 24px; border-radius: 10px;
  font-weight: 600; font-size: .95rem;
  transition: transform .2s ease, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 2px solid #111; outline-offset: 3px; }
.btn-primary { background: #111; color: #fff; }
.btn-ghost { border: 1.5px solid #111; color: #111; }
.btn-ghost:hover { background: #111; color: #fff; }
.dark-mode .btn-primary { background: #f0f0f0; color: #111; }
.dark-mode .btn-ghost { border-color: #f0f0f0; color: #f0f0f0; }
.dark-mode .btn-ghost:hover { background: #f0f0f0; color: #111; }
.dark-mode .btn:focus-visible { outline-color: #f0f0f0; }

.hero-photo { position: relative; margin: 0; justify-self: center; width: 100%; max-width: 360px; }
.hero-frame {
  aspect-ratio: 4 / 5; overflow: hidden; background: #000;
  border-radius: 999px 999px 22px 22px; display: flex; align-items: flex-end;
}
.dark-mode .hero-frame { box-shadow: 0 0 0 1px #3a3a3a; }
.hero-frame img { display: block; width: 100%; height: auto; }
.doodle { position: absolute; fill: none; stroke: #111; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dark-mode .doodle { stroke: #f0f0f0; }
.doodle-star { width: 44px; left: -22px; top: 14%; }
.doodle-wave { width: 84px; right: -26px; bottom: 12%; }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover { transform: none; } }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 34px; min-height: 0; }
  .hero-photo { order: -1; max-width: 260px; }
}
@media (max-width: 600px) {
  .hero { padding-top: 20px; margin-bottom: 50px !important; }
  .doodle-star { left: -10px; }
  .doodle-wave { right: -8px; }
}

/* ---- Bento grid ---- */
.bento {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 0 0 90px;
}
.bento-tile {
  --mx: 50%; --my: 50%;
  position: relative; overflow: hidden; isolation: isolate;
  grid-column: span 1; min-height: 170px; padding: 22px;
  display: flex; flex-direction: column; justify-content: flex-end;
  border-radius: 20px; background: #fff; color: #111;
  box-shadow: 0 8px 28px rgba(0,0,0,.08);
  transition: transform .35s ease, box-shadow .35s ease, background .3s, color .3s;
}
.bento-tile.wide { grid-column: span 2; }
.bento-tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(196,90,192,.22), transparent 70%);
  transition: opacity .3s;
}
.bento-tile:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.14); }
.bento-tile:hover::before { opacity: 1; }
.bento-tile h2 { font-size: 1.35rem; line-height: 1.15; margin: 0 0 6px; }
.bento-tile p { font-size: .92rem; line-height: 1.5; margin: 0; color: #555; }
.dark-mode .bento-tile { background: #1c1c1c; color: #f0f0f0; box-shadow: 0 8px 28px rgba(0,0,0,.4); }
.dark-mode .bento-tile p { color: #bbb; }
@media (max-width: 860px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) {
  .bento { grid-template-columns: 1fr; margin-bottom: 60px; }
  .bento-tile, .bento-tile.wide { grid-column: span 1; min-height: 130px; }
}

/* ---- Project title micro-interaction (Home) ---- */
.work-text h2 { transition: transform .3s ease, color .3s; }
.work-text a:hover h2 { transform: translateX(6px); color: #c45ac0; }
.work-text a:focus-visible { outline: 2px solid #c45ac0; outline-offset: 6px; border-radius: 8px; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .bento-tile, .work-text h2 { transition: none; }
  .bento-tile:hover, .work-text a:hover h2 { transform: none; }
}
