@font-face { font-family: Fraunces; src: url(/static/fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Figtree; src: url(/static/fonts/figtree.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #e9ecf4;
  --ink: #0f1b33;
  --muted: #55607a;
  --line: #d9deea;
  --navy: #0b1f44;
  --gold: #d9ad5f;
  --gold-ink: #86601c;
  --danger: #a8331f;
  --live: #1c7c54;
  --warn: #b26a00;
  --shadow: 0 1px 2px rgb(15 25 50 / .06), 0 10px 26px -14px rgb(15 25 50 / .28);
  --shadow-lift: 0 2px 4px rgb(15 25 50 / .08), 0 26px 44px -20px rgb(15 25 50 / .42);
  --radius: 16px;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='-48 -48 96 96'%3E%3Cpath d='M0-33 9.7-23.3H23.3V-9.7L33 0 23.3 9.7V23.3H9.7L0 33-9.7 23.3H-23.3V9.7L-33 0-23.3-9.7V-23.3H-9.7Z' fill='none' stroke='%23d9ad5f' stroke-opacity='.16' stroke-width='1.2'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071022;
    --surface: #0f1c36;
    --surface-2: #18284a;
    --ink: #eef0f6;
    --muted: #a3aec6;
    --line: #24345a;
    --gold-ink: #e3bd77;
    --danger: #f08a75;
    --live: #4fc592;
    --warn: #eeb04f;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 26px -14px rgb(0 0 0 / .7);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / .4), 0 26px 44px -20px rgb(0 0 0 / .85);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 Figtree, system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: min(1240px, 100% - 2 * clamp(16px, 4vw, 40px)); margin-inline: auto; }
.hint { color: var(--muted); font-size: .85rem; line-height: 1.4; }
.spacer { flex: 1; }

/* ---------- hero ---------- */

.hero {
  color: #f5f6fa;
  background: var(--star) center top / 96px, radial-gradient(900px 480px at 88% -10%, #1d3f7d 0, transparent 70%), var(--navy);
  padding-bottom: 76px;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.brand img { display: block; }
.hero-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px 48px; flex-wrap: wrap; padding-top: clamp(20px, 5vw, 52px); }
.eyebrow { color: var(--gold); font-size: .82rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 12px; }
.eyebrow-dark { color: var(--gold-ink); }
.hero h1 { font: 500 clamp(2.05rem, 5vw, 3.5rem)/1.08 Fraunces, Georgia, serif; letter-spacing: -.015em; max-width: 19ch; text-wrap: balance; }
.tally { display: flex; gap: clamp(22px, 3.4vw, 44px); margin: 0; }
.tally div { border-left: 1px solid rgb(217 173 95 / .45); padding-left: 14px; }
.tally dd { margin: 0; font: 500 2.1rem/1.1 Fraunces, Georgia, serif; font-variant-numeric: tabular-nums; }
.tally dt { color: #b8c3da; font-size: .84rem; }

.search {
  display: flex; align-items: center; gap: 12px; margin-top: 32px; max-width: 620px; padding: 5px 14px 5px 18px;
  background: #ffffff; color: #0f1b33; border-radius: 14px; box-shadow: 0 16px 34px -18px rgb(0 0 0 / .6);
}
.search svg { color: #55607a; flex: none; }
.search input { flex: 1; min-width: 0; height: 46px; border: 0; background: none; outline: 0; color: #0f1b33; }
.search input::placeholder { color: #5f6a84; }
.search:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.search kbd { font: 600 .78rem Figtree, sans-serif; color: #55607a; border: 1px solid #d3d9e6; border-radius: 6px; padding: 1px 8px; }
@media (hover: none) { .search kbd { display: none; } }

/* ---------- account menu ---------- */

.menu { position: relative; }
.menu summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; border-radius: 99px; padding: 4px 14px 4px 4px; min-height: 44px; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: rgb(255 255 255 / .1); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #2c2108; font-size: .84rem; font-weight: 700; }
.menu-pop { position: absolute; z-index: 20; right: 0; top: calc(100% + 8px); min-width: 210px; padding: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lift); }
.menu-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.menu-pop button:hover { background: var(--surface-2); }
@media (max-width: 520px) { .menu-name { display: none; } .menu summary { padding-right: 4px; } }

/* ---------- filter chips ---------- */

.chips { display: flex; gap: 8px; margin-top: -24px; padding-bottom: 24px; overflow-x: auto; scrollbar-width: none; position: relative; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 99px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); font-weight: 500; box-shadow: var(--shadow); transition: background .15s, color .15s;
}
.chip span { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--surface-2); }
.chip[aria-current="true"] { background: var(--gold); border-color: var(--gold); color: #2c2108; }
.chip[aria-current="true"] span { color: #5c4613; }
.chips .chip:focus-visible { outline-offset: -3px; }

/* ---------- cards ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 24px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s;
 
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.card-media { display: block; overflow: hidden; }
.thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--navy); }
.thumb svg, .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2,.7,.3,1); }
.card:hover .thumb svg, .card:hover .thumb img { transform: scale(1.045); }

.status { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 99px; background: rgb(255 255 255 / .95); color: #0f1b33; font-size: .78rem; font-weight: 600; box-shadow: 0 2px 8px rgb(0 0 0 / .22); }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-live::before { background: #1c9d68; }
.status-maintenance::before { background: #dd8a0b; }
.status-soon::before { background: #6d7a94; }
.status-internal::before { background: #7c5cc4; }
.card-title { display: flex; align-items: center; gap: 10px; }
.app-icon { flex: none; width: 30px; height: 30px; padding: 3px; object-fit: contain; border-radius: 8px; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .2); }
.card-domain { align-self: flex-start; max-width: 100%; margin-top: 8px; padding: 3px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); border-radius: 99px; background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold-ink); font-size: .84rem; font-weight: 700; letter-spacing: .01em; text-decoration: none; }
.card-domain:hover { background: color-mix(in srgb, var(--gold) 28%, transparent); }
.access-cc { margin-top: 8px; overflow-wrap: break-word; }
button.card-media { width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.access-email { display: flex; flex-wrap: wrap; gap: 8px; }
.access-email .btn-primary { white-space: normal; text-align: center; }
.access-none { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); }
.card .card-edit { position: absolute; top: 8px; right: 8px; background: rgb(255 255 255 / .95); color: #0f1b33; box-shadow: 0 2px 8px rgb(0 0 0 / .22); }
.card .card-edit:hover { background: #fff; }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.card-cat { color: var(--gold-ink); font-size: .76rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.card h2 { font: 500 1.34rem/1.2 Fraunces, Georgia, serif; margin-top: 5px; }
.card-desc { color: var(--muted); font-size: .94rem; margin-top: 7px; margin-bottom: 18px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.no-link { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: .92rem; font-style: italic; }

.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 300px; padding: 24px; cursor: pointer;
  background: transparent; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); transition: border-color .15s, color .15s, background .15s;
}
.add-tile strong { color: var(--ink); font: 500 1.2rem Fraunces, Georgia, serif; }
.add-tile:hover { border-color: var(--gold); background: var(--surface); color: var(--gold-ink); }

.empty { padding: 56px 16px; text-align: center; color: var(--muted); font-size: 1.05rem; }
.foot { display: flex; align-items: center; gap: 10px; padding-block: 44px 32px; color: var(--muted); font-size: .86rem; }

/* ---------- buttons ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent; background: none; cursor: pointer; font-weight: 600; font-size: .94rem; text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-grow { flex: 1 1 auto; }
.btn-wide { flex: 1 0 100%; }
.btn-off { border: 1px dashed var(--line); color: var(--muted); cursor: default; font-weight: 500; }
.btn-block { width: 100%; min-height: 48px; }
.btn-primary { background: var(--navy); color: #f8f7f2; }
.btn-primary:hover { background: #16346b; }
.btn-ghost { border-color: var(--line); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-danger-solid { background: #a8331f; color: #fff; }
.btn-danger-solid:hover { background: #8d2916; }
.btn-on-dark { background: var(--gold); color: #2c2108; }
.btn-on-dark:hover { background: #e7bf78; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-size: 1.4rem; line-height: 1; }
.sheet-head .icon-btn:hover { background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  .btn-primary { background: var(--gold); color: #2c2108; }
  .btn-primary:hover { background: #e7bf78; }
}

/* ---------- dialogs and forms ---------- */

.sheet { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lift); }
.sheet-wide { width: min(680px, calc(100vw - 24px)); }
.sheet-small { width: min(430px, calc(100vw - 24px)); }
.sheet::backdrop { background: rgb(5 12 28 / .62); backdrop-filter: blur(3px); }
.sheet h2 { font: 500 1.45rem/1.2 Fraunces, Georgia, serif; }
.sheet h3 { font: 500 1.14rem Fraunces, Georgia, serif; margin-bottom: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.ask-text { color: var(--muted); margin: 8px 0 14px; }

.field { display: block; margin-top: 14px; font-size: .9rem; font-weight: 600; }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; min-height: 44px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-weight: 400; font-size: 1rem;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.field .hint { display: block; margin-top: 5px; font-weight: 400; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 14px; }
.form-error { margin-top: 14px; padding: 10px 12px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 10px; font-size: .92rem; font-weight: 500; }

.thumb-edit { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.thumb-edit .thumb { border-radius: 12px; }
.thumb-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.thumb-actions .btn { white-space: normal; text-align: center; }
.thumb-actions label:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (max-width: 520px) { .thumb-edit { grid-template-columns: 1fr; } }

.switch { display: flex; gap: 14px; padding: 14px; background: var(--bg); border-radius: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: relative; flex: none; width: 44px; height: 26px; margin-top: 1px; border-radius: 99px; background: #8c96ab; transition: background .15s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .switch-track { background: #b8892b; }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--gold); outline-offset: 2px; }

.people { list-style: none; margin: 16px 0; padding: 0; }
.people li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.people-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); font-size: .74rem; font-weight: 600; }
.tag-admin { color: var(--gold-ink); background: color-mix(in srgb, var(--gold) 22%, transparent); }
.person-form { padding-top: 18px; border-top: 1px solid var(--line); }
.person-form .field:first-child { margin-top: 0; }
.person-form .field-row .field { margin-top: 0; margin-bottom: 14px; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 11px 18px; color: #f8f7f2; background: #0d1a33; border: 1px solid rgb(217 173 95 / .45); border-radius: 12px; box-shadow: 0 16px 34px -14px rgb(0 0 0 / .7); font-weight: 500; }

/* ---------- sign-in page ---------- */

.login-page { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100dvh; }
.login-art { display: flex; align-items: flex-end; padding: clamp(32px, 6vw, 72px); color: #f5f6fa; background: var(--star) center / 96px, radial-gradient(800px 600px at 15% 0, #1d3f7d 0, transparent 72%), var(--navy); }
.login-art img { display: block; margin-bottom: 26px; }
.login-quote { font: 500 clamp(2.3rem, 4.6vw, 4rem)/1.06 Fraunces, Georgia, serif; letter-spacing: -.015em; }
.login-panel { display: grid; place-items: center; padding: clamp(28px, 6vw, 64px) clamp(16px, 5vw, 64px); }
.login-form { width: min(390px, 100%); }
.login-form h1 { font: 500 2.2rem/1.1 Fraunces, Georgia, serif; }
.login-sub { color: var(--muted); margin: 10px 0 12px; }
.login-form .btn-block { margin-top: 22px; }
.login-help { margin-top: 16px; text-align: center; }
@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-art { padding: 24px 16px; }
  .login-art img { width: 76px; height: 76px; margin-bottom: 14px; }
  .login-quote { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- htmx version additions ---------- */

.chip { text-decoration: none; color: inherit; }
.grid-enter .card { animation: rise .45s cubic-bezier(.2,.7,.3,1) both; animation-delay: calc(var(--i, 0) * 35ms); }
.search { padding-right: 14px; }
.thumb-edit .thumb { position: relative; }
.thumb-art { height: 100%; }
.thumb-overlay { position: absolute; inset: 0; }
.menu-pop form { margin: 0; }
.reset-form { flex-basis: 100%; }
.reset-form .field { margin-top: 4px; }
.reset-form .sheet-foot { margin-top: 10px; }

/* Form fields need a visible edge on both the page and the dialog backgrounds. */
:root { --field-line: #aeb7ca; }
@media (prefers-color-scheme: dark) { :root { --field-line: #41537c; } }
.field input, .field select, .field textarea { border-color: var(--field-line); }
.login-form .field input { background: var(--surface); }

.foot-admin { margin-left: auto; padding: 12px 0; color: var(--muted); }
.foot-admin:hover { color: var(--gold-ink); }
.person-form > .field { margin-top: 0; }
