/* Below the hero: the same cut-paper language, quieter. Tape-label headings, paper cards
   that straighten when touched, sticker stats, and a small mat to close the page.
   Everything here animates transform/opacity only, so it stays cheap. */

/* ---------- Tape-label headings ---------- */
.page > section:not(.mat-hero) > h2 {
  position: relative;
  display: inline-block;
  padding: .06em .3em .14em;
  background: var(--mat-brown);
  color: #fff;
  rotate: -1.5deg;
  box-shadow: 0 10px 20px -12px rgb(0 0 0 / .45);
  transition: rotate .5s var(--ease-spring);
}
.page > section > h2#now-title,
.page > section > h2#method-title { background: var(--mat-yellow); color: var(--mat-brown); rotate: 1.2deg; }
.page > section > h2#systems-title { background: var(--mat); color: #fff; rotate: -1deg; }
/* A star sticker pinned to the corner of each label. */
.page > section:not(.mat-hero):not(.closing) > h2::after {
  content: '';
  position: absolute;
  top: -.34em;
  right: -.42em;
  width: .62em;
  height: .62em;
  background: var(--mat-yellow);
  clip-path: polygon(50% 0, 62% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 38% 35%);
  transition: rotate .7s var(--ease-spring), scale .7s var(--ease-spring);
}
.page > section > h2#now-title::after,
.page > section > h2#method-title::after { background: var(--mat-brown); }

.public-page-motion .reveal.is-in > h2 { animation: tape-in .7s var(--ease-spring) .12s both; }
@keyframes tape-in {
  from { opacity: 0; scale: 1.18; translate: 0 -10px; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}

/* "Now" gets a live pin. */
.now-pin {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  margin-left: .9rem;
  padding: .45em .8em;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: middle;
}
.now-pin i { position: relative; width: .55em; height: .55em; border-radius: 50%; background: var(--mat-lime); }
.now-pin i::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--mat-lime); animation: now-ping 1.8s ease-out infinite; }
@keyframes now-ping { to { scale: 3.2; opacity: 0; } }

/* ---------- Paper cards ---------- */
.slider-card:nth-child(odd) > .link-card { rotate: -.7deg; }
.slider-card:nth-child(even) > .link-card { rotate: .6deg; }
.link-card { transition: background .45s, box-shadow .55s var(--ease-out), transform .55s var(--ease-out), rotate .55s var(--ease-spring); }
.link-card:focus-visible { outline: 3px solid var(--mat); outline-offset: 3px; rotate: 0deg; }

/* ---------- Sticker stats ---------- */
.stat-grid .surface-card { rotate: -1deg; transition: rotate .5s var(--ease-spring), transform .5s var(--ease-out), background .35s; }
.stat-grid .surface-card:nth-child(2) { rotate: 1.2deg; }
.stat-grid .surface-card:nth-child(3) { rotate: -.6deg; }
.stat-grid .surface-card strong { font-size: clamp(2rem, 4.2vw, 3rem); font-variant-numeric: tabular-nums; }
.stat-grid .surface-card:nth-child(1) { background: var(--mat-brown); color: #fff; }
.stat-grid .surface-card:nth-child(2) { background: var(--mat-yellow); color: var(--mat-brown); }
.stat-grid .surface-card:nth-child(3) {
  background-color: var(--mat);
  background-image: linear-gradient(var(--mat-line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  color: #fff;
}
.stat-grid .surface-card:nth-child(1) p,
.stat-grid .surface-card:nth-child(3) p { color: #fff; opacity: .88; }
.stat-grid .surface-card:nth-child(2) p { color: var(--mat-brown); }

/* ---------- Method: numbered stickers ---------- */
.method-grid .method-index {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--mat-yellow);
  color: var(--mat-brown);
  font-weight: 700;
  rotate: -8deg;
  transition: rotate .6s var(--ease-spring), scale .6s var(--ease-spring);
}

/* ---------- Closing: a small mat ---------- */
.closing {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 5vw, 4rem);
  border-radius: 1.75rem;
  background-color: var(--mat);
  background-image:
    radial-gradient(ellipse at 50% 40%, transparent 40%, rgb(0 0 0 / .22) 100%),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px),
    linear-gradient(var(--mat-line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line-soft) 1px, transparent 1px);
  background-size: 100% 100%, 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  color: #fff;
}
.page > section.closing > h2 { background: none; box-shadow: none; padding: 0; rotate: 0deg; max-width: 16ch; }
.closing .section-copy { color: #fff; opacity: .92; }
.closing .btn-primary { background: var(--mat-yellow); color: #111; }
.closing .btn-primary:hover { background: #fff; }
.closing .btn-secondary { background: #fff; color: #111; }
.closing .btn:focus-visible { outline: 3px solid var(--mat-yellow); outline-offset: 3px; }
.closing-deco { position: absolute; pointer-events: none; animation: closing-float 5s ease-in-out infinite alternate; }
.closing-deco--star { top: 12%; right: 9%; width: 44px; height: 44px; background: var(--mat-yellow); clip-path: polygon(50% 0, 62% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 38% 35%); }
.closing-deco--tag { right: 7%; bottom: 14%; padding: 6px 12px; border-radius: 3px 14px 14px 14px; background: var(--mat-lime); color: #111; font-size: .8125rem; font-weight: 700; rotate: -6deg; animation-duration: 6.5s; animation-delay: -2s; }
@keyframes closing-float { from { translate: 0 -6px; } to { translate: 0 8px; } }

/* ---------- Hover: only where a real pointer exists ---------- */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .page > section:not(.mat-hero):not(.closing) > h2:hover { rotate: 0deg; }
  .page > section > h2:hover::after { rotate: 144deg; scale: 1.25; }
  .slider-card > .link-card:hover { rotate: 0deg; }
  .link-card:hover .card-go, .link-card:focus-visible .card-go { background: var(--mat-yellow); color: var(--mat-brown); }
  .stat-grid .surface-card:hover { rotate: 0deg; transform: translateY(-6px); }
  .stat-grid .surface-card:nth-child(1):hover { background: #2c2c2c; }
  .stat-grid .surface-card:nth-child(2):hover { background: #fff04a; }
  .stat-grid .surface-card:nth-child(3):hover { background-color: #478a43; }
  .method-grid .surface-card:hover .method-index { rotate: 352deg; scale: 1.12; }
}

@media (max-width: 639px) {
  .now-pin { margin: .75rem 0 0; }
  .closing-deco--star { top: 3%; right: 5%; width: 26px; height: 26px; }
  .closing-deco--tag { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .now-pin i::after, .closing-deco, .public-page-motion .reveal.is-in > h2 { animation: none; }
  .page > section > h2, .page > section > h2::after, .stat-grid .surface-card, .method-index { transition: none; }
}

/* Anchored sections stop clear of the floating nav. */
.page > section[id] { scroll-margin-top: 5.5rem; }

/* ---------- Covers: flat colour, mat grid, tape title, real screens on top ---------- */
.artwork,
.app-art {
  --cover: #3d7a3a;
  --cover-line: rgb(255 255 255 / .13);
  --tape-bg: #fff;
  --tape-ink: #151515;
  background-color: var(--cover);
  background-image: linear-gradient(var(--cover-line) 1px, transparent 1px), linear-gradient(90deg, var(--cover-line) 1px, transparent 1px);
  background-size: 6cqw 6cqw;
  background-position: -1px -1px;
}
.artwork::before { display: none; }
.art-diby { --cover: #3d7a3a; }
.art-synthex { --cover: #6a55e0; }
.art-fnz { --cover: #1f56d8; }
.art-desygner { --cover: #ff8a1f; --tape-bg: #151515; --tape-ink: #fff; }
.art-mixtapez { --cover: #e0423c; }
.art-mobile { --cover: #efece2; --cover-line: rgb(21 21 21 / .07); --tape-bg: #151515; --tape-ink: #fff; }
.app-art-loypass { --cover: #0a4dff; }
.app-art-frotavelo { --cover: #f1f1ec; --cover-line: rgb(21 21 21 / .07); --tape-bg: #0e3cfe; --tape-ink: #fff; }
.app-art-benny { --cover: #f2f2f7; --cover-line: rgb(21 21 21 / .06); --tape-bg: #ff5a36; --tape-ink: #fff; }

/* The cover title is a strip of tape that wraps each line. */
.art-copy > strong,
.app-art-copy strong {
  display: inline;
  margin: 0;
  padding: .04em .22em .1em;
  background: var(--tape-bg);
  color: var(--tape-ink);
  font-weight: 800;
  line-height: 1.3;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  box-shadow: 0 1.6cqw 2.6cqw -1.4cqw rgb(0 0 0 / .5);
}
.art-copy, .app-art-copy { rotate: -1.5deg; transform-origin: 0 50%; }
/* A star sticker in the corner of every cover. */
.art-copy::after,
.app-art-copy::after {
  content: '';
  position: absolute;
  top: -1cqw;
  right: 0;
  width: 7cqw;
  height: 7cqw;
  background: var(--mat-yellow);
  clip-path: polygon(50% 0, 62% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 38% 35%);
  transition: rotate .8s var(--ease-spring), scale .8s var(--ease-spring);
}
.art-desygner .art-copy::after { background: #fff; }
.art-feature .art-copy::after { width: 4.4cqw; height: 4.4cqw; }

/* LoyPass: a stamp card that fills up. */
.loy-card { position: absolute; right: 7%; bottom: -9%; width: 44%; padding: 3.2cqw 3.4cqw 5cqw; border-radius: 2.4cqw; background: #fff; color: #151515; box-shadow: 0 4cqw 7cqw -2cqw rgb(0 0 0 / .5); rotate: 7deg; transition: rotate .7s var(--ease-spring), translate .7s var(--ease-out); }
.loy-card b { display: block; padding-bottom: 1.6cqw; margin-bottom: 2.4cqw; border-bottom: .35cqw solid #151515; font-size: 3.2cqw; letter-spacing: .08em; text-transform: uppercase; }
.loy-stamps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.8cqw; }
.loy-stamps i { aspect-ratio: 1; border: .4cqw solid #151515; border-radius: 50%; transition: background .3s, border-color .3s, scale .45s var(--ease-spring); }
.loy-stamps i:nth-child(-n + 5) { background: #0a4dff; border-color: #0a4dff; }
.app-badge { position: absolute; left: 8%; bottom: 9%; width: 13% !important; height: auto !important; border-radius: 3cqw; border: .7cqw solid #fff; box-shadow: 0 2cqw 4cqw -1cqw rgb(0 0 0 / .45); rotate: -8deg; transition: rotate .6s var(--ease-spring) !important; }

/* Frotavelo: the week's reports turn into a payout. */
.payout-row { position: absolute; left: 8%; bottom: 10%; z-index: 2; display: flex; align-items: center; gap: 1.4cqw; font-size: 2.6cqw; font-weight: 700; color: #151515; rotate: -3deg; }
.payout-row span { padding: 1cqw 2cqw; border-radius: 99px; background: #fff; box-shadow: 0 1.4cqw 2.6cqw -1.2cqw rgb(0 0 0 / .4); transition: scale .5s var(--ease-spring), background .3s, color .3s; }
.payout-row em { font-style: normal; }
.payout-row .is-paid { background: #151515; color: #fff; }
.app-art .app-shot { position: absolute; width: 62%; height: auto; object-fit: contain; transition: transform .9s var(--ease-out); }
.app-art .app-shot--fleet { right: -4%; bottom: -4%; }

/* Benny: light and dark, side by side. */
.app-phone { position: absolute; top: 12%; width: 22%; border: .7cqw solid #1d1d1f; border-radius: 3.4cqw; overflow: hidden; background: #000; box-shadow: 0 4cqw 8cqw -2cqw rgb(0 0 0 / .45); transition: transform .9s var(--ease-out); }
.app-phone--back { right: 26%; top: 22%; transform: rotate(-7deg); }
.app-phone--front { right: 7%; transform: rotate(6deg); border-color: #d9d9de; }
.app-art .app-phone img { width: 100%; height: auto; object-fit: contain; transform: none; }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .link-card:hover .art-copy::after,
  .link-card:hover .app-art-copy::after { rotate: 144deg; scale: 1.2; }
  .link-card:hover .loy-card { rotate: 2deg; translate: 0 -3cqw; }
  .link-card:hover .loy-stamps i { background: #0a4dff; border-color: #0a4dff; scale: 1.08; }
  .link-card:hover .loy-stamps i:nth-child(6) { transition-delay: .12s; }
  .link-card:hover .loy-stamps i:nth-child(7) { transition-delay: .26s; }
  .link-card:hover .loy-stamps i:nth-child(8) { transition-delay: .4s; background: var(--mat-yellow); border-color: var(--mat-yellow); scale: 1.2; }
  .link-card:hover .app-art .app-badge { rotate: 6deg; transform: none; }
  .link-card:hover .app-art .app-shot--fleet { transform: translateX(-3cqw); }
  .link-card:hover .payout-row .is-paid { scale: 1.14; background: #0e3cfe; }
  .link-card:hover .app-art .app-phone--back { transform: translate(-3cqw, -2cqw) rotate(-11deg); }
  .link-card:hover .app-art .app-phone--front { transform: translateY(-3cqw) rotate(2deg); }
  .link-card:hover .app-art .app-phone img { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .loy-card, .loy-stamps i, .payout-row span, .app-phone, .art-copy::after, .app-art-copy::after { transition: none !important; }
}
.app-art-benny .app-art-copy::after { display: none; }

/* ---------- Notes: small blog-like cards, two per row ---------- */
.note-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; margin-top: 1.5rem; }
.link-card.note-card { position: relative; flex-direction: row; align-items: center; gap: 1rem; height: auto; padding: .75rem 3.75rem .75rem .75rem; }
.note-card:nth-child(odd) { rotate: -.6deg; }
.note-card:nth-child(even) { rotate: .6deg; }
.note-thumb { position: relative; flex: none; display: grid; place-items: center; width: 4.75rem; height: 4.75rem; border-radius: .875rem; overflow: hidden; background-color: var(--mat); background-image: linear-gradient(var(--mat-line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line-soft) 1px, transparent 1px); background-size: 12px 12px; }
.note-thumb--systems img { width: 2.3rem; height: auto; margin-top: 1.6rem; border-radius: .4rem; border: 2px solid #151515; rotate: 8deg; transition: rotate .6s var(--ease-spring), translate .6s var(--ease-out); }
.note-thumb--path { grid-auto-flow: column; gap: 5px; background-color: var(--mat-yellow); }
.note-thumb--path i { width: 9px; height: 9px; border-radius: 50%; background: #151515; transition: translate .5s var(--ease-spring), background .3s; }
.note-thumb--path i:last-child { background: var(--mat); }
.note-body { display: grid; gap: .3rem; min-width: 0; }
.note-body strong { font-size: 1.125rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.note-body span { color: var(--muted); font-size: .875rem; line-height: 1.4; letter-spacing: 0; }
.note-card .card-go { top: 50%; right: .875rem; margin-top: -1.125rem; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .note-card:hover { rotate: 0deg; }
  .note-card:hover .note-thumb--systems img { rotate: 0deg; translate: 0 -.5rem; }
  .note-card:hover .note-thumb--path i:nth-child(1) { translate: 0 -6px; }
  .note-card:hover .note-thumb--path i:nth-child(2) { translate: 0 -6px; transition-delay: .08s; }
  .note-card:hover .note-thumb--path i:nth-child(3) { translate: 0 -6px; transition-delay: .16s; }
  .note-card:hover .note-thumb--path i:nth-child(4) { translate: 0 -6px; transition-delay: .24s; }
}
.note-thumb--arcade { background-color: #5b21b6; }
.note-thumb--arcade svg { width: 3.6rem; height: 3.6rem; transition: rotate .6s var(--ease-spring), scale .6s var(--ease-spring); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .note-card:hover .note-thumb--arcade svg { rotate: -8deg; scale: 1.1; }
  .note-card:hover .arcade-led { animation: arcade-blink .5s steps(2) infinite; }
}
@keyframes arcade-blink { to { opacity: .2; } }

/* ---------- Home menu: a little smaller, with the same links as the project pages ---------- */
.floating-nav { gap: 6px; padding: 6px; }
.floating-brand { gap: 9px; padding-right: 8px; }
.floating-brand img { width: 38px; height: 38px; }
.floating-brand span { font-size: 15px; }
.floating-links { display: flex; gap: 2px; }
.floating-links a { padding: 9px 12px; border-radius: 999px; color: #111; font-size: 14px; font-weight: 600; letter-spacing: -.02em; line-height: 1; text-decoration: none; transition: background .25s; }
.floating-links a:hover, .floating-links a:focus-visible { background: rgb(17 17 17 / .07); }
.floating-socials { gap: 5px; margin-left: 4px; }
.floating-socials .icon-btn { width: 38px; height: 38px; }
.floating-socials .icon-btn svg { width: 16px; height: 16px; }
@media (max-width: 639px) {
  .floating-brand span { display: none; }
  .floating-brand { padding-right: 0; }
  .floating-links a { padding: 9px 10px; }
  .floating-socials .icon-btn:not([aria-label="Email"]) { display: none; }
}

/* ---------- Home menu dropdown: its own card, just below the capsule ---------- */
.floating-nav { overflow: visible; }
.floating-links a[aria-expanded="true"] { background: rgb(17 17 17 / .07); }
.menu-drop {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(20rem, calc(100vw - 32px));
  padding: 6px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 40px -14px rgb(0 0 0 / .35), 0 2px 6px rgb(0 0 0 / .08), inset 0 0 0 1px rgb(17 17 17 / .06);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  translate: 0 -8px;
  rotate: -.6deg;
  transform-origin: 20% 0;
  transition: opacity .2s, visibility .2s, translate .35s var(--ease-spring), rotate .35s var(--ease-spring);
}
.menu-drop::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.floating-nav.is-menu-open .menu-drop { opacity: 1; visibility: visible; pointer-events: auto; translate: 0 0; rotate: 0deg; }
.menu-panel { display: none; gap: 2px; }
.menu-panel.is-active { display: grid; }
.menu-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 8px; border-radius: 14px; color: #111; text-decoration: none; transition: background .2s; }
.menu-row:hover, .menu-row:focus-visible { background: rgb(17 17 17 / .05); }
.menu-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; object-fit: cover; background: #f1f1ee; box-shadow: inset 0 0 0 1px rgb(17 17 17 / .08); }
.menu-icon--mark { display: grid; place-items: center; background: var(--mat-yellow); font-size: .7rem; font-weight: 800; }
.menu-icon--arcade { background: #5b21b6; background-image: radial-gradient(circle at 30% 70%, #ecc9a0 1.6px, transparent 1.8px), radial-gradient(circle at 70% 70%, #d4ff1a 1.8px, transparent 2px); }
.menu-copy { display: grid; gap: 1px; min-width: 0; flex: 1; }
.menu-copy strong { font-size: 14px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.menu-copy span { color: var(--muted); font-size: 12px; line-height: 1.3; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-go { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--mat-yellow); font-size: 12px; font-weight: 700; opacity: 0; translate: -4px 0; transition: opacity .2s, translate .3s var(--ease-spring); }
.menu-row:hover .menu-go, .menu-row:focus-visible .menu-go { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) { .menu-drop, .menu-go { transition: opacity .2s; translate: 0 0; rotate: 0deg; } }

/* ---------- Icons inside buttons ---------- */
.btn-icon { flex: none; width: 1.05em; height: 1.05em; margin-right: .55em; }

/* ---------- GitHub: a year of contributions ---------- */
.gh-card { margin-top: 1.5rem; padding: clamp(1rem, 3vw, 1.75rem); border-radius: 1rem; background: var(--surface); }
.gh-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.gh-total { display: grid; gap: .2rem; margin: 0; }
.gh-total strong { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.gh-total span { color: var(--muted); font-size: .9375rem; letter-spacing: -.01em; }
.gh-head .btn { width: auto; }
.gh-graph { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: clamp(1px, .32vw, 4px); min-height: 3rem; }
.gh-graph i, .gh-legend i { aspect-ratio: 1; border-radius: clamp(1px, .25vw, 3px); background: #e6e6e0; }
.gh-graph i { opacity: 0; scale: .4; animation: gh-pop .45s var(--ease-spring) forwards; animation-delay: calc(var(--c) * 14ms); transition: scale .25s var(--ease-spring); }
.gh-graph i.is-empty { visibility: hidden; }
[data-level="1"] { background: #bfe0b9 !important; }
[data-level="2"] { background: #7fbd78 !important; }
[data-level="3"] { background: #3d7a3a !important; }
[data-level="4"] { background: #1f4a1d !important; }
@keyframes gh-pop { to { opacity: 1; scale: 1; } }
.gh-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: .875rem; color: var(--muted); font-size: .75rem; }
.gh-legend i { width: 11px; border-radius: 3px; }
.gh-legend span:first-child { margin-right: 4px; } .gh-legend span:last-child { margin-left: 4px; }
.gh-error { margin: .5rem 0 0; color: var(--muted); font-size: .9375rem; }
@media (hover: hover) and (pointer: fine) { .gh-graph i:hover { scale: 1.6; } }
@media (prefers-reduced-motion: reduce) { .gh-graph i { animation: none; opacity: 1; scale: 1; } }
