/* =====================================================================
   HOME PAGE: THE BOTTOM HALF, MORE COLOUR AND MORE FUN   (/home-fun.css)
   Loaded last, so it sits on top of home.css, home-play.css,
   home-extra.css and odds.css without changing them.
   The movement comes from /javascripts/home-fun.js.

   Each section has its own soft, muted colour:
       New on the site   coral        Things to try   violet
       Lately            amber
       Visitor counter   pink         sidebar         one pastel each
   Everything sits still for people who prefer less motion.
   ===================================================================== */

body.hm-page {
    /* muted, like coloured pencils on paper */
    --fun-coral: #b5654f;
    --fun-violet: #7b6e98;
    --fun-teal: #5e8a80;
    --fun-amber: #b58a42;
    --fun-pink: #a8687a;
    --fun-blue: #5b7895;
    --fun-green: #6c8a5c;
    --fun-spring: cubic-bezier(.2, 1.1, .4, 1);
    --fun-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------------------------------------------------------------- soft colour drifting behind it all */
body.hm-page main { position: relative; }
body.hm-page main::before {
    content: ""; position: absolute; z-index: -1; inset: -40px -3.5% 0; pointer-events: none;
    background:
        radial-gradient(520px 420px at 8% 4%, rgba(190, 130, 100, 0.07), transparent 70%),
        radial-gradient(560px 460px at 70% 22%, rgba(130, 120, 160, 0.06), transparent 70%),
        radial-gradient(520px 460px at 18% 52%, rgba(100, 140, 130, 0.06), transparent 70%),
        radial-gradient(560px 480px at 85% 70%, rgba(170, 110, 125, 0.05), transparent 70%),
        radial-gradient(520px 420px at 30% 92%, rgba(190, 150, 80, 0.06), transparent 70%);
    -webkit-mask-image: linear-gradient(transparent, #000 220px); mask-image: linear-gradient(transparent, #000 220px);
    animation: fun-drift 26s ease-in-out infinite alternate;
}
@keyframes fun-drift { to { transform: translate3d(0, 30px, 0) scale(1.03); } }

/* ---------------------------------------------------------------- things pop in as you scroll */
.js body.hm-page .fun-pop {
    opacity: 0; transform: translateY(24px) rotate(var(--tilt, -0.6deg));
    transition: opacity 0.7s var(--fun-ease), transform 0.9s var(--fun-spring);
    transition-delay: calc(var(--n, 0) * 80ms);
}
.js body.hm-page .fun-pop:nth-child(even) { --tilt: 0.6deg; }
.js body.hm-page .fun-pop.is-in { opacity: 1; transform: none; }
/* once it has landed, hovering is quick again */
.js body.hm-page .fun-pop.is-done { transition: transform 0.45s var(--fun-spring), box-shadow 0.45s var(--fun-ease), opacity 0.3s ease; transition-delay: 0s; }

/* ---------------------------------------------------------------- the section titles */
body.hm-page .fresh-head, body.hm-page .play-head, body.hm-page .hx-head {
    position: relative; border-bottom: 0; padding-bottom: 12px;
}
body.hm-page .fresh h3.fresh-title, body.hm-page .play h3.play-title, body.hm-page .hx h3.hx-head {
    display: inline-flex; align-items: center; gap: 12px;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem); letter-spacing: -0.01em; text-transform: none; color: #1b1a17;
}
body.hm-page .hx h3.hx-head { display: flex; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 0; }
/* a little colour blob before each title */
body.hm-page .fresh h3.fresh-title::before, body.hm-page .play h3.play-title::before, body.hm-page .hx h3.hx-head::before {
    content: ""; flex: none; width: 11px; height: 11px; border-radius: 3px; background: var(--sec, var(--fun-coral));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--sec, var(--fun-coral)) 12%, transparent);
    transform: rotate(45deg); transition: transform 0.8s var(--fun-spring);
}
body.hm-page .is-in h3.fresh-title::before, body.hm-page .is-in h3.play-title::before, body.hm-page .is-in h3.hx-head::before { transform: rotate(225deg); }
/* and a colourful line under it that draws itself */
body.hm-page .fresh-head::after, body.hm-page .play-head::after, body.hm-page .hx h3.hx-head::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; border-radius: 2px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--sec, var(--fun-coral)) 70%, transparent), color-mix(in srgb, var(--sec, var(--fun-coral)) 15%, transparent) 55%, transparent);
    transform-origin: left; transform: scaleX(0); transition: transform 1.2s var(--fun-ease) 0.15s;
}
body.hm-page .hx h3.hx-head { position: relative; }
body.hm-page .is-in .fresh-head::after, body.hm-page .is-in .play-head::after, body.hm-page .is-in h3.hx-head::after { transform: scaleX(1); }
body.hm-page .fresh { --sec: var(--fun-coral); }
body.hm-page .play { --sec: var(--fun-violet); }
body.hm-page .lately { --sec: var(--fun-amber); }
body.hm-page .hitc { --sec: var(--fun-pink); }
body.hm-page .play-sub { color: #8f8879; }

/* the round buttons (Shuffle, Surprise me) get colour too */
body.hm-page .fresh-shuffle {
    padding: 6px 14px; font-size: 0.9rem; color: #3a3631; background: #fffdf9; border: 1px solid #ddd5c8;
    transition: transform 0.35s var(--fun-spring), background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
body.hm-page .fresh-shuffle svg { color: var(--sec, var(--fun-coral)); }
body.hm-page .fresh-shuffle:hover { color: #fff; background: #3a3631; border-color: #3a3631; transform: translateY(-1px) rotate(-2deg); }
body.hm-page .fresh-shuffle:hover svg { color: #fff; }

/* =====================================================================
   NEW ON THE SITE: four colourful cards
   ===================================================================== */
body.hm-page .fresh-grid { gap: 18px; }
body.hm-page a.fresh-tile, body.hm-page a.fresh-tile:visited {
    --c: var(--fun-coral);
    border: 0; border-radius: 22px; background: var(--wash, #fff);
    box-shadow: 0 0 0 1px rgba(60, 45, 25, 0.06), 0 12px 26px -22px rgba(60, 45, 25, 0.5);
}
body.hm-page a.fresh-tile.is-in:hover, body.hm-page a.fresh-tile:focus-visible {
    transform: translateY(-4px) rotate(-0.4deg);
    box-shadow: 0 0 0 1px rgba(60, 45, 25, 0.08), 0 22px 36px -24px rgba(60, 45, 25, 0.55);
}
body.hm-page .fresh-tile:nth-child(even).is-in:hover { transform: translateY(-4px) rotate(0.4deg); }
body.hm-page .fresh-kicker { color: var(--c); }
body.hm-page .fresh-go { color: var(--c); transition: transform 0.3s var(--fun-spring), color 0.3s ease; }
body.hm-page .fresh-tile:hover .fresh-go { color: var(--c); transform: translateX(5px); }
body.hm-page .fresh-blog { --c: #a65a45; --wash: #fbf5f0; }
body.hm-page .fresh-photos { --c: #4f6f8e; --wash: #f3f5f7; }
body.hm-page .fresh-art { --c: #95722f; --wash: #faf6ec; }
body.hm-page .fresh-earth { --c: #a9bdd6; --wash: radial-gradient(circle at 70% 0%, #283247, #141924 70%); }
body.hm-page .fresh-earth .fresh-name { color: #fff; }
body.hm-page .fresh-earth .fresh-meta { color: #9ea8b8; }
body.hm-page .fresh-blog-media, body.hm-page .fresh-mosaic, body.hm-page .fresh-media { border-radius: 16px; margin: 8px 8px 0; overflow: hidden; }
body.hm-page .fresh-blog .fresh-blog-media { margin: 8px 0 8px 8px; }
body.hm-page .fresh-frame { background: rgba(255, 255, 255, 0.6); }
body.hm-page .fresh-globe { background: transparent; }
body.hm-page .fresh-globe img { animation: fun-spin 90s linear infinite; }
@keyframes fun-spin { to { transform: rotate(360deg); } }
body.hm-page .fresh-tile:hover .fresh-globe img { transform: none; animation-duration: 20s; }

/* =====================================================================
   THINGS TO TRY: brighter tiles
   ===================================================================== */
body.hm-page .play-grid { gap: 18px; }
body.hm-page a.play-tile, body.hm-page a.play-tile:visited { border: 0; border-radius: 22px; box-shadow: 0 0 0 1px rgba(60, 45, 25, 0.06), 0 12px 26px -22px rgba(60, 45, 25, 0.5); }
body.hm-page a.play-tile.is-ready:hover { transform: translateY(-4px) rotate(-0.4deg); box-shadow: 0 0 0 1px rgba(60, 45, 25, 0.08), 0 22px 36px -24px rgba(60, 45, 25, 0.55); }
body.hm-page a.play-tile.is-ready:nth-child(even):hover { transform: translateY(-4px) rotate(0.4deg); }
body.hm-page a.play-ty { background: #f5f3f7; }
body.hm-page a.play-ca { background: #f8f2f2; }
body.hm-page a.play-wc { background: #f1f5f1; }
body.hm-page .play-ty .play-kicker { color: #6c5f8c; }
body.hm-page .play-ca .play-kicker { color: #9c5a66; }
body.hm-page .play-wc .play-kicker { color: #557a5f; }
body.hm-page .play-go { transition: transform 0.3s var(--fun-spring); }
body.hm-page a.play-tile:hover .play-go { transform: translateX(5px); }
@keyframes fun-bob { 50% { transform: translateY(-2px) rotate(-4deg); } }

/* =====================================================================
   LIVE FROM MY PI: a lively strip
   ===================================================================== */
body.hm-page a.pistrip, body.hm-page a.pistrip:visited {
    border: 0; padding: 13px 18px;
    background: #f1f4ee; border: 1px solid #e0e4d8;
}
@keyframes fun-slide { to { background-position: 300% 0; } }
body.hm-page a.pistrip:hover { transform: translateY(-2px); box-shadow: 0 12px 22px -18px rgba(60, 80, 50, 0.6); }
body.hm-page .pistrip-state { color: #4f7a52; }
body.hm-page .pistrip-go { padding: 3px 11px; border-radius: 999px; border: 1px solid #c9d3c0; color: #4f7a52; }

/* =====================================================================
   LATELY: a colourful timeline
   ===================================================================== */
body.hm-page .lately-list::before { width: 2px; left: 2px; border-radius: 2px; background: linear-gradient(var(--fun-amber), var(--fun-pink), var(--fun-violet), var(--fun-teal)); opacity: 0.6; }
body.hm-page .lately-list li { padding: 8px 10px 8px 0; border-radius: 12px; transition: opacity 0.6s ease var(--d, 0ms), transform 0.6s var(--fun-spring) var(--d, 0ms), background-color 0.25s ease; }
body.hm-page .lately-list li:hover { background: rgba(255, 255, 255, 0.7); }
body.hm-page .lately-list li::before { left: -18px; top: 14px; width: 10px; height: 10px; border: 2.5px solid #fffdf9; background: var(--dot, var(--fun-amber)); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06); }
body.hm-page .lately-list li:nth-child(4n+2)::before { --dot: var(--fun-pink); }
body.hm-page .lately-list li:nth-child(4n+3)::before { --dot: var(--fun-violet); }
body.hm-page .lately-list li:nth-child(4n+4)::before { --dot: var(--fun-teal); }
body.hm-page .lately-list li:first-child::before { animation: fun-pulse 2s ease-out infinite; }
body.hm-page .lately-list li.same-day::before { width: 7px; height: 7px; left: -16px; top: 16px; border-width: 2px; }
@keyframes fun-pulse { 0% { box-shadow: 0 0 0 0 rgba(181, 138, 66, 0.45); } 100% { box-shadow: 0 0 0 8px rgba(181, 138, 66, 0); } }
body.hm-page .lately-list time { align-self: start; justify-self: start; padding: 2px 8px; border-radius: 999px; background: rgba(181, 138, 66, 0.12); color: #8a6a35; font-size: 0.76rem; }
body.hm-page .lately-more { border-radius: 999px; }

/* =====================================================================
   VISITOR COUNTER: smaller and cuter
   ===================================================================== */
body.hm-page .hx-row { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 28px; }
body.hm-page .hitc { max-width: 320px; justify-self: end; width: 100%; }
body.hm-page .hitc-box { padding: 10px 10px 9px; border-radius: 16px; transform: rotate(-1deg); transition: transform 0.5s var(--fun-spring); }
body.hm-page .hitc-box:hover { transform: rotate(0deg) scale(1.02); }
body.hm-page .hitc-digits { --dh: 30px; gap: 2px; }
body.hm-page .hitc-screen { padding: 6px 8px; }
body.hm-page .hx .hitc-plate { font-size: 0.62rem; }
body.hm-page .hitc-ticker { margin-top: 7px; font-size: 0.58rem; }
body.hm-page .hx .hitc-under { margin-top: 7px; font-size: 0.58rem; }
body.hm-page main .hx .hitc-note { margin-top: 6px; font-size: 0.76rem; }
body.hm-page .hx p.you { margin-top: 10px; padding: 7px 10px; gap: 3px 6px; border: 0; border-radius: 14px; font-size: 0.8rem; background: #f2f3ee; }
body.hm-page .hx p.you .you-ip { font-size: 0.85rem; }
body.hm-page .hx .you-note { font-size: 0.7rem; }

/* =====================================================================
   THE SIDEBAR: one pastel card each
   ===================================================================== */
body.hm-page aside { gap: 20px; }
body.hm-page aside .widget { border: 0; border-radius: 22px; box-shadow: 0 0 0 1px rgba(60, 45, 25, 0.06), 0 12px 26px -22px rgba(60, 45, 25, 0.45); }
body.hm-page aside .widget:hover { box-shadow: 0 0 0 1px rgba(60, 45, 25, 0.08), 0 18px 32px -22px rgba(60, 45, 25, 0.5); }
body.hm-page aside .widget.now-box { background: #f7f3f4; }
body.hm-page aside .widget.now-box h3 { display: flex; align-items: center; gap: 8px; }
body.hm-page aside .widget.now-box h3::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--fun-pink); animation: fun-pulse-pink 1.8s ease-out infinite; }
@keyframes fun-pulse-pink { 0% { box-shadow: 0 0 0 0 rgba(168, 104, 122, 0.45); } 100% { box-shadow: 0 0 0 7px rgba(168, 104, 122, 0); } }
body.hm-page .now-list li { border-bottom-color: rgba(123, 110, 152, 0.15); }
body.hm-page .now-key { color: #8a7b9e; }
body.hm-page aside .widget.wx { overflow: hidden; }

/* the days counter: a big colourful number that counts up */
body.hm-page aside .widget.fun-days { position: relative; overflow: hidden; text-align: center; background: #faf4ea; }
body.hm-page aside .widget.fun-days h3 { font-size: 1.02rem; color: #8a4b1d; }
body.hm-page aside .widget.fun-days p { text-align: center; color: #8a5a3b; font-style: italic; }
.fun-days-n {
    display: block; margin: 2px 0 0; font: 400 3.4rem/1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-style: normal;
    font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
    color: #9a5440;
}
.fun-days-bits { position: absolute; inset: 0; pointer-events: none; }
.fun-days-bits i { position: absolute; width: 7px; height: 7px; border-radius: 2px; opacity: 0.45; animation: fun-float 12s ease-in-out infinite; }
.fun-days-bits i:nth-child(1) { left: 10%; top: 22%; background: var(--fun-amber); }
.fun-days-bits i:nth-child(2) { right: 12%; top: 30%; background: var(--fun-pink); border-radius: 50%; animation-delay: -2s; }
.fun-days-bits i:nth-child(3) { left: 18%; bottom: 16%; background: var(--fun-violet); animation-delay: -4s; }
.fun-days-bits i:nth-child(4) { right: 20%; bottom: 20%; background: var(--fun-teal); border-radius: 50%; animation-delay: -5s; }

/* a random place on the internet */
body.hm-page aside .widget.webrand { background: #f1f4f2; }
body.hm-page .webrand-globe { color: var(--fun-teal); }
body.hm-page a.webrand-go, body.hm-page a.webrand-go:visited { border: 0; color: #fff; background: var(--fun-teal); }
body.hm-page a.webrand-go:hover { background: #3a3631; transform: translateY(-2px); }
body.hm-page .webrand-dice { color: #fff; }
body.hm-page a.webrand-go:hover .webrand-dice { color: #fff; }

/* =====================================================================
   REYAD'S YOUTUBE: the cutest button on the page
   ===================================================================== */
nav.hm-dock:not(#_) a.is-yt {
    border: 0; color: #fff; overflow: visible;
    background: linear-gradient(135deg, #b8463c, #c8614b);
    box-shadow: 0 10px 20px -14px rgba(140, 50, 40, 0.8);
}
nav.hm-dock:not(#_) a.is-yt:hover, nav.hm-dock:not(#_) a.is-yt:focus-visible {
    color: #fff; background: linear-gradient(135deg, #a83f36, #b8463c);
    transform: translateY(-3px) rotate(-1.5deg); box-shadow: 0 16px 26px -14px rgba(140, 50, 40, 0.85);
}
nav.hm-dock a.is-yt .d-ico { background: #fffdf9; color: #b8463c; border-radius: 12px; animation: fun-play 3.6s var(--fun-spring) infinite; box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.3); }
nav.hm-dock a.is-yt .d-ico svg path { fill: currentColor; }
@keyframes fun-play { 0%, 70%, 100% { transform: scale(1) rotate(0); } 78% { transform: scale(1.1) rotate(-6deg); } 86% { transform: scale(0.98) rotate(3deg); } }
nav.hm-dock a.is-yt .d-sub { color: rgba(255, 255, 255, 0.88); }
nav.hm-dock a.is-yt .yt-tag {
    position: absolute; top: -9px; right: -6px; padding: 1px 8px; border-radius: 999px; background: #f3e3bd; color: #6e4a1c;
    font: italic 0.72rem/1.4 "Iowan Old Style", Palatino, Georgia, serif; transform: rotate(6deg);
    box-shadow: 0 3px 8px -4px rgba(0, 0, 0, 0.3); animation: fun-tag 4s ease-in-out infinite;
}
@keyframes fun-tag { 50% { transform: rotate(-4deg) translateY(-2px); } }
nav.hm-dock a.is-yt .yt-heart { position: absolute; bottom: 8px; right: 12px; width: 10px; height: 10px; fill: #fff; opacity: 0; pointer-events: none; }
nav.hm-dock a.is-yt .yt-heart:nth-of-type(2) { right: 26px; animation-delay: 1.5s !important; }
nav.hm-dock a.is-yt .yt-heart:nth-of-type(3) { right: 18px; animation-delay: 3s !important; }
nav.hm-dock a.is-yt .yt-heart { animation: fun-heart 4.5s ease-out infinite; }
@keyframes fun-heart { 0% { opacity: 0; transform: translateY(0) scale(0.6); } 20% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(-34px) scale(1.1) rotate(15deg); } }

/* the other icons: each one tinted with its own colour */
nav.hm-dock:not(#_) a:not(.is-yt) { background: color-mix(in srgb, var(--w, #f3eee5) 25%, #fffdf9); }
nav.hm-dock:not(#_) a:not(.is-yt):hover { background: #fff; box-shadow: 0 16px 30px -18px color-mix(in srgb, var(--k, #000) 70%, transparent), 0 0 0 1px color-mix(in srgb, var(--k, #000) 15%, transparent); }
nav.hm-dock a:not(.is-yt) .d-ico { background: #fff; }
nav.hm-dock a:not(.is-yt):hover .d-ico { background: var(--k); color: #fff; }

/* the other icons get a gentle hello as they arrive */
.js nav.hm-dock a { transition-delay: calc(var(--n, 0) * 40ms); }

/* =====================================================================
   SMALLER SCREENS
   ===================================================================== */
@media (max-width: 760px) {
    body.hm-page .hx-row { grid-template-columns: minmax(0, 1fr); }
    body.hm-page .hitc { justify-self: center; }
}
@media (max-width: 700px) {
    nav.hm-dock a.is-yt .yt-tag { right: -4px; top: -8px; }
}

@media (prefers-reduced-motion: reduce) {
    body.hm-page main::before, body.hm-page a.pistrip, .fun-days-bits i, body.hm-page .play-new,
    nav.hm-dock a.is-yt, nav.hm-dock a.is-yt .d-ico, nav.hm-dock a.is-yt .yt-tag, nav.hm-dock a.is-yt .yt-heart,
    body.hm-page .lately-list li:first-child::before, aside .widget.now-box h3::before, body.hm-page .fresh-globe img { animation: none !important; }
    .js body.hm-page .fun-pop { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* the little "New" tags, softer */
body.hm-page .play-new { background: #efe0d9; color: #8a4a3a; box-shadow: none; }
