/* ==========================================================================
   Silver Sticks Christmas Card Exchange
   Table of contents
   1. Tokens
   2. Base
   3. Layout
   4. Header, footer & credit animation
   5. Buttons
   6. Hero
   7. How it works
   8. Sign-up form
   9. Notices & thank-you page
   10. Admin
   11. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    --green: #0f8a43;
    --green-dark: #0c7a3b;
    --green-deep: #085f2d;
    --yellow: #f4cf00;
    --red: #d3202a;
    --orange: #f0782c;
    --brown: #4a2c1d;
    --brown-dark: #3a2216;
    --ink: #33201a;
    --muted: #6b5a50;
    --line: #e4ddd0;
    --paper: #ffffff;
    --paper-alt: #f8f5ee;
    --radius: 12px;
    --shadow: 0 2px 6px rgba(58, 34, 22, 0.08), 0 8px 24px rgba(58, 34, 22, 0.06);
    --shadow-hover: 0 4px 10px rgba(58, 34, 22, 0.12), 0 12px 28px rgba(58, 34, 22, 0.10);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --transition: 0.2s ease;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Sticky footer: main fills the space so the footer sits at the bottom on short pages */
main { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { color: var(--brown); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

a { color: var(--green-dark); text-underline-offset: 3px; }
a:hover { color: var(--green-deep); }

:focus-visible { outline: 3px solid var(--brown); outline-offset: 2px; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--brown);
    color: #fff;
    padding: 10px 16px;
    z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* 3. Layout ---------------------------------------------------------------- */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 680px; }

.section { padding: 64px 0; }
.section-alt { background: var(--paper-alt); }
.section-title { text-align: center; margin-bottom: 0.75em; }
.section-intro { text-align: center; color: var(--muted); max-width: 520px; margin: 0 auto 28px; }

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

/* 4. Header & footer ------------------------------------------------------- */
.brand-stripe { display: flex; height: 6px; }
.brand-stripe span { flex: 1; }
.brand-stripe span:nth-child(1) { background: var(--green); }
.brand-stripe span:nth-child(2) { background: var(--yellow); }
.brand-stripe span:nth-child(3) { background: var(--red); }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.site-title {
    color: var(--brown);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
}
.site-title:hover { color: var(--green-deep); }
.header-link {
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    color: var(--green-dark);
    white-space: nowrap;
    transition: color var(--transition);
}
.header-link:hover { color: var(--green-deep); text-decoration: underline; }

.site-footer {
    background: var(--brown-dark);
    color: #efe6d9;
    padding: 28px 0;
    font-size: 0.92rem;
}
.site-footer p { margin: 0; }
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px 24px;
    flex-wrap: wrap;
}
.site-footer a { color: var(--yellow); }
.site-footer a:hover { color: #fff; }

/* Credit animation: three little birds perch above the credit on hover/focus */
:root { --spring: cubic-bezier(0.34, 1.56, 0.64, 1); }

.footer-credit { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }

.credit-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    text-decoration: none;
}
.credit-link:hover .credit-name { text-decoration: underline; }

.credit-logo {
    height: 30px;
    width: auto;
    padding: 3px;
    background: #fff;
    border-radius: 8px;
    transition: transform 0.4s var(--spring);
}
.credit-link:hover .credit-logo,
.credit-link:focus-visible .credit-logo { transform: rotate(-6deg) scale(1.08); }

.credit-birds {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 2px);
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    pointer-events: none;
}

.bird {
    display: block;
    width: 28px;
    height: 25px;
    opacity: 0;
    transform: translateY(16px) scale(0.4);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.bird svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bird-3 svg { transform: scaleX(-1); }

.bird-1 { --delay: 0s; }
.bird-2 { --delay: 0.12s; }
.bird-3 { --delay: 0.24s; }

.bird-body { fill: var(--bird-color); stroke: #fbf3e6; stroke-width: 1; stroke-linejoin: round; paint-order: stroke; }
.bird-wing { fill: var(--bird-wing); transform-box: fill-box; transform-origin: 100% 60%; }
.bird-beak { fill: var(--orange); }
.bird-eye  { fill: #2b1a10; }
.bird-legs { stroke: var(--orange); stroke-width: 1.6; stroke-linecap: round; fill: none; }
.bird-red    { --bird-color: #e0303a; --bird-wing: #a8171f; }
.bird-yellow { --bird-color: #f4cf00; --bird-wing: #c29f00; }
.bird-green  { --bird-color: #1aa352; --bird-wing: #0b6a33; }

.footer-credit:hover .bird,
.footer-credit:focus-within .bird,
.footer-credit.birds-play .bird {
    opacity: 1;
    transform: none;
    transition: opacity 0.2s ease var(--delay), transform 0.55s var(--spring) var(--delay);
}

.footer-credit:hover .bird-inner,
.footer-credit:focus-within .bird-inner,
.footer-credit.birds-play .bird-inner {
    animation: bird-hop 1.5s ease-in-out calc(var(--delay) + 0.9s) infinite;
}
.footer-credit:hover .bird-wing,
.footer-credit:focus-within .bird-wing,
.footer-credit.birds-play .bird-wing {
    animation: bird-flap 0.22s ease-in-out calc(var(--delay) + 0.05s) 4;
}
.bird-inner { display: block; width: 100%; height: 100%; }

@keyframes bird-hop {
    0%, 60%, 100% { transform: translateY(0) rotate(0); }
    70%           { transform: translateY(-4px) rotate(-4deg); }
    80%           { transform: translateY(0) rotate(3deg); }
}
@keyframes bird-flap {
    0%, 100% { transform: rotate(0); }
    50%      { transform: rotate(32deg); }
}

/* 5. Buttons --------------------------------------------------------------- */
.btn {
    display: inline-block;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 14px 28px;
    border-radius: 999px;
    border: 2px solid transparent;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn-primary { background: var(--green-dark); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--green-deep); color: #fff; box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--green-dark); border-color: var(--green-dark); }
.btn-outline:hover { background: var(--green-dark); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: 0.7; cursor: wait; transform: none; }

/* 6. Hero ------------------------------------------------------------------ */
.hero { background: #fff; text-align: center; padding: 40px 0 64px; }
.hero-image { width: 100%; max-width: 760px; margin: 0 auto 24px; }
.hero h1 { margin-bottom: 0.35em; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; margin: 0 auto 1.5em; }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.deadline-note { margin: 22px 0 0; color: var(--brown); }

/* 7. How it works ---------------------------------------------------------- */
.steps {
    list-style: none;
    margin: 36px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.step {
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 5px solid var(--green);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.step:nth-child(2) { border-top-color: var(--yellow); }
.step:nth-child(3) { border-top-color: var(--red); }
.step p { margin: 0; color: var(--muted); }

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--green-dark);
    color: #fff;
    font-weight: 700;
    margin-bottom: 14px;
}
.step:nth-child(2) .step-number { background: var(--yellow); color: var(--brown); }
.step:nth-child(3) .step-number { background: var(--red); }

/* 8. Sign-up form ---------------------------------------------------------- */
.signup-form { padding: 36px; }

.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--brown); }
.req { color: var(--red); }
.optional { font-weight: 400; color: var(--muted); font-size: 0.9em; }

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"] {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    padding: 12px 14px;
    background: #fff;
    border: 1.5px solid #cfc6b6;
    border-radius: 8px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 138, 67, 0.22); }
.field input[aria-invalid="true"] { border-color: var(--red); }

.field-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.field-help { margin: 6px 0 0; font-size: 0.88rem; color: var(--muted); }
.field-error { margin: 6px 0 0; font-size: 0.9rem; font-weight: 600; color: var(--red); }

.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.privacy-note,
.household-note {
    background: #fffbe6;
    border-left: 4px solid var(--yellow);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.92rem;
    color: var(--ink);
    margin: 4px 0 20px;
}
.household-note { margin: 0 0 24px; font-size: 0.97rem; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--green-dark); flex-shrink: 0; }

/* 9. Notices & thank-you page --------------------------------------------- */
.notice-closed { text-align: center; border-top: 5px solid var(--yellow); }
.notice-closed p { margin: 0; color: var(--muted); }

.error-summary { border-left: 5px solid var(--red); background: #fdecee; margin-bottom: 20px; padding: 20px 24px; }
.error-summary h3 { margin-bottom: 8px; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary:focus { outline: none; }

.thanks { padding: 72px 0; }
.thanks-card { text-align: center; border-top: 5px solid var(--green); padding: 48px 32px; }
.thanks-card .lead { margin-bottom: 1em; }
.thanks-card .hero-actions { margin-top: 28px; }

/* 10. Admin ---------------------------------------------------------------- */
.admin-body { background: var(--paper-alt); }
.admin-wrap { max-width: 1280px; margin: 0 auto; padding: 28px 20px 60px; }
.admin-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-bar h1 { font-size: 1.6rem; margin: 0; }
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-nav .btn { padding: 9px 18px; font-size: 0.92rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b01a23; color: #fff; }
.btn-small { padding: 6px 12px !important; font-size: 0.82rem !important; }

.admin-login { max-width: 420px; margin: 80px auto; }
.admin-card { margin-bottom: 24px; padding: 24px; }
.admin-card h2 { font-size: 1.25rem; }
.admin-stats { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--green-dark); line-height: 1; }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.status-pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; }
.status-open { background: #dff3e6; color: var(--green-deep); }
.status-closed { background: #fbdcdf; color: #9d1820; }

.admin-flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 600; }
.admin-flash.ok { background: #dff3e6; color: var(--green-deep); }
.admin-flash.bad { background: #fbdcdf; color: #9d1820; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.admin-form .field { margin-bottom: 14px; }
.admin-form .check { font-weight: 600; }

.search-form { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-form input[type="text"] { flex: 1; min-width: 200px; padding: 10px 14px; border: 1.5px solid #cfc6b6; border-radius: 8px; font: inherit; }

.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.data-table th { background: var(--paper-alt); color: var(--brown); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fcfaf5; }
.data-table .nowrap { white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0; align-items: flex-start; }
.row-actions form { margin: 0; }
.row-actions .btn { margin: 0 10px 10px 0; }
.admin-edit { max-width: 720px; margin: 0 auto; }
.admin-edit .btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.missing { color: var(--red); font-weight: 600; font-size: 0.88rem; }
.status-wait { background: #fff1c2; color: #7a5b00; }
.warn-box { background: #fffbe6; border-left: 4px solid var(--yellow); border-radius: 8px; padding: 12px 16px; margin-top: 14px; font-size: 0.95rem; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.assign-list { margin: 0; padding-left: 1.25em; }
.assign-list li { margin: 0 0 2px; }
.assign-form .field { max-width: 260px; }
.field-row-2 { grid-template-columns: 3fr 1fr; }
.field select {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    padding: 12px 14px;
    background: #fff;
    border: 1.5px solid #cfc6b6;
    border-radius: 8px;
}
.field select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 138, 67, 0.22); }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }

/* 11. Responsive ----------------------------------------------------------- */
@media (max-width: 760px) {
    .section { padding: 48px 0; }
    .hero { padding: 28px 0 48px; }
    .steps { grid-template-columns: 1fr; }
    .signup-form { padding: 24px 20px; }
    .field-row { grid-template-columns: 1fr 1fr; }
    .field-city { grid-column: 1 / -1; }
    .header-inner { flex-direction: column; align-items: flex-start; gap: 4px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .credit-birds { left: 100%; bottom: 2px; transform: none; margin-left: 12px; }
    .hero-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
    .bird-inner, .bird-wing { animation: none !important; }
}
