/* ============================================================
   app.css — SHARED structural styles (layout/components) for the pet
   platform (myturtle/myrabbit/mybird). All colour/font/radius/shadow
   tokens come from the per-site theme.css (--brand-*, --accent-*, --ink,
   --paper, …), so this file is brand-agnostic — re-skin via theme.css.
   ============================================================ */



*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


/* ── Impersonation banner ───────────────────────────────── */
.imp-banner {
    background: var(--warn); color: #fff; text-align: center;
    font-size: .85rem; font-weight: 600; padding: .5rem 1rem; line-height: 1.4;
}
.imp-banner strong { font-weight: 700; }
.imp-banner a {
    color: #fff; text-decoration: underline; margin-left: .5rem; white-space: nowrap;
    font-weight: 700;
}

/* ── Topbar ─────────────────────────────────────────────── */
.tbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1.6rem;
    background: rgba(251,244,228,.82);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.tbar-brand {
    display: inline-flex; align-items: center; gap: .55rem;
    font-family: var(--display); font-weight: 600; font-size: 1.3rem;
    color: var(--brand-deep); text-decoration: none; letter-spacing: -.01em;
}
.tbar-brand .dot { color: var(--accent); }
.tbar-brand svg { width: 30px; height: 30px; }
.tbar-nav { display: flex; align-items: center; gap: .25rem; margin: 0 auto 0 1.4rem; }
.tbar-link {
    font-weight: 600; font-size: .9rem; color: var(--ink-soft); text-decoration: none; white-space: nowrap;
    padding: .42rem .85rem; border-radius: 2rem; transition: background .15s, color .15s;
}
.tbar-link:hover { color: var(--brand-deep); background: var(--brand-wash); }
.tbar-link.active { color: var(--brand-deep); background: var(--brand-wash); box-shadow: inset 0 0 0 1.5px var(--brand-lighter); }
.tbar-right { display: flex; align-items: center; gap: 1rem; font-size: .85rem; }

/* ── Notifications bell ─────────────────────────────────── */
.ntf { position: relative; }
.ntf-bell { position: relative; display: flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: none; background: none; color: var(--ink-soft); cursor: pointer; transition: background .15s, color .15s; }
.ntf-bell svg { width: 19px; height: 19px; }
.ntf-bell:hover { background: var(--brand-wash); color: var(--brand-deep); }
.ntf-badge { position: absolute; top: -1px; right: -2px; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: .6rem; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.05rem; text-align: center; }
.ntf-dropdown { position: absolute; top: calc(100% + .5rem); right: 0; width: 320px; max-height: 26rem; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); z-index: 60; animation: pop .18s ease both; }
.ntf-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem .9rem; border-bottom: 1px solid var(--line); font-family: var(--display); color: var(--brand-deep); }
.ntf-readall { font-family: var(--body); font-size: .74rem; font-weight: 600; color: var(--brand); background: none; border: none; cursor: pointer; }
.ntf-readall:hover { text-decoration: underline; }
.ntf-empty { padding: 1.4rem; text-align: center; color: var(--ink-faint); font-size: .85rem; }
.ntf-item { display: block; padding: .7rem .9rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ntf-item:last-child { border-bottom: none; }
.ntf-item:hover { background: var(--paper); }
.ntf-item.unread { background: var(--brand-wash); }
.ntf-item.unread:hover { background: #d2ecdb; }
.ntf-title { font-weight: 600; font-size: .85rem; color: var(--brand-deep); }
.ntf-body { font-size: .8rem; color: var(--ink-soft); margin-top: .15rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ntf-age { font-size: .7rem; color: var(--ink-faint); margin-top: .2rem; }
.tbar-user { color: var(--ink-soft); font-weight: 600; }
.tbar-user a { color: var(--ink-faint); text-decoration: none; font-weight: 500; margin-left: .5rem; }
.tbar-user a:hover { color: var(--danger); }

/* ── Layout shell ───────────────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }

/* ── Buttons ────────────────────────────────────────────── */
.btn-shell, .btn-quiet {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--body); font-weight: 600; font-size: .95rem;
    border: none; cursor: pointer; border-radius: 2rem;
    padding: .8rem 1.6rem; transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.btn-shell {
    color: #fff;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 55%, var(--brand-light) 130%);
    box-shadow: 0 4px 14px rgba(45,106,79,.32);
}
.btn-shell:hover { transform: translateY(-2px); box-shadow: 0 7px 22px rgba(45,106,79,.4); }
.btn-shell:active { transform: translateY(0); }
.btn-shell .plus { font-size: 1.15rem; line-height: 1; margin-top: -2px; }
.btn-quiet {
    background: var(--card); color: var(--brand-deep); border: 1.5px solid var(--line);
}
.btn-quiet:hover { border-color: var(--brand-light); background: var(--brand-wash); }

/* ── Turtle mascot (shared by empty-state + loader) ─────── */
.turtle { display: block; }
.turtle-bob { animation: bob 4.5s ease-in-out infinite; transform-origin: center; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-9px) rotate(1deg); } }
.turtle .leg { animation: paddle 3s ease-in-out infinite; transform-origin: center; }
.turtle .leg.l2 { animation-delay: .4s; } .turtle .leg.l3 { animation-delay: .8s; } .turtle .leg.l4 { animation-delay: 1.2s; }
@keyframes paddle { 0%,100% { transform: rotate(0); } 50% { transform: rotate(6deg); } }

/* ── Loading ────────────────────────────────────────────── */
.dash-loading { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 5rem 0; color: var(--ink-faint); }
.dash-loading p { font-style: italic; }

/* ── Empty state ────────────────────────────────────────── */
.empty { text-align: center; padding: 2rem 0; animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.empty-hero {
    position: relative; width: 220px; height: 200px; margin: 0 auto 1.5rem;
    display: flex; align-items: center; justify-content: center;
}
.empty-hero::before { /* hexagonal shell halo */
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(232,176,106,.35), transparent 65%);
}
.empty h2 { font-family: var(--display); font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--brand-deep); font-weight: 600; letter-spacing: -.02em; }
.empty .lede { color: var(--ink-soft); font-size: 1.05rem; max-width: 30rem; margin: .6rem auto 1.8rem; }
.empty .cta-row { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.empty .or { color: var(--ink-faint); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; margin: 1.8rem 0 .9rem; }

/* ── Roster ─────────────────────────────────────────────── */
.roster { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.roster-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.roster-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.5rem, 3.2vw, 2.1rem); color: var(--brand-deep); letter-spacing: -.02em; }
.roster-head h2 .num { color: var(--accent); }
.eyebrow { display: block; font-family: var(--body); font-weight: 700; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--brand-light); margin-bottom: .2rem; }

.turtle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.3rem; }

.tcard {
    position: relative; display: block; text-decoration: none; color: inherit; cursor: pointer;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
    animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.tcard:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--brand-lighter); }
.tcard-photo { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(150deg, var(--brand-wash), var(--accent-soft)); overflow: hidden; }
.tcard-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard-photo .noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: .5; color: var(--brand-mid); }
.tcard-photo .noimg svg { width: 64px; height: 64px; }
.tcard-badge {
    position: absolute; top: .6rem; left: .6rem; z-index: 2;
    font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    padding: .22rem .6rem; border-radius: 1rem; backdrop-filter: blur(4px);
    background: rgba(255,253,247,.85); color: var(--accent-deep); border: 1px solid rgba(156,107,59,.3);
}
.tcard-badge.tortoise { color: var(--brand-deep); border-color: rgba(45,106,79,.3); }
.tcard-body { padding: .9rem 1rem 1.05rem; }
.tcard-name { font-family: var(--display); font-size: 1.25rem; font-weight: 600; color: var(--ink); line-height: 1.15; letter-spacing: -.01em; }
.tcard-sub { font-size: .8rem; color: var(--ink-faint); font-style: italic; margin-top: .1rem; min-height: 1.1em; }
.tcard-meta { display: flex; flex-wrap: wrap; gap: .35rem .8rem; margin-top: .7rem; font-size: .8rem; color: var(--ink-soft); }
.tcard-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.tcard-meta .ic { opacity: .7; }
.tcard.gone { opacity: .62; }
.tcard.gone .tcard-photo { filter: grayscale(.5); }

/* Add-a-turtle ghost card */
.tcard-add {
    border: 2px dashed var(--line); background: transparent; box-shadow: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .5rem; min-height: 180px; color: var(--brand); cursor: pointer; font-weight: 600;
}
.tcard-add:hover { border-color: var(--brand-light); background: var(--brand-wash); transform: translateY(-5px); box-shadow: none; }
.tcard-add .ring { width: 46px; height: 46px; border-radius: 50%; background: var(--brand-wash); display: grid; place-items: center; font-size: 1.5rem; color: var(--brand); }

/* ── Photos / droparea ──────────────────────────────────── */
.photos { margin-top: 3rem; }
.photos h3 { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--brand-deep); margin-bottom: .9rem; }
.droparea {
    border: 2px dashed var(--accent-soft); border-radius: var(--r-md);
    background: linear-gradient(var(--paper-2), var(--card));
    padding: 1.8rem 1.25rem; text-align: center; cursor: pointer;
    color: var(--ink-soft); transition: border-color .15s, background .15s, transform .12s;
}
.droparea:hover { border-color: var(--accent); }
.droparea.drag { border-color: var(--brand); background: var(--brand-wash); transform: scale(1.01); }
.droparea .di-title { font-weight: 600; color: var(--brand-deep); }
.droparea .di-sub { font-size: .82rem; color: var(--ink-faint); margin-top: .2rem; }
.droparea.busy { opacity: .7; pointer-events: none; }
.empty .droparea { max-width: 30rem; margin: 0 auto; }
.empty .photo-strip { max-width: 30rem; margin: 1rem auto 0; }

.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; margin-top: 1rem; }
.photo-strip .ph {
    aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--brand-wash);
    border: 1px solid var(--line); animation: rise .5s ease both;
}
.photo-strip .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    padding: 1.25rem; background: rgba(20,52,42,.5); backdrop-filter: blur(4px); animation: fade .25s ease both;
}
.modal {
    width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto;
    background: var(--card); border-radius: var(--r-lg); padding: 1.9rem 1.8rem 2rem;
    box-shadow: var(--shadow-lg); border: 1px solid var(--line);
    position: relative; animation: pop .3s cubic-bezier(.2,.8,.2,1) both;
}
.modal::before { /* decorative top accent bar */
    content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: linear-gradient(90deg, var(--brand), var(--brand-light), var(--accent));
}
.modal h3 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; color: var(--brand-deep); margin-bottom: 1.2rem; }
.modal-close { position: absolute; top: 1rem; right: 1.1rem; background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--ink-faint); cursor: pointer; }
.modal-close:hover { color: var(--ink); }
.field { margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; }
input, select, textarea {
    width: 100%; padding: .65rem .8rem; border: 1.5px solid var(--line); border-radius: var(--r-sm);
    font-family: var(--body); font-size: .92rem; color: var(--ink); background: var(--paper);
    transition: border-color .12s, background .12s;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-light); background: #fff; }
.modal .err { display: none; color: var(--danger); font-size: .8rem; margin-bottom: .8rem; }
.modal .actions { display: flex; gap: .7rem; margin-top: 1.3rem; }
.modal .actions .btn-shell { flex: 1; justify-content: center; }

/* species segmented control */
.seg { display: flex; gap: .4rem; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .opt {
    display: block; text-align: center; padding: .55rem; border: 1.5px solid var(--line);
    border-radius: var(--r-sm); cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--ink-soft);
    transition: all .14s; background: var(--paper);
}
.seg input:checked + .opt { border-color: var(--brand); background: var(--brand-wash); color: var(--brand-deep); }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
    position: fixed; left: 50%; bottom: 1.8rem; transform: translateX(-50%) translateY(1.5rem);
    background: var(--brand-deep); color: var(--brand-wash); padding: .75rem 1.3rem; border-radius: 2rem;
    font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-md); z-index: 200;
    opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--danger); color: #fff; }

/* ── keyframes / utils ──────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop  { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
[hidden] { display: none !important; }

/* ── Footer (GDPR / privacy) ────────────────────────────── */
.tfoot { border-top: 1px solid var(--line); background: rgba(244,234,210,.5); margin-top: 2rem; }
.tfoot-inner { max-width: 1080px; margin: 0 auto; padding: 1.6rem 1.5rem 2rem; }
.tfoot-meta { font-size: .8rem; color: var(--ink-faint); }
.tfoot a { color: var(--brand); text-decoration: none; font-weight: 600; }
.tfoot a:hover { text-decoration: underline; }

/* Topbar: below ~920px the brand + (six) nav links + bell + user no longer fit on
   one row, so the nav drops to its own full-width row (horizontally scrollable if
   still tight). Prevents page-wide horizontal scroll on tablets and phones. */
@media (max-width: 920px) {
    .tbar { flex-wrap: wrap; padding: .7rem 1rem; gap: .4rem .6rem; }
    .tbar-brand { font-size: 1.15rem; }
    .tbar-nav {
        order: 3; flex-basis: 100%; margin: .15rem 0 0; justify-content: flex-start;
        overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .tbar-nav::-webkit-scrollbar { display: none; }
    .tbar-link { white-space: nowrap; padding: .4rem .7rem; }
    .tbar-right { font-size: .82rem; gap: .6rem; }
}

@media (max-width: 560px) {
    .wrap { padding: 1.5rem 1rem 4rem; }
    .turtle-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
    .roster-head { align-items: flex-start; }
    .field-row { grid-template-columns: 1fr; }
    /* Long words/URLs (captions, emails) must never push the viewport wider. */
    .legal, .pp-notes, .tl-note, .lb-side h3 { overflow-wrap: anywhere; word-break: break-word; }
}
@media (prefers-reduced-motion: reduce) {
    .turtle-bob, .turtle .leg { animation: none; }
    .empty, .roster, .tcard, .photo-strip .ph, .modal, .modal-backdrop { animation: none; }
}

/* ── Sister-site links (topbar aside + footer) ── */
.tbar-sisters { display: flex; gap: .3rem; align-items: center; margin-right: .5rem; }
.tbar-sister { font-size: 1.15rem; line-height: 1; text-decoration: none; opacity: .55; transition: opacity .15s, transform .15s; }
.tbar-sister:hover { opacity: 1; transform: translateY(-1px); }
.tfoot-sisters { font-size: .78rem; color: var(--ink-faint); margin-top: .45rem; }
.tfoot-sisters a { color: var(--brand); text-decoration: none; }
.tfoot-sisters a:hover { text-decoration: underline; }
