/* ===========================================================================
   Home page refresh: hero actions, stats, about, app carousel and list, app sheet
   and scroll reveal. Buttons, nav progress and the contact section are shared
   with the portfolio, so they live in style.css. Only index.html loads this.
   =========================================================================== */

@view-transition { navigation: auto; }

/* === Hero === */
.hero-content {
  transform: translate3d(0, var(--hero-y, 0px), 0);
  opacity: var(--hero-o, 1);
}

/* soft dark pool behind the text so it reads over the bright rings */
.hero-content::before {
  content: "";
  position: absolute;
  inset: -12% -18%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.35) 60%, transparent);
  filter: blur(8px);
  pointer-events: none;
}
[data-theme="light"] .hero-content::before {
  background: radial-gradient(closest-side, rgba(245, 245, 247, 0.85), rgba(245, 245, 247, 0.4) 60%, transparent);
}

.hero-logo {
  transform: translate3d(calc(var(--px, 0) * 18px), calc(var(--py, 0) * 18px), 0);
  transition: transform 0.6s cubic-bezier(.2,.7,.3,1);
}
.hero-title,
.hero-subtitle {
  transform: translate3d(calc(var(--px, 0) * 8px), calc(var(--py, 0) * 8px), 0);
  transition: transform 0.6s cubic-bezier(.2,.7,.3,1);
}
#hero-shader {
  transform: translate3d(calc(var(--px, 0) * -14px), calc(var(--py, 0) * -14px), 0) scale(1.04);
  transition: transform 0.8s cubic-bezier(.2,.7,.3,1);
}

[data-theme="dark"] .hero-subtitle {
  color: #c7c7cc;
}

.hero-lead {
  margin-top: 14px;
  font-size: clamp(15px, 2vw, 17px);
  color: var(--text-secondary);
  max-width: 46ch;
}
[data-theme="dark"] .hero-lead { color: #a1a1a6; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 1;
  width: 24px;
  height: 38px;
  margin-left: -12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  opacity: var(--hero-o, 1);
}
.hero-scroll span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.8);
  animation: hero-scroll 1.8s cubic-bezier(.6,0,.4,1) infinite;
}
[data-theme="light"] .hero-scroll { border-color: rgba(0, 0, 0, 0.3); }
[data-theme="light"] .hero-scroll span { background: rgba(0, 0, 0, 0.6); }

@keyframes hero-scroll {
  0%   { transform: translateY(0);    opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(14px); opacity: 0; }
}

/* === Stats strip === */
.stats {
  border-top: 1px solid var(--border);
  padding: 56px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  max-width: 1120px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.stat-num {
  font-family: "Archivo Expanded", -apple-system, BlinkMacSystemFont, sans-serif;
  font-stretch: 125%;
  font-weight: 300;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--text-primary) 30%, var(--text-tertiary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.stats-langs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 1000px;
  margin: 36px auto 0;
  padding: 0 24px;
}
.stats-langs span {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: color 0.2s, border-color 0.2s, transform 0.25s cubic-bezier(.2,.7,.3,1);
}
.stats-langs span:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
  transform: translateY(-2px);
}

/* === About === */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  align-items: start;
}

.about .section-title {
  max-width: none;
}

.about-photo {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  display: block;
  transition: transform 1.2s cubic-bezier(.2,.7,.3,1);
}
.about-photo:hover img { transform: scale(1.04); }

.about-main .about-name {
  font-size: 28px;
  letter-spacing: -0.03em;
}
.about-main .about-role { margin-bottom: 18px; }
.about-main .about-tools { justify-content: flex-start; margin-top: 24px; }
.about-main .about-card-footer { margin-top: 28px; }

.about-timeline {
  list-style: none;
  margin-top: 28px;
  border-left: 1px solid var(--border);
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.about-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr;
  column-gap: 12px;
  row-gap: 2px;
}
.about-timeline li::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--text-tertiary);
}
.about-timeline li:first-child::before {
  background: #30d158;
  border-color: #30d158;
  box-shadow: 0 0 12px rgba(48, 209, 88, 0.6);
}
.about-tl-year {
  grid-row: span 2;
  font-size: 13px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.about-tl-what {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.about-tl-detail {
  font-size: 13px;
  color: var(--text-secondary);
}

/* === Apps: heading ===
   The ring and the list + preview get a wider column than the other sections;
   a divider instead of two full section paddings keeps the About → Apps gap in rhythm */
.apps .container {
  max-width: 1160px;
}
.about { padding-bottom: 80px; }
.apps {
  padding-top: 80px;
  border-top: 1px solid var(--border);
}

.apps-head .section-title {
  max-width: none;
  margin: 0 0 8px;
}
.apps-sub {
  font-size: 17px;
  color: var(--text-secondary);
}

/* === Apps: 3D icon cylinder === */
.orbit {
  --face: 150px;
  position: relative;
  height: 300px;
  margin: 24px -24px 0;
  overflow: hidden;
  perspective: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  /* fade the edges so the ring melts into the page */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.orbit.is-dragging { cursor: grabbing; }

.orbit-ring {
  position: relative;
  width: var(--face);
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.orbit-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 10px;
  transform-style: preserve-3d;
  color: var(--text-primary);
  will-change: opacity;
}
.orbit-face:hover { color: var(--text-primary); }

.orbit-face img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 23%;
  object-fit: cover;
  pointer-events: none;
  box-shadow: 0 18px 40px -14px color-mix(in srgb, var(--c) 70%, transparent);
  transition: transform 0.35s cubic-bezier(.2,.7,.3,1);
}
.orbit-face:hover img { transform: translateY(-6px) scale(1.04); }

.orbit-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.orbit-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  margin-top: 4px;
}

/* === Apps: list ===
   Every app as a row: icon, name, one-liner and a chevron. Two columns on desktop,
   one on phones. A click opens the app's sheet; each row is also a link to its page. */
.showcase {
  margin-top: 48px;
}

.showcase-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 32px;
}

.showcase-item {
  --c: #2997ff;
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.25s;
}
.showcase-item:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--c) 8%, transparent);
}
.showcase-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--c) 70%, transparent);
  outline-offset: -2px;
  border-radius: 12px;
}

.showcase-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--c) 70%, #000);
  transition: transform 0.3s cubic-bezier(.2,.7,.3,1);
}
.showcase-item:hover .showcase-icon { transform: scale(1.06); }

.showcase-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.showcase-name {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.showcase-line {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.showcase-chip { display: none; }

/* a chevron says the row opens something; it nudges right on hover */
.showcase-item::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-right: 6px;
  border-right: 1.5px solid var(--text-tertiary);
  border-top: 1.5px solid var(--text-tertiary);
  transform: rotate(45deg);
  transition: transform 0.25s, border-color 0.25s;
}
.showcase-item:hover::after {
  border-color: var(--text-secondary);
  transform: translateX(3px) rotate(45deg);
}

@media (max-width: 860px) {
  .showcase { margin-top: 32px; }
  .showcase-list { grid-template-columns: 1fr; }
  .showcase-item { padding: 12px 6px; }
  .showcase-item:hover { background: transparent; }
  .showcase-icon { width: 48px; height: 48px; border-radius: 12px; }
}

/* === App sheet (dialog) === */
.app-sheet {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: min(90vh, 900px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  overflow: hidden;
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.7);
}
.app-sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.45s cubic-bezier(.2,.8,.2,1);
}
.app-sheet.is-closing {
  animation: sheet-out 0.25s ease-in forwards;
}
.app-sheet::backdrop {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: backdrop-in 0.35s ease;
}
.app-sheet.is-closing::backdrop {
  animation: backdrop-out 0.25s ease forwards;
}

@keyframes sheet-in   { from { opacity: 0; transform: translateY(40px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes sheet-out  { to   { opacity: 0; transform: translateY(24px) scale(0.98); } }
@keyframes backdrop-in  { from { opacity: 0; } }
@keyframes backdrop-out { to   { opacity: 0; } }

.app-sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 0 8px;
  background: radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--sheet-c, #2997ff) 22%, transparent), transparent 70%);
}
.app-sheet-body .app-featured {
  padding: 0 32px;
  margin-bottom: 8px;
}
.app-sheet-body .carousel { padding-top: 24px; }
.app-sheet-body .carousel-slide { width: 190px; }
.app-sheet-body .carousel--wide .carousel-slide { width: 400px; }
.app-sheet-body .carousel--mixed .carousel-slide { width: auto; }
.app-sheet-body .carousel--mixed .carousel-slide img { max-height: 400px; max-width: calc(100vw - 80px); }

.app-sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 70%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, transform 0.3s;
}
.app-sheet-close:hover { color: var(--text-primary); transform: rotate(90deg); }

body.sheet-open { overflow: hidden; }

/* === Scroll reveal === */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s cubic-bezier(.2,.7,.3,1) var(--d, 0ms), transform 0.8s cubic-bezier(.2,.7,.3,1) var(--d, 0ms);
}
.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* === Responsive === */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-photo { max-width: 360px; aspect-ratio: 1; }
}

@media (max-width: 600px) {
  .orbit { --face: 92px; height: 200px; margin-top: 8px; }
  .orbit-face { gap: 8px; padding: 0 6px; }
  .orbit-name { font-size: 11px; }

  .stats { padding: 40px 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); row-gap: 32px; }

  .app-sheet {
    width: 100vw;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
  }
  .app-sheet-body { padding-top: 28px; }
  .app-sheet-body .app-featured { padding: 0 20px; }
  @keyframes sheet-in  { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes sheet-out { to   { transform: translateY(100%); } }

  .hero-actions .btn { height: 42px; padding: 0 18px; font-size: 14px; }

  /* narrow screens: the rings run right behind the copy, so darken the pool and lift the text */
  .hero-content::before {
    inset: 4% -4%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.55) 70%, transparent);
  }
  [data-theme="dark"] .hero-lead { color: #d1d1d6; }
  [data-theme="dark"] .hero-subtitle,
  [data-theme="dark"] .hero-lead { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9); }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .hero-logo, .hero-title, .hero-subtitle, #hero-shader { transform: none; }
  .hero-scroll span { animation: none; }
  .app-sheet[open], .app-sheet::backdrop { animation: none; }
}
