/* =====================================================================
   HOME PAGE EXTRAS  -  /home-extra.css
   The live line from the Pi, "Lately on the site" and the retro counter.
   ===================================================================== */

.hx {
    --hx-ink: #1b1a17;
    --hx-muted: #6b665c;
    --hx-faint: #9a948a;
    --hx-rule: #e4dfd5;
    --hx-wash: #f7f4ee;
    --hx-accent: #8a2b1d;
    --hx-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
    --hx-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-family: var(--hx-serif);
    color: var(--hx-ink);
}
.hx p { margin: 0; font-size: inherit; line-height: 1.45; color: inherit; }

/* ---------------------------------------------------------------
   1. The live line from the Pi
   --------------------------------------------------------------- */

a.pistrip, a.pistrip:visited {
    display: flex;
    align-items: center;
    gap: 10px 14px;
    margin: 22px 0 0;
    padding: 11px 16px;
    border: 1px solid var(--hx-rule);
    border-radius: 999px;
    background: #fff;
    color: var(--hx-ink);
    text-decoration: none;
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
a.pistrip[hidden] { display: none; }
a.pistrip:hover { border-color: #cfc7b8; box-shadow: 0 6px 18px rgba(27, 26, 23, 0.07); transform: translateY(-1px); }
.pistrip-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3aa864;
    box-shadow: 0 0 0 3px rgba(58, 168, 100, 0.15);
    animation: hx-breathe 3.2s ease-in-out infinite;
}
.pistrip.is-stale .pistrip-dot { background: #d29a2c; box-shadow: 0 0 0 3px rgba(210, 154, 44, 0.15); animation: none; }
@keyframes hx-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.pistrip-state { flex: 0 0 auto; font-style: italic; color: var(--hx-accent); }
.pistrip-items { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 2px 0; min-width: 0; color: var(--hx-muted); }
.pistrip-items span { display: inline-block; }
.pistrip-items span:empty { display: none; }
.pistrip-items span:not(:empty) + span:not(:empty)::before { content: "·"; margin: 0 9px; color: #c9c1b2; }
.pistrip-items .flip { animation: hx-flip 0.6s cubic-bezier(.2, .7, .2, 1); }
@keyframes hx-flip { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pistrip-go { flex: 0 0 auto; font-size: 0.88rem; color: var(--hx-ink); white-space: nowrap; }
.pistrip-go i { display: inline-block; font-style: normal; transition: transform 0.3s ease; }
a.pistrip:hover .pistrip-go i { transform: translateX(3px); }

/* ---------------------------------------------------------------
   Two columns: the changelog and the counter
   --------------------------------------------------------------- */

.hx-row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    margin: 26px 0 8px;
}
.hx-head {
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--hx-rule);
    font-size: 0.8rem;
    font-weight: normal;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--hx-accent);
}

/* ---------------------------------------------------------------
   2. Lately on the site: a small timeline
   --------------------------------------------------------------- */

.lately[hidden] { display: none; }
.lately-list { position: relative; list-style: none; margin: 0; padding: 0 0 0 16px; }
.lately-list::before {                         /* the timeline */
    content: "";
    position: absolute;
    left: 3px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--hx-rule);
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 1.1s cubic-bezier(.2, .7, .2, 1);
}
.lately.is-in .lately-list::before { transform: scaleY(1); }
.lately-list li {
    position: relative;
    display: grid;
    grid-template-columns: 5.2em 1fr;
    gap: 12px;
    padding: 6px 0;
    font-size: 0.98rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.6s ease var(--d, 0ms), transform 0.6s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms);
}
.lately.is-in .lately-list li { opacity: 1; transform: none; }
.lately-list li::before {                      /* a dot on the timeline */
    content: "";
    position: absolute;
    left: -16px;
    top: 13px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #c9c1b2;
}
.lately-list li:first-child::before { border-color: var(--hx-accent); background: var(--hx-accent); }
.lately-list li.same-day::before { width: 3px; height: 3px; left: -14px; top: 15px; border-width: 1px; }
.lately-list li.is-older { display: none; }
.lately.show-all .lately-list li.is-older { display: grid; animation: hx-flip 0.5s ease both; }
.lately-list time { font-size: 0.82rem; letter-spacing: 0.04em; color: var(--hx-faint); padding-top: 2px; }
.lately-text a { color: var(--hx-ink); }
.lately-more {
    margin: 8px 0 0 16px;
    padding: 4px 12px;
    border: 1px solid var(--hx-rule);
    border-radius: 999px;
    background: #fff;
    font: inherit;
    font-size: 0.85rem;
    color: var(--hx-muted);
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease;
}
.lately-more:hover { border-color: var(--hx-ink); color: var(--hx-ink); }
.lately-more[hidden] { display: none; }

/* ---------------------------------------------------------------
   3. The retro visitor counter
   --------------------------------------------------------------- */

.hitc[hidden] { display: none; }
.hitc, .lately { min-width: 0; }
.hitc-ticker { max-width: 100%; }
.hitc-box {
    position: relative;
    padding: 14px 14px 12px;
    border-radius: 14px;
    background: linear-gradient(160deg, #3b3833, #1f1d1a 55%, #2a2723);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -2px 0 rgba(0, 0, 0, 0.4),
        0 10px 24px rgba(27, 26, 23, 0.18);
    color: #e8dcc2;
}
.hitc-box::before, .hitc-box::after,              /* four little screws */
.hitc-screws::before, .hitc-screws::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #8b857a, #3c3934 70%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.hitc-box::before { top: 7px; left: 7px; }
.hitc-box::after { top: 7px; right: 7px; }
.hitc-screws::before { bottom: 7px; left: 7px; }
.hitc-screws::after { bottom: 7px; right: 7px; }

.hx .hitc-plate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 9px;
    font: 0.66rem/1 var(--hx-mono);
    letter-spacing: 0.32em;
    color: #c9b88f;
}
.hitc-lamp {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff5a3c;
    box-shadow: 0 0 6px #ff5a3c;
    animation: hx-lamp 2.4s steps(1) infinite;
}
@keyframes hx-lamp { 0%, 70% { opacity: 1; } 71%, 100% { opacity: 0.25; } }

.hitc-screen {
    position: relative;
    overflow: hidden;
    padding: 9px 10px;
    border-radius: 8px;
    background: radial-gradient(ellipse at 50% 40%, #1d140a, #0b0805 75%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 0 1px #000, 0 1px 0 rgba(255, 255, 255, 0.08);
}
.hitc-screen::after {                         /* soft scanlines, drifting down */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px);
    animation: hx-scan 6s linear infinite;
}
@keyframes hx-scan { from { background-position: 0 0; } to { background-position: 0 30px; } }

.hitc-digits {
    --dh: 46px;
    display: flex;
    justify-content: center;
    gap: 3px;
}
.hitc-reel {
    position: relative;
    width: calc(var(--dh) * 0.61);
    height: var(--dh);
    overflow: hidden;
    border-radius: 3px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(255, 160, 40, 0.04) 30%, rgba(255, 160, 40, 0.04) 70%, rgba(0, 0, 0, 0.55));
}
.hitc-reel::after {                           /* a little gap between the reels */
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 6px 8px -6px rgba(0, 0, 0, 0.9), inset 0 -6px 8px -6px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}
.hitc-strip { display: flex; flex-direction: column; will-change: transform; }
.hitc-strip svg { display: block; width: 100%; height: var(--dh); flex: 0 0 auto; }
.hitc-strip rect.on { fill: #ffb347; filter: drop-shadow(0 0 2px rgba(255, 170, 60, 0.9)) drop-shadow(0 0 6px rgba(255, 140, 30, 0.45)); }
.hitc-strip rect.off { fill: #ffb347; opacity: 0.07; }

.hitc-plus {
    position: absolute;
    right: 12px;
    top: 6px;
    font: 600 0.95rem var(--hx-mono);
    color: #ffcf7a;
    text-shadow: 0 0 6px rgba(255, 170, 60, 0.9);
    animation: hx-plus 1.8s ease-out forwards;
}
@keyframes hx-plus { from { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } to { opacity: 0; transform: translateY(-16px); } }

.hitc-ticker {
    position: relative;
    overflow: hidden;
    margin-top: 9px;
    padding: 4px 0;
    border-radius: 4px;
    background: #0b0805;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.8);
    font: 0.66rem/1.2 var(--hx-mono);
    letter-spacing: 0.18em;
    color: #7fe08a;
    text-shadow: 0 0 4px rgba(127, 224, 138, 0.7);
    white-space: nowrap;
}
.hitc-ticker span { display: inline-block; padding-left: 100%; animation: hx-ticker 26s linear infinite; }
@keyframes hx-ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.hx .hitc-under {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 9px 2px 0;
    font: 0.66rem/1.3 var(--hx-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #a99c80;
}
.hitc-under b { font-weight: normal; color: #e8dcc2; }
main .hx .hitc-note { margin-top: 8px; font-size: 0.82rem; font-style: italic; color: var(--hx-faint); text-align: center; }

/* ---------------------------------------------------------------
   Small screens and reduced motion
   --------------------------------------------------------------- */

@media (max-width: 760px) {
    .hx-row { grid-template-columns: minmax(0, 1fr); }
    a.pistrip, a.pistrip:visited { flex-wrap: wrap; border-radius: 14px; }
    .pistrip-go { width: 100%; }
}
@media (max-width: 420px) {
    .hitc-digits { --dh: 38px; }
}
@media (prefers-reduced-motion: reduce) {
    .pistrip-dot, .hitc-lamp, .hitc-screen::after, .hitc-ticker span { animation: none !important; }
    .hitc-ticker span { padding-left: 0; }
    .lately-list li, .lately-list::before { transition: none; opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------
   4. "You're visiting from ...": only the visitor sees their own address
   --------------------------------------------------------------- */

.hx p.you {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 7px;
    margin-top: 12px;
    padding: 9px 12px;
    border: 1px dashed #d9d1c2;
    border-radius: 10px;
    background: var(--hx-wash);
    font-size: 0.92rem;
    color: var(--hx-muted);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.2, .7, .2, 1);
}
.hx p.you[hidden] { display: none; }
.hx p.you.is-on { opacity: 1; transform: none; }

.you-radar { flex: 0 0 auto; fill: none; stroke: #2f9a5c; stroke-width: 1; overflow: visible; }
.you-radar .you-sweep { fill: rgba(47, 154, 92, 0.28); stroke: none; transform-origin: 9px 9px; animation: hx-spin 3.2s linear infinite; }
.you-radar .you-blip { fill: #2f9a5c; stroke: none; animation: hx-blip 3.2s ease-out infinite; }
@keyframes hx-spin { to { transform: rotate(360deg); } }
@keyframes hx-blip { 0%, 8% { opacity: 0; } 12% { opacity: 1; } 60%, 100% { opacity: 0; } }

.you-k { font-style: italic; }
.you-ip {
    font: 600 0.92rem var(--hx-mono);
    letter-spacing: 0.02em;
    color: var(--hx-ink);
}
.you-cursor {
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: -4px;
    background: var(--hx-ink);
    vertical-align: -2px;
    animation: hx-cursor 0.9s steps(1) infinite;
}
.you.all-done .you-cursor { animation: none; opacity: 0; transition: opacity 0.6s ease; }
@keyframes hx-cursor { 50% { opacity: 0; } }

.you-eye {
    padding: 1px 9px;
    border: 1px solid #d2c9b8;
    border-radius: 999px;
    background: #fff;
    font: 0.72rem var(--hx-mono);
    letter-spacing: 0.06em;
    color: var(--hx-muted);
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
    animation: hx-flip 0.5s ease both;
}
.you-eye[hidden] { display: none; }
.you-eye:hover, .you-eye[aria-pressed="true"] { border-color: var(--hx-ink); color: var(--hx-ink); }
.you-place { flex-basis: 100%; text-align: center; font-style: italic; color: var(--hx-muted); }
.you-place span { font-style: normal; color: var(--hx-ink); }
.you-place:empty { display: none; }

main .hx .you-note {
    margin-top: 5px;
    font-size: 0.74rem;
    font-style: italic;
    line-height: 1.4;
    text-align: center;
    color: var(--hx-faint);
}
.hx .you-note[hidden] { display: none; }
.hx .you-note a { color: var(--hx-faint); }

@media (prefers-reduced-motion: reduce) {
    .you-radar .you-sweep, .you-radar .you-blip, .you-cursor { animation: none !important; }
    .hx p.you { transition: none; opacity: 1; transform: none; }
}
