/* island.css — the floating site nav, shared by every page.
   One dark pill at the bottom of the screen. Without JS it is a plain row
   of links. island.js adds the .is-ready class, takes over the pill's size,
   and from then on the pill stretches upward into a preview panel, shrinks
   to the avatar on the way down a page, and draws reading progress. */

.island {
    --island-bg: rgba(26, 32, 44, 0.84);
    --island-line: rgba(255, 255, 255, 0.1);
    --island-text: #fff;
    --island-muted: rgba(255, 255, 255, 0.58);
    --island-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --island-bar-h: 48px;

    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    /* Under the article lightbox (100) and the Calendly modal (1000) */
    z-index: 99;
    color: var(--island-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* The glass itself. Kept apart from .island so the glow below can spill
   past the edges while the shell clips its own contents. */
.island-shell {
    position: relative;
    border-radius: 24px;
    background: var(--island-bg);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    box-shadow:
        inset 0 0 0 1px var(--island-line),
        0 10px 40px rgba(26, 32, 44, 0.28),
        0 2px 8px rgba(26, 32, 44, 0.16);
}

/* A soft wash of the site's accent gradients behind the pill. It wakes up
   when the pointer is on the nav, so the nav answers before anything opens. */
.island::before {
    content: '';
    position: absolute;
    inset: -14px -24px;
    z-index: -1;
    border-radius: 40px;
    background:
        radial-gradient(60% 80% at 20% 60%, rgba(102, 126, 234, 0.55), transparent 70%),
        radial-gradient(50% 80% at 55% 40%, rgba(79, 195, 247, 0.4), transparent 70%),
        radial-gradient(50% 80% at 85% 60%, rgba(240, 147, 251, 0.45), transparent 70%);
    filter: blur(22px);
    opacity: 0;
    transition: opacity 0.5s var(--island-ease);
    pointer-events: none;
}

.island:hover::before,
.island.is-open::before,
.island:focus-within::before {
    opacity: 0.55;
}

/* --- Bar --- */

.island-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    height: var(--island-bar-h);
    padding: 6px;
    white-space: nowrap;
}

.island-bar > a {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    color: var(--island-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: opacity 0.3s var(--island-ease), color 0.2s;
}

.island-bar > a:focus-visible {
    outline: 2px solid #4FC3F7;
    outline-offset: 1px;
}

.island-bar sup {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--island-muted);
    font-variant-numeric: tabular-nums;
    vertical-align: 0.55em;
    margin-left: -4px;
}

.island-home {
    padding-left: 0 !important;
}

.island-avatar {
    position: relative;
    flex: none;
    width: 36px;
    height: 36px;
}

.island-avatar img {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.island-talk svg {
    flex: none;
    opacity: 0.8;
}

/* The page you are on gets a gradient dot under its label */
.island-bar > a[aria-current="page"]::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38A89D, #4FC3F7);
    box-shadow: 0 0 6px rgba(79, 195, 247, 0.9);
}

.island-home[aria-current="page"]::after {
    left: calc(50% + 18px);
}

/* Glides under whichever item the pointer is on */
.island-glide {
    position: absolute;
    top: 6px;
    left: 0;
    height: 36px;
    width: var(--glide-w, 0);
    transform: translateX(var(--glide-x, 0));
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.11);
    opacity: 0;
    transition:
        transform 0.35s var(--island-ease),
        width 0.35s var(--island-ease),
        opacity 0.2s;
    pointer-events: none;
}

.island-glide.is-on {
    opacity: 1;
}

/* --- Reading progress ring (article pages) --- */

.island-ring {
    position: absolute;
    inset: -3px;
    width: 42px;
    height: 42px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.island-ring circle {
    fill: none;
    stroke-width: 2.25;
}

.island-ring .island-ring-track {
    stroke: rgba(255, 255, 255, 0.12);
}

.island-ring .island-ring-fill {
    stroke: url(#island-ring-gradient);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.15s linear;
}

/* --- JS mode: the island owns its own size --- */

.island.is-ready .island-shell {
    width: var(--island-w);
    height: var(--island-h);
    overflow: hidden;
    transition:
        width 0.55s var(--island-ease),
        height 0.55s var(--island-ease),
        border-radius 0.55s var(--island-ease);
}

.island.is-ready .island-bar {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: max-content;
    transform: translateX(calc(-50% + var(--island-shift, 0px)));
    transition: transform 0.55s var(--island-ease);
}

.island.is-open .island-shell {
    border-radius: 26px;
}

/* Collapsed: only the avatar remains, centred in a 48px circle */
.island.is-collapsed .island-bar > a:not(.island-home),
.island.is-collapsed .island-home .island-label {
    opacity: 0;
    pointer-events: none;
}

/* --- Panels --- */

.island-panel {
    position: absolute;
    left: 50%;
    bottom: 100%;
    z-index: 2;
    width: var(--island-panel-w, 420px);
    transform: translateX(-50%) translateY(8px);
    padding: 18px 18px 8px;
    opacity: 0;
    visibility: hidden;
    white-space: normal;
    transition:
        opacity 0.25s var(--island-ease),
        transform 0.45s var(--island-ease),
        visibility 0s linear 0.25s;
}

.island-panel.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition:
        opacity 0.35s var(--island-ease) 0.08s,
        transform 0.45s var(--island-ease),
        visibility 0s;
}

.island-panel::after {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: var(--island-line);
}

.island-panel a {
    color: var(--island-text);
    text-decoration: none;
}

.island-panel a:focus-visible {
    outline: 2px solid #4FC3F7;
    outline-offset: 2px;
    border-radius: 10px;
}

.island-kicker {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--island-muted);
    margin-bottom: 12px;
}

.island-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.07);
    transition: background-color 0.2s;
}

.island-more:hover {
    background: rgba(255, 255, 255, 0.13);
}

.island-more svg {
    transition: transform 0.25s var(--island-ease);
}

.island-more:hover svg {
    transform: translateX(3px);
}

/* Built: three screenshots fanned like a hand of cards */

.island-built {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 18px;
}

.island-fan {
    position: relative;
    height: 112px;
}

.island-fan a {
    position: absolute;
    top: 14px;
    left: 50%;
    width: 128px;
    aspect-ratio: 16 / 10;
    margin-left: -64px;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12);
    transform-origin: 50% 120%;
    transition: transform 0.45s var(--island-ease), box-shadow 0.3s;
}

.island-fan a:nth-child(1) { transform: translateX(-58px) rotate(-9deg); }
.island-fan a:nth-child(2) { transform: translateY(-6px); z-index: 1; }
.island-fan a:nth-child(3) { transform: translateX(58px) rotate(9deg); }

.island-panel.is-active .island-fan a:nth-child(1) { transform: translateX(-66px) rotate(-11deg); }
.island-panel.is-active .island-fan a:nth-child(3) { transform: translateX(66px) rotate(11deg); }

.island-fan a:hover,
.island-fan a:focus-visible {
    z-index: 2;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.island-panel.is-active .island-fan a:nth-child(1):hover { transform: translateX(-66px) rotate(-6deg) translateY(-8px); }
.island-panel.is-active .island-fan a:nth-child(2):hover { transform: translateY(-14px); }
.island-panel.is-active .island-fan a:nth-child(3):hover { transform: translateX(66px) rotate(6deg) translateY(-8px); }

.island-fan img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.island-fan span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 7px 5px;
    font-size: 10.5px;
    font-weight: 600;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.island-tally {
    text-align: right;
    padding-right: 4px;
}

.island-tally strong {
    display: block;
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    font-size: 48px;
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #38A89D, #4FC3F7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.island-tally span {
    display: block;
    margin-top: 4px;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--island-muted);
}

/* Wrote: own pieces as rows, press as a line of mastheads */

.island-reads {
    display: grid;
    gap: 4px;
}

.island-read {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px;
    margin: 0 -6px;
    border-radius: 12px;
    transition: background-color 0.2s;
}

.island-read:hover {
    background: rgba(255, 255, 255, 0.07);
}

.island-read img {
    display: block;
    width: 64px;
    height: 44px;
    border-radius: 7px;
    object-fit: cover;
}

.island-read.is-text {
    grid-template-columns: 1fr;
}

.island-read strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}

.island-read small {
    display: block;
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--island-muted);
}

.island-press {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--island-line);
    font-size: 12px;
    color: var(--island-muted);
}

.island-press em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: normal;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.86);
}

/* --- Small screens --- */

@media (max-width: 380px) {
    .island-home .island-label {
        display: none;
    }

    .island-bar > a {
        padding: 0 11px;
    }
}

/* --- Reduced motion: every state change lands at once --- */

@media (prefers-reduced-motion: reduce) {
    .island,
    .island::before,
    .island.is-ready .island-shell,
    .island.is-ready .island-bar,
    .island-bar > a,
    .island-glide,
    .island-panel,
    .island-panel.is-active,
    .island-fan a,
    .island-more svg,
    .island-ring .island-ring-fill {
        transition: none;
    }

    .island-fan a:nth-child(n),
    .island-panel.is-active .island-fan a:nth-child(n),
    .island-panel.is-active .island-fan a:nth-child(n):hover {
        transform: none;
        position: static;
        margin: 0;
        width: auto;
    }

    .island-fan {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        height: auto;
    }
}
