/*
 * Chirpr: a 2007 Web 2.0 micro-blog for two budgies.
 *
 * Tokens:  sky #bfe8fb · budgie green #5cbf2a · mango #ffd23a · cere blue #2f6fd6 (links) · ink #24323d ·
 *          cards #ffffff on #eef8fd
 * Type:    Lucida Grande / Helvetica Neue (the 2007 Mac web), one family; weight and size do the work.
 * Layout:  wordmark with reflection → the perch (full width) → teach box → feed + sidebar → facts.
 * Rule:    the perch is the one loud thing. Everything else is quiet white cards. Motion only when a budgie posts.
 * Web-safe fonts only (the CSP allows no outside fonts).
 */

:root {
    --sky: #bfe8fb;
    --sky-deep: #7fcdf2;
    --green: #5cbf2a;
    --green-deep: #3f8f17;
    --mango: #ffd23a;
    --cere: #2f6fd6;
    --ink: #24323d;
    --muted: #5f7482;
    --card: #ffffff;
    --wash: #eef8fd;
    --line: #cfe6f3;
    --ui: "Lucida Grande", "Lucida Sans Unicode", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, var(--sky) 0, var(--wash) 420px) no-repeat, var(--wash);
    color: var(--ink);
    font: 15px/1.5 var(--ui);
}

a {
    color: var(--cere);
}

a:hover {
    color: var(--green-deep);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--mango);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.topbar {
    max-width: 920px;
    margin: 0 auto;
    padding: 10px 16px 0;
}

.home {
    font-weight: bold;
    text-decoration: none;
}

.home:hover {
    text-decoration: underline;
}

/* Wordmark: glossy, with the floor reflection every 2007 logo had */
.masthead {
    max-width: 920px;
    margin: 0 auto;
    padding: 6px 16px 10px;
}

.wordmark {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    margin: 0;
    font: bold 60px/1 var(--ui);
    letter-spacing: -3px;
}

.mark {
    background: linear-gradient(180deg, #8ee35a 0, var(--green) 48%, var(--green-deep) 52%, #6fd23a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-bottom: 2px;
}

.mirror {
    transform: scaleY(-1);
    margin-top: -12px;
    height: 26px;
    overflow: hidden;
    background: linear-gradient(0deg, rgba(92, 191, 42, 0.35), rgba(92, 191, 42, 0) 70%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.1;
}

.beta {
    position: absolute;
    top: -4px;
    right: -46px;
    background: linear-gradient(180deg, #ff8fa8, #e8456a);
    border-radius: 999px;
    color: #fff;
    font: bold 12px var(--ui);
    letter-spacing: 0;
    padding: 2px 8px;
    transform: rotate(8deg);
}

.tagline {
    margin: 0;
    color: var(--muted);
    font: 16px var(--ui);
}

.page {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* ---------- The perch ---------- */
.stage {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(255, 255, 255, 0.9) 0 8%, transparent 9%),
        radial-gradient(ellipse at 75% 18%, rgba(255, 255, 255, 0.8) 0 6%, transparent 7%),
        linear-gradient(180deg, #d9f2ff, #ffffff);
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 14px;
    overflow: hidden;
}

#perch {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
}

.budgie .head,
.budgie .jaw {
    transform-box: fill-box;
}

.budgie .head {
    transform-origin: 30% 90%;
}

.budgie .jaw {
    transform-origin: 0% 0%;
}

/* A budgie posting: head bob and an open beak */
.budgie.talking .head {
    animation: bob 0.22s ease-in-out 4 alternate;
}

.budgie.talking .jaw {
    animation: chatter 0.11s linear 8 alternate;
}

@keyframes bob {
    to { transform: rotate(-14deg) translateY(3px); }
}

@keyframes chatter {
    to { transform: rotate(28deg); }
}

/* ---------- Teach box ---------- */
.teach {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 18px;
    padding: 14px 16px 10px;
}

.teach h2 {
    margin: 0 0 8px;
    font: bold 22px var(--ui);
}

.teach-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#phrase {
    flex: 1 1 220px;
    min-width: 0;
    border: 2px solid var(--line);
    border-radius: 8px;
    font: 18px var(--ui);
    padding: 8px 10px;
}

#phrase:focus {
    border-color: var(--sky-deep);
}

.who {
    display: flex;
    gap: 12px;
    border: 0;
    margin: 0;
    padding: 0;
}

.who label {
    cursor: pointer;
}

.gloss {
    border: 1px solid var(--green-deep);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0 46%, rgba(255, 255, 255, 0) 54%),
        var(--green);
    box-shadow: 0 2px 3px rgba(36, 50, 61, 0.25);
    color: #fff;
    cursor: pointer;
    font: bold 16px var(--ui);
    padding: 8px 22px;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.gloss:hover {
    filter: brightness(1.06);
}

.gloss.quiet {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0 46%, rgba(255, 255, 255, 0) 54%),
        #dfeef6;
    border-color: #9fc3d6;
    color: var(--ink);
    text-shadow: none;
    width: 100%;
}

.gloss.quiet[aria-pressed="true"] {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0 46%, rgba(255, 255, 255, 0) 54%),
        var(--mango);
    border-color: #c9a21c;
}

.teach-help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

#reps {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

#reps span {
    width: 10px;
    height: 10px;
    border: 2px solid var(--green);
    border-radius: 50%;
}

#reps span.on {
    background: var(--green);
}

.note {
    min-height: 1.5em;
    margin: 4px 0 0;
    font-size: 14px;
}

/* ---------- Feed and sidebar ---------- */
.columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 18px;
    align-items: start;
    margin-bottom: 28px;
}

.timeline,
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.timeline {
    padding: 12px 16px 4px;
}

.timeline > h2,
.card h2 {
    margin: 0 0 8px;
    font: bold 17px var(--ui);
}

.flock-status {
    background: #fff8d6;
    border-radius: 8px;
    font-size: 13px;
    margin: 0 0 8px;
    padding: 6px 10px;
}

.feed {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    column-gap: 10px;
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

.post:first-child {
    border-top: 0;
}

.post p {
    margin: 0;
    overflow-wrap: anywhere;
}

.post .when {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
}

.avatar {
    grid-row: span 2;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
}

.avatar svg {
    width: 100%;
    height: 100%;
}

.avatar-kiwi {
    background: #e3f6d6;
}

.avatar-mango {
    background: #fff4cc;
}

.avatar-mango svg {
    transform: scaleX(-1);
}

.handle {
    color: var(--muted);
    font-weight: normal;
    font-size: 13px;
}

.flock-tag {
    display: inline-block;
    background: var(--sky);
    border-radius: 6px;
    color: #135e86;
    font-size: 11px;
    margin-left: 4px;
    padding: 0 5px;
    vertical-align: 1px;
}

.post.new {
    animation: arrive 0.6s ease-out;
}

@keyframes arrive {
    from { background: #fff8d6; }
}

.sidebar {
    display: grid;
    gap: 12px;
}

.card {
    padding: 12px 14px;
}

.card p {
    margin: 0 0 4px;
    font-size: 13px;
}

.count b {
    font-size: 18px;
}

.trending {
    margin: 0;
    padding-left: 22px;
    font-size: 14px;
}

/* ---------- The rest ---------- */
.facts {
    max-width: 680px;
    margin-bottom: 26px;
}

.facts h2 {
    font: bold 20px var(--ui);
    margin: 0 0 8px;
}

.facts ul {
    margin: 0 0 10px;
    padding-left: 20px;
}

.facts li {
    margin-bottom: 6px;
}

.webring {
    max-width: 420px;
    margin: 0 auto 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    padding: 6px 10px;
    text-align: center;
}

.webring p {
    margin: 2px 0;
}

.colophon {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.colophon p {
    margin: 4px 0;
}

@media (max-width: 720px) {
    .columns {
        grid-template-columns: minmax(0, 1fr);
    }

    .wordmark {
        font-size: 46px;
    }

    .teach h2 {
        font-size: 19px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .budgie.talking .head,
    .budgie.talking .jaw,
    .post.new {
        animation: none;
    }
}
