/* =====================================================================
   NYC CLOCK  -  /nyc-clock.css   (made by /javascripts/nyc-clock.js)
   A small glowing digital clock, like an old 1980s bedside clock
   with a green-blue vacuum fluorescent display (VFD).
   ===================================================================== */

header.has-clock { position: relative; }

.nyc-clock {
    --glow: #8ff7df;
    --glow-dim: rgba(143, 247, 223, 0.07);
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    position: absolute;
    right: 0;
    top: 0.5rem;
    z-index: 2;
    padding: 6px;
    border-radius: 13px;
    background: linear-gradient(160deg, #403c36, #1d1b18 55%, #2b2824);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -2px 0 rgba(0, 0, 0, 0.45),
        0 8px 20px -6px rgba(27, 26, 23, 0.35);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.35s cubic-bezier(.2, .7, .2, 1), box-shadow 0.35s ease;
}
.nyc-clock[hidden] { display: none; }
.nyc-clock:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), inset 0 -2px 0 rgba(0,0,0,0.45), 0 14px 26px -8px rgba(27,26,23,0.45); }
.nyc-clock:focus-visible { outline: 2px solid #8a2b1d; outline-offset: 3px; }

/* the dark glass */
.nyc-screen {
    position: relative;
    overflow: hidden;
    padding: 6px 10px 6px 9px;
    border-radius: 8px;
    background: radial-gradient(ellipse at 45% 35%, #0f1d1b, #050a09 78%);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85), 0 0 0 1px #000, 0 1px 0 rgba(255, 255, 255, 0.08);
}
.nyc-screen::before {                  /* the fine wire mesh in front of a real VFD */
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(rgba(0, 0, 0, 0.55) 0.55px, transparent 0.9px) 0 0 / 3px 3px;
    opacity: 0.6;
}
/* the little labels on top */
.nyc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font: 0.56rem/1 var(--mono);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--glow);
    opacity: 0;
    text-shadow: 0 0 4px rgba(143, 247, 223, 0.6);
    transition: opacity 0.6s ease 0.3s;
}
.nyc-zone { display: inline-flex; align-items: center; gap: 5px; }
.nyc-zone b { font-weight: normal; }
.nyc-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #ff6b4a;
    box-shadow: 0 0 5px #ff6b4a;
    animation: nyc-rec 2s ease-in-out infinite;
}
@keyframes nyc-rec { 50% { opacity: 0.25; } }

/* the digits */
.nyc-time { display: flex; align-items: flex-end; gap: 6px; }
.nyc-digits {
    display: flex;
    align-items: center;
    gap: 3px;
    transform: skewX(-6deg);
    filter: drop-shadow(0 0 2px rgba(143, 247, 223, 0.85)) drop-shadow(0 0 6px rgba(80, 230, 200, 0.35));
}
.nyc-d { display: block; width: 18px; height: 31px; overflow: visible; }
.nyc-d .seg {
    fill: var(--glow);
    opacity: 0.07;                       /* the faint "ghost" of every segment */
    transition: opacity 0.45s ease-out, fill 0.3s ease;
}
.nyc-d .seg.on { opacity: 1; transition: opacity 0.07s ease-in, fill 0.3s ease; }
.nyc-d .seg.new { fill: #f1fffb; }

.nyc-colon {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin: 0 1px;
}
.nyc-colon i {
    display: block;
    width: 4px; height: 4px;
    border-radius: 1px;
    background: var(--glow);
    opacity: 0.07;
}
.is-on .nyc-colon i { opacity: 1; }
.nyc-colon.tick i { animation: nyc-colon 1s ease-in-out; }
@keyframes nyc-colon { 0% { opacity: 1; } 50% { opacity: 0.18; } 100% { opacity: 1; } }

.nyc-side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 1px;
}
.nyc-ap {
    display: flex;
    gap: 4px;
    font: 0.52rem/1 var(--mono);
    letter-spacing: 0.08em;
}
.nyc-ap b {
    font-weight: normal;
    color: var(--glow);
    opacity: 0.1;
    transition: opacity 0.45s ease-out, text-shadow 0.45s ease;
}
.nyc-ap b.on { opacity: 1; text-shadow: 0 0 4px rgba(143, 247, 223, 0.9); transition-duration: 0.07s; }
.nyc-clock.is-24 .nyc-ap { visibility: hidden; }
.nyc-secs {
    display: flex;
    gap: 2px;
    transform: skewX(-6deg);
    filter: drop-shadow(0 0 2px rgba(143, 247, 223, 0.8));
}
.nyc-d.is-small { width: 9px; height: 16px; }

/* the date, typed out like a terminal */
.nyc-date {
    display: flex;
    align-items: center;
    margin-top: 5px;
    min-height: 0.7rem;
    font: 0.6rem/1 var(--mono);
    letter-spacing: 0.2em;
    color: var(--glow);
    text-shadow: 0 0 4px rgba(143, 247, 223, 0.7);
    white-space: nowrap;
}
.nyc-cursor {
    width: 5px; height: 8px;
    margin-left: 1px;
    background: var(--glow);
    box-shadow: 0 0 4px var(--glow);
    opacity: 0;
}
.is-typing .nyc-cursor { animation: nyc-cursor 0.5s steps(1) infinite; }
@keyframes nyc-cursor { 0% { opacity: 1; } 50% { opacity: 0; } }

/* switched on */
.nyc-clock.is-on .nyc-top { opacity: 0.75; }

/* warming up: a soft flicker as the display comes alive */
.nyc-clock.is-booting .nyc-screen { animation: nyc-warm 0.9s steps(1) 0.2s both; }
@keyframes nyc-warm {
    0% { filter: brightness(0.3); }
    12% { filter: brightness(1.15); }
    18% { filter: brightness(0.5); }
    26% { filter: brightness(1.2); }
    34% { filter: brightness(0.8); }
    44%, 100% { filter: none; }
}

/* a quick blink when you switch 12 / 24 hour */
.nyc-clock.is-blip .nyc-screen { animation: nyc-blip 0.35s ease-out; }
@keyframes nyc-blip { 0% { filter: brightness(1.8); } 100% { filter: none; } }

/* phones: the clock sits above my name instead of beside it */
@media (max-width: 760px) {
    header.has-clock { display: flex; flex-direction: column; }
    .nyc-clock {
        position: relative;
        top: auto;
        right: auto;
        order: -1;
        align-self: flex-start;
        margin-bottom: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nyc-clock, .nyc-clock * { animation: none !important; transition: none !important; }
}
