/* Nora's Delights — shared design system.
   Direction: a supper-club menu. Deep ink surfaces, warm off-white text,
   one brass accent shared with the rating stars, Fraunces for display type.
   Token names are kept from the old sheet so the calendar's page-specific
   rules keep resolving; only the values changed. */

:root {
    --bg-dark: #0b0b0c;
    --bg-sidebar: #0d0d0f;
    --bg-card: #121213;
    --bg-input: #1a1a1c;
    --accent: #d9a94e;          /* brass — links, highlights, stars */
    --accent-strong: #c89540;   /* brass, one step deeper — solid buttons */
    --accent-ink: #141210;      /* text on a brass surface */
    --accent-success: #8fc9a2;
    --accent-danger: #e07a6e;
    --star: #d9a94e;
    --text: #edebe5;
    --text-muted: #9c998f;
    --text-dim: #67655c;
    --border: #242422;
    --border-soft: #1a1a19;
    --font-display: 'Fraunces', Georgia, serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

/* The hidden attribute must always win, even over display:flex/grid classes —
   without this, the restaurant edit form (hidden + .add-form) rendered open. */
[hidden] { display: none !important; }

body {
    font-family: var(--font-ui);
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 40px 24px 80px; }
.wrap.narrow { max-width: 560px; }

/* ------------------------------------------------------------ headings --- */
/* An eyebrow in tracked small caps above a Fraunces title: the menu-header
   device every page opens with. */

.eyebrow {
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

h1 {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 500;
    letter-spacing: -.01em;
    line-height: 1.15;
    margin-bottom: 6px;
}

h2 {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.sub { color: var(--text-muted); font-size: .875rem; margin-bottom: 28px; }
.sub a { color: var(--text-muted); }
.sub a:hover { color: var(--text); }

.page-head { margin-bottom: 30px; }
.page-head .sub { margin-bottom: 0; }

/* Stat strip under a page title: quiet figures, hairline separators. */
.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 22px 0 30px;
}
.stat-strip .stat {
    padding: 14px 28px 14px 0;
    margin-right: 28px;
    border-right: 1px solid var(--border-soft);
}
.stat-strip .stat:last-child { border-right: none; margin-right: 0; }
.stat-strip .k {
    display: block;
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 3px;
}
.stat-strip .v {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.stat-strip .v small { font-size: .78rem; color: var(--text-dim); font-family: var(--font-ui); }

/* -------------------------------------------------------------- pieces --- */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 18px;
}

.avatar {
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    background: var(--bg-input);
    border: 1px solid var(--border);
}
.avatar-fallback {
    text-align: center;
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: .85rem;
}

.btn {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: .84rem;
    font-weight: 500;
    cursor: pointer;
    transition: color .12s, border-color .12s, background .12s;
}
.btn:hover { color: var(--text); border-color: var(--text-dim); }
.btn-primary {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: var(--accent-ink);
    font-weight: 600;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-sm { padding: 4px 10px; font-size: .76rem; }
.btn-danger { color: var(--accent-danger); }
.btn-danger:hover { color: var(--accent-danger); border-color: rgba(224, 122, 110, .5); }
.btn.on { border-color: var(--accent); color: var(--accent); background: rgba(217, 169, 78, .07); }

input[type=text], input[type=url], input[type=search], textarea, select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: .875rem;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-strong); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin: 16px 0 7px; font-weight: 600; }

button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 1px;
}

.flash {
    padding: 11px 15px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: .86rem;
    border: 1px solid;
}
.flash-ok { background: rgba(143, 201, 162, .07); border-color: rgba(143, 201, 162, .3); color: var(--accent-success); }
.flash-err { background: rgba(224, 122, 110, .07); border-color: rgba(224, 122, 110, .3); color: var(--accent-danger); }

/* Toasts: fixed top-centre, used for every success and error message —
   server flashes (via flash_html) and script results (via ndToast) alike. */
.toast {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1400;
    max-width: min(92vw, 480px);
    padding: 10px 20px;
    border-radius: 9px;
    font-size: .85rem;
    font-weight: 500;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    animation: toastInOut 3.2s forwards;
    pointer-events: none;   /* the faded-out element must never catch clicks */
}
.toast-ok, .toast-success { border-color: rgba(143, 201, 162, .4); color: var(--accent-success); }
.toast-err, .toast-error { border-color: rgba(224, 122, 110, .4); color: var(--accent-danger); }

@keyframes toastInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    8% { opacity: 1; transform: translateX(-50%) translateY(0); }
    82% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}

/* ------------------------------------------------------------- ratings --- */
/* Stars are self-contained SVGs (see layout.php) — the CSS here only
   arranges them. Nothing visual depends on this sheet loading. */

.stars { vertical-align: middle; }

.rate-form { display: inline-flex; align-items: center; gap: 8px; }
.rate { display: inline-flex; align-items: center; }
.rate-h {
    display: block;
    background: none;
    border: 0;
    padding: 2px 0;
    margin: 0;
    cursor: pointer;
    line-height: 0;
}
.rate-h:nth-child(even) { margin-right: 3px; }
.rate-h:last-child { margin-right: 0; }
.rate-mine { font-size: .76rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rate-clear {
    background: none;
    border: 0;
    color: var(--text-dim);
    cursor: pointer;
    font-size: .95rem;
    line-height: 1;
    padding: 0 2px;
}
.rate-clear:hover { color: var(--accent-danger); }

.avg-big {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 500;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.avg-big small { font-size: .85rem; color: var(--text-dim); font-family: var(--font-ui); font-weight: 400; }

/* Letterboxd-style rating histogram: ten bins, half star each. */
.histo { display: flex; align-items: flex-end; gap: 3px; height: 56px; margin: 14px 0 4px; }
.histo .bin {
    flex: 1;
    min-height: 3px;
    background: var(--bg-input);
    border-radius: 2px 2px 0 0;
}
.histo .bin.hot { background: var(--accent-strong); }
.histo-axis { display: flex; justify-content: space-between; font-size: .66rem; color: var(--text-dim); }

/* -------------------------------------------------------------- tables --- */

table.data { width: 100%; border-collapse: collapse; font-size: .865rem; }
table.data th {
    text-align: left;
    font-weight: 600;
    color: var(--text-dim);
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(217, 169, 78, .03); }
table.data td a { color: var(--text); font-weight: 500; }
table.data td a:hover { color: var(--accent); text-decoration: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.muted { color: var(--text-muted); }
.table-scroll { overflow-x: auto; padding: 6px 4px; }

/* Row actions appear on hover so the table stays quiet. */
.row-tools { opacity: 0; transition: opacity .12s; }
tr:hover .row-tools, .row-tools:focus-within { opacity: 1; }

/* ------------------------------------------------------------ comments --- */

.comment { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.comment:last-child { border-bottom: none; padding-bottom: 2px; }
.comment .body { flex: 1; min-width: 0; }
.comment .meta { font-size: .74rem; color: var(--text-dim); margin-bottom: 3px; }
.comment .meta a { color: var(--text-muted); font-weight: 500; }
.comment .text { font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.empty { color: var(--text-dim); font-size: .85rem; padding: 8px 0; }

/* ---------------------------------------------------------------- nav ---- */

.nav {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 0 22px;
    height: 56px;
    flex: 0 0 56px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-soft);
}
.nav-brand {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    color: var(--text);
    font-size: 1.05rem;
    letter-spacing: .01em;
    white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; gap: 2px; height: 100%; }
.nav-links a {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: .84rem;
    font-weight: 500;
    padding: 0 13px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.on { color: var(--text); border-bottom-color: var(--accent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nav-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: .84rem;
    font-weight: 500;
}
.nav-me:hover { text-decoration: none; color: var(--accent); }
.nav-out { color: var(--text-dim); font-size: .76rem; }
.nav-out:hover { color: var(--text-muted); text-decoration: none; }

@media (max-width: 620px) {
    .nav { gap: 12px; padding: 0 14px; }
    .nav-brand { display: none; }
    .nav-me span { display: none; }
    .wrap { padding: 28px 16px 60px; }
    .stat-strip .stat { padding-right: 18px; margin-right: 18px; }
}

/* -------------------------------------------------------------- people --- */

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 14px;
}
.person {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    transition: border-color .12s, transform .12s;
}
.person:hover { border-color: var(--border); transform: translateY(-1px); }
.person > a {
    display: block;
    text-align: center;
    padding: 26px 14px 20px;
    color: var(--text);
}
.person > a:hover { text-decoration: none; }
.person .avatar { width: 68px; height: 68px; font-size: 1.5rem; line-height: 66px; }
.person-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    margin-top: 12px;
}
.person-stat { font-size: .76rem; color: var(--text-muted); margin-top: 3px; }
.person-fav {
    font-size: .74rem;
    color: var(--text-dim);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}
.person-fav b { color: var(--text-muted); font-weight: 500; }
.person-remove { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .12s; }
.person:hover .person-remove, .person-remove:focus-within { opacity: 1; }
.person-remove .btn { padding: 1px 8px; line-height: 1.4; border-color: transparent; }

/* ------------------------------------------------------------- profile --- */

.profile-head { display: flex; align-items: center; gap: 26px; margin-bottom: 6px; }

.pic { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.pic .avatar { width: 104px; height: 104px; font-size: 2.2rem; }
.pic.editable { cursor: pointer; }
.pic-hint {
    position: absolute;
    inset: auto 0 0 0;
    background: rgba(0, 0, 0, .66);
    color: #fff;
    font-size: .66rem;
    text-align: center;
    padding: 5px 0;
    border-radius: 0 0 52px 52px;
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}
.pic.editable:hover .pic-hint { opacity: 1; }
.pic.drop { outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 50%; }
.pic.busy { opacity: .55; }

.pic-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.pic-status { font-size: .76rem; color: var(--text-muted); }
.pic-status.bad { color: var(--accent-danger); }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .profile-grid { grid-template-columns: 1fr; } }

.friends { display: flex; flex-wrap: wrap; gap: 12px; }

/* -------------------------------------------------------------- orders --- */

.order-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.order-row:last-child { border-bottom: none; }
.order-who { color: var(--text); font-size: .82rem; font-weight: 500; min-width: 58px; }
.order-item { color: var(--text-muted); font-size: .85rem; overflow-wrap: anywhere; }
.order-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.order-form input[type=text] { flex: 1; }
.order-hint { font-size: .72rem; color: var(--text-dim); margin-top: 7px; }

/* --------------------------------------------------------- add / filter --- */

.add-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.add-form input[type=text] { flex: 1; min-width: 160px; }
.add-form .emoji-input { flex: 0 0 84px; min-width: 0; text-align: center; }

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.toolbar .search { flex: 1 1 200px; max-width: 280px; }
.toolbar .group { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.toolbar .group-label {
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-right: 3px;
}
.toolbar .push { margin-left: auto; }

/* ---------------------------------------------------------- restaurant --- */

.title-row { display: flex; align-items: baseline; gap: 14px; }
.title-row .btn { flex-shrink: 0; }

.res-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .res-grid { grid-template-columns: 1fr; } }

/* Average on the left, spread on the right, sharing a baseline. */
.rating-split { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 34px; align-items: end; }
@media (max-width: 480px) { .rating-split { grid-template-columns: 1fr; gap: 12px; } }

.raters { margin-top: 18px; border-top: 1px solid var(--border-soft); }
.rater-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}
.rater-row:last-child { border-bottom: none; padding-bottom: 2px; }
.rater-row .who { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rater-row .who a { color: var(--text); font-weight: 500; font-size: .86rem; }
.rater-row .when { color: var(--text-dim); font-size: .74rem; margin-left: 8px; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin-bottom: 0; }

/* -------------------------------------------------------------- photos --- */

.photo-add { cursor: pointer; }
.photo-add input[type=file] { display: none; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.ph {
    position: relative;
    aspect-ratio: 1;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    background: var(--bg-input);
}
.ph > a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s ease; }
.ph:hover img { transform: scale(1.05); }
.ph .ph-del { position: absolute; top: 5px; right: 5px; opacity: 0; transition: opacity .12s; }
.ph:hover .ph-del, .ph .ph-del:focus-within { opacity: 1; }
.ph .ph-del .btn { padding: 0 7px; line-height: 1.5; background: rgba(0, 0, 0, .55); border-color: transparent; }

.lb {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(8, 8, 9, .92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
}
.lb[hidden] { display: none; }
.lb img {
    max-width: min(94vw, 1100px);
    max-height: 76vh;
    border-radius: 10px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.lb-meta { color: var(--text-muted); font-size: .82rem; }
.lb-x, .lb-nav {
    position: fixed;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}
.lb-x:hover, .lb-nav:hover { color: var(--text); border-color: var(--text-dim); }
.lb-x { top: 18px; right: 18px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 620px) {
    .lb-prev { left: 6px; }
    .lb-next { right: 6px; }
}

/* --------------------------------------------------------------- login --- */

.login-hero { text-align: center; margin: 48px 0 34px; }
.login-hero .eyebrow { margin-bottom: 14px; }
.login-hero h1 { font-size: 2.6rem; font-style: italic; }

.login-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.login-person {
    display: block;
    width: 108px;
    padding: 18px 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    color: var(--text);
    font: inherit;
    font-size: .84rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: border-color .12s, transform .12s;
}
.login-person:hover { border-color: var(--accent-strong); transform: translateY(-2px); }
.login-person .avatar { width: 52px; height: 52px; line-height: 50px; font-size: 1.2rem; }
.login-person div { margin-top: 9px; }
