/* LouieFit base styles. Tokens from the identity board; see DESIGN.md. */
@font-face {
  font-family: "Sora";
  src: url("/fonts/sora-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --onyx: #0b0b0b;
  --coral: #ff595e;
  --pink: #ff4db8;
  --plum: #4b1e6d;
  --cobalt: #2563eb;
  --lime: #d7ff3f;
  --warm: #f4ede6;
  --white: #fff;
  --ink-soft: #4a4540;
  --line: #ddd3c8;
  --ok: #1f6b3a;
  --danger: #b3261e;
  --font: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --radius: 12px;
  --control: 44px;
  --measure: 44rem;
  --focus: 0 0 0 3px var(--white), 0 0 0 6px var(--cobalt);
  --focus-color: var(--cobalt);
  /* Roles. Plain light values here, so the admin (which also loads this file) is unchanged. */
  --ink: var(--onyx);
  --ground: var(--warm);
  --surface: var(--white);
  --field: var(--white);
  --edge: var(--onyx);
  --band: #efe5dc;
  --header: var(--white);
  --footer: var(--onyx);
  --footer-edge: var(--onyx);
  --disc: #ffe0e1;
  --hover: var(--warm);
  --inverse-bg: var(--onyx);
  --inverse-fg: var(--white);
}

/* Client pages: every role is light-dark(light, dark), palette A "Onyx". It follows the device
   unless the visitor picked Light or Dark (data-theme on <html>, see src/theme.ts). */
body:not(.admin) {
  color-scheme: light dark;
  --ink: light-dark(#0b0b0b, #f4ede6);
  --ground: light-dark(#f4ede6, #0b0b0b);
  --surface: light-dark(#fff, #161616);
  --field: light-dark(#fff, #1c1c1c);
  --edge: light-dark(#0b0b0b, #4a4a4a);
  --line: light-dark(#ddd3c8, #2a2a2a);
  --ink-soft: light-dark(#4a4540, #b5aca3);
  --band: light-dark(#efe5dc, #141414);
  --header: light-dark(#fff, #0b0b0b);
  --footer: light-dark(#0b0b0b, #050505);
  --footer-edge: light-dark(#0b0b0b, #2a2a2a);
  --disc: light-dark(#ffe0e1, rgb(255 89 94 / .16));
  --hover: light-dark(#f4ede6, #222);
  --inverse-bg: light-dark(#0b0b0b, #f4ede6);
  --inverse-fg: light-dark(#fff, #0b0b0b);
  --ok: light-dark(#1f6b3a, #86efac);
  --danger: light-dark(#b3261e, #fca5a5);
  --focus: 0 0 0 3px light-dark(#fff, #0b0b0b), 0 0 0 6px light-dark(#2563eb, #60a5fa);
  --focus-color: light-dark(#2563eb, #60a5fa);
}
:root[data-theme="light"] body:not(.admin) { color-scheme: light; }
:root[data-theme="dark"] body:not(.admin) { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.55 var(--font);
  color: var(--ink);
  background: var(--ground);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
img, svg { max-width: 100%; height: auto; }
.icon { width: 1.5em; height: 1.5em; flex: none; vertical-align: middle; }
main { flex: 1; width: 100%; max-width: var(--measure); margin: 0 auto; padding: var(--s5) var(--s4) var(--s7); }

h1, h2, h3 { font-weight: 800; line-height: 1.15; text-wrap: pretty; margin: 0 0 var(--s3); }
h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); }
h2 { font-size: 1.5rem; margin-top: var(--s6); }
h3 { font-size: 1.125rem; }
p { margin: 0 0 var(--s4); }
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--coral); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
/* Focus rings are for keyboard focus on controls. Programmatic focus targets (main for the skip
   link, error summaries) are not controls: no ring. Text fields show focus in their border. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }
.muted, .hint { color: var(--ink-soft); font-size: .875rem; }

.skip { position: absolute; left: var(--s4); top: -100px; background: var(--onyx); color: var(--white); padding: var(--s2) var(--s4); border-radius: 8px; z-index: 10; }
.skip:focus { top: var(--s2); }

/* Header and footer */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); background: var(--header); border-bottom: 1px solid var(--line); }
.brand img { display: block; height: 44px; width: auto; }
.header-links { display: none; flex-wrap: wrap; gap: var(--s1) var(--s5); font-weight: 600; margin-inline: auto; }
.header-links a { display: inline-flex; align-items: center; min-height: var(--control); text-decoration: none; }
.header-links a:hover { text-decoration: underline; text-decoration-color: var(--coral); text-decoration-thickness: 2px; }
.header-cta { min-height: var(--control); white-space: nowrap; }
.header-end { display: flex; align-items: center; gap: var(--s2); }
@media (max-width: 47.99rem) {
  /* Phone bar: logo and call to action of similar weight, the menu a quiet icon with a full tap area. */
  .site-header { flex-wrap: nowrap; padding: var(--s2) var(--s2) var(--s2) var(--s4); }
  .brand { min-width: 0; }
  .brand img { height: 30px; }
  .header-end { gap: var(--s1); }
  .site-header .header-cta { min-height: 36px; padding-inline: var(--s4); font-size: .875rem; white-space: nowrap; }
  .site-header .menu-button .icon { width: 22px; height: 22px; }
}
/* Header: fixed at the top with the page starting below it, so slimming it never moves the page.
   Once scrolled it slims down, frosted, with a soft shadow (/js/header.js adds .is-compact).
   Anchors and scrollIntoView stop below the slim header (scroll-padding-top). */
:root { --header-h: 60px; --header-compact: 52px; }
html:has(body > .site-header) { scroll-padding-top: var(--header-compact); }
body:has(> .site-header) { padding-top: var(--header-h); }
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--header-h); flex-wrap: nowrap; padding-block: 0; transition: height .3s cubic-bezier(.23, 1, .32, 1), background-color .3s ease, box-shadow .3s ease; }
.brand img { transition: height .3s cubic-bezier(.23, 1, .32, 1); }
.site-header.is-compact { height: var(--header-compact); background: color-mix(in srgb, var(--header) 82%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 6px 24px rgb(0 0 0 / .08); }
.site-header.is-compact .brand img { height: 24px; }
@media (min-width: 48rem) {
  :root { --header-h: 76px; --header-compact: 60px; }
  .site-header.is-compact .brand img { height: 34px; }
}
@media print {
  body:has(> .site-header) { padding-top: 0; }
  .site-header { position: static; height: auto; }
}
.menu-button, .menu-close { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--control); height: var(--control); padding: 0; border: 0; border-radius: 999px; background: none; color: var(--ink); cursor: pointer; }
.menu-button:hover, .menu-close:hover { background: var(--hover); }
.menu-button .icon, .menu-close .icon { width: 28px; height: 28px; }

/* Menu drawer: a native popover pinned to the right edge. display is set only while open, or the
   popover would always show. */
.site-menu { position: fixed; inset: 0 0 0 auto; width: min(20rem, 85vw); height: 100dvh; max-height: none; margin: 0; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); border: 0; background: var(--surface); color: var(--ink); box-shadow: -8px 0 32px rgb(0 0 0 / .25); transform: translateX(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1), overlay .25s allow-discrete, display .25s allow-discrete; }
.site-menu:popover-open { display: flex; flex-direction: column; transform: none; }
@starting-style { .site-menu:popover-open { transform: translateX(100%); } }
.site-menu::backdrop { background: rgb(11 11 11 / .45); }
.site-menu-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s3) var(--s3) var(--s5); }
.site-menu-title { font-weight: 800; font-size: 1.125rem; }
.site-menu-body { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 0 var(--s3) var(--s5); scrollbar-width: thin; }
.site-menu ul { list-style: none; margin: 0; padding: var(--s2) 0; }
.site-menu ul + ul { border-top: 1px solid var(--line); }
.site-menu a, .site-menu-signout button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 var(--s3); border: 0; border-radius: 8px; background: none; color: var(--ink); font: 600 1.0625rem/1.2 var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.site-menu a:hover, .site-menu-signout button:hover { background: var(--hover); }
/* Theme icons, then Sign out, pinned to the bottom of the drawer. Quiet on purpose: no track,
   muted icons; the current one is full ink on a soft tint. */
.theme-choice { margin: auto 0 0; padding: var(--s3) var(--s2); }
.theme-options { display: inline-flex; gap: 2px; }
.theme-options button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-soft); opacity: .7; cursor: pointer; }
.theme-options button .icon { width: 18px; height: 18px; }
.theme-options button:hover { opacity: 1; }
.theme-options button[aria-pressed="true"] { background: var(--hover); color: var(--ink); opacity: 1; }
.site-menu-signout { margin: 0; padding-top: var(--s2); border-top: 1px solid var(--line); }
.site-menu-signout button { color: var(--ink-soft); }
.site-footer { padding: var(--s7) var(--s4) var(--s6); background: var(--footer); border-top: 1px solid var(--footer-edge); color: var(--white); font-size: .875rem; text-align: center; }
.footer-logo { display: block; width: 180px; height: auto; margin: 0 auto var(--s5); }
.site-footer p { margin: 0 0 var(--s2); max-width: var(--measure); margin-inline: auto; }
.site-footer a { color: var(--white); }
/* Louie's Instagram and Facebook: quiet icons with a full tap area. */
.social { display: flex; justify-content: center; gap: var(--s2); list-style: none; margin: 0 0 var(--s4); padding: 0; }
.social a { display: inline-flex; align-items: center; justify-content: center; width: var(--control); height: var(--control); border-radius: 999px; }
.social a:hover { background: rgb(255 255 255 / .1); }
.social .icon { width: 24px; height: 24px; }

/* Buttons: 44px regular, onyx text on coral */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--control); padding: 0 var(--s5); border: 2px solid var(--onyx); border-radius: 999px; background: var(--coral); color: var(--onyx); font: 700 1rem/1.2 var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: #ff7a7e; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--lime); color: var(--onyx); border-color: var(--onyx); }
.btn-quiet { background: transparent; border-color: transparent; padding: 0 var(--s3); color: var(--ink); }
.btn-quiet:hover { background: var(--surface); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-small { min-height: 36px; padding: 0 var(--s4); font-size: .875rem; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }

/* Fields. Floating label: the label rests inside the empty field and moves to the top edge
   when the field is focused, filled or autofilled. Hints and errors sit under the field. */
.field { margin-bottom: var(--s5); }
.field label { display: block; font-weight: 600; margin-bottom: var(--s1); }
.field .hint { margin: var(--s2) 0 0; }
.field input, .field select, .field textarea { display: block; width: 100%; min-height: var(--control); padding: var(--s2) var(--s3); font: inherit; color: var(--ink); background: var(--field); border: 2px solid var(--edge); border-radius: 8px; }
.field textarea { resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--focus-color); box-shadow: 0 0 0 1px var(--focus-color); }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field.has-error .select-menu__button { border-color: var(--danger); }
.field.has-error input:focus-visible, .field.has-error textarea:focus-visible, .field.has-error .select-menu__button:focus-visible { box-shadow: 0 0 0 1px var(--danger); }
.field .error { margin: var(--s2) 0 0; color: var(--danger); font-weight: 600; font-size: .875rem; }

.field.floating .control { position: relative; }
.field.floating input, .field.floating textarea { padding: 22px var(--s3) 6px; min-height: 3.25rem; }
.field.floating textarea { min-height: 7rem; }
.field.floating label { position: absolute; left: calc(var(--s3) + 2px); top: 1.625rem; margin: 0; max-width: calc(100% - var(--s5) - 4px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transform: translateY(-50%); color: var(--ink-soft); font-weight: 400; pointer-events: none; transition: top .15s ease, font-size .15s ease, color .15s ease; }
.field.floating textarea ~ label { top: 1.625rem; }
.field.floating input:focus ~ label,
.field.floating input:not(:placeholder-shown) ~ label,
.field.floating input:-webkit-autofill ~ label,
.field.floating input:autofill ~ label,
.field.floating textarea:focus ~ label,
.field.floating textarea:not(:placeholder-shown) ~ label,
.field.floating.field-fixed input ~ label { top: 14px; font-size: .75rem; font-weight: 600; }
.field.floating input:focus ~ label, .field.floating textarea:focus ~ label { color: var(--ink); }
.field.floating.has-error input ~ label, .field.floating.has-error textarea ~ label { color: var(--danger); }
.field.floating.field-fixed input { min-height: 3.25rem; }

/* Select menu: native select until select-menu.js enhances it */
.select-menu { position: relative; }
.select-menu__native { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }
.select-menu__button { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; min-height: var(--control); padding: var(--s2) var(--s3); font: inherit; text-align: left; color: var(--ink); background: var(--field); border: 2px solid var(--edge); border-radius: 8px; cursor: pointer; }
.select-menu__button:focus-visible { border-color: var(--focus-color); box-shadow: 0 0 0 1px var(--focus-color); outline: none; }
.select-menu__chevron { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
.select-menu__button[aria-expanded="true"] .select-menu__chevron { transform: translateY(2px) rotate(-135deg); }
.select-menu__popup { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + var(--s1)); }
.select-menu.is-up .select-menu__popup { top: auto; bottom: calc(100% + var(--s1)); }
.select-menu__list { list-style: none; margin: 0; padding: var(--s1); max-height: 19rem; overflow-y: auto; background: var(--surface); border: 2px solid var(--edge); border-radius: 8px; box-shadow: 0 8px 24px rgb(11 11 11 / .18); scrollbar-width: thin; }
.select-menu__list:focus { outline: none; }
.select-menu__option { display: flex; align-items: center; min-height: var(--control); padding: var(--s2) var(--s3); border-radius: 6px; cursor: pointer; }
.select-menu__option.is-active { background: var(--hover); }
.select-menu__option[aria-selected="true"] { font-weight: 700; }
.select-menu__option[aria-selected="true"]::after { content: ""; flex: none; width: 6px; height: 11px; margin-left: auto; border-right: 2px solid var(--coral); border-bottom: 2px solid var(--coral); transform: translateY(-2px) rotate(45deg); }
.select-menu__option[aria-disabled="true"] { color: var(--ink-soft); cursor: not-allowed; }
.error-summary { border: 2px solid var(--danger); background: var(--surface); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s5); }
.error-summary h2 { margin: 0 0 var(--s2); font-size: 1.125rem; color: var(--danger); }
.error-summary ul { margin: 0; padding-left: var(--s5); }

/* Flash */
/* Flash on client pages: a toast. A lime pill floating under the header, soft shadow, no hard edge; it slides in,
   stays 5s and fades (/js/header.js hides it then, or on a tap, so it also goes with reduced motion). */
.flash { margin: 0; padding: var(--s3) var(--s4); background: var(--lime); color: var(--onyx); font-weight: 600; text-align: center; }
body:not(.admin) .flash { position: fixed; top: calc(var(--header-h) + var(--s3)); left: 50%; z-index: 55; width: max-content; max-width: calc(100% - 2 * var(--s4)); padding: var(--s2) var(--s4); border-radius: 999px; font-size: .9375rem; line-height: 1.35; text-wrap: pretty; box-shadow: 0 8px 24px rgb(0 0 0 / .16); cursor: pointer; transform: translateX(-50%); animation: flash-in .35s cubic-bezier(.23, 1, .32, 1) both, flash-out .4s ease 4.6s forwards; }
@keyframes flash-in { from { opacity: 0; transform: translate(-50%, -.5rem); } }
@keyframes flash-out { to { opacity: 0; transform: translate(-50%, -.5rem); } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s4); }
.card > :last-child { margin-bottom: 0; }
.card-accent { border-color: var(--edge); border-width: 2px; }

/* Day grouped list (week view) */
.day-group { margin-bottom: var(--s5); }
.day-group > h3 { position: sticky; top: 0; margin: 0; padding: var(--s2) 0; background: var(--ground); border-bottom: 2px solid var(--edge); font-size: 1rem; }
.day-list { list-style: none; margin: 0; padding: 0; }
.day-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.day-list .time { font-weight: 800; min-width: 4.5rem; font-variant-numeric: tabular-nums; }

/* Table: stacks under 40rem */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .875rem; color: var(--ink-soft); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { position: absolute; left: -9999px; }
  .table tr { padding: var(--s3) 0; border-bottom: 2px solid var(--edge); }
  .table td { border: 0; padding: var(--s1) var(--s4); }
  .table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-soft); }
  .table .num { text-align: left; }
}

/* Status badges: booking and invoice states */
.badge { display: inline-block; padding: 2px var(--s3); border-radius: 999px; font-size: .8125rem; font-weight: 700; border: 2px solid var(--edge); background: var(--surface); color: var(--ink); white-space: nowrap; }
/* Lime keeps black text in both themes. */
.badge-requested, .badge-proposed, .badge-unpaid { background: var(--lime); color: var(--onyx); border-color: var(--onyx); }
.badge-approved, .badge-paid { background: var(--inverse-bg); color: var(--inverse-fg); border-color: var(--inverse-bg); }
.badge-done { background: var(--plum); border-color: var(--plum); color: var(--white); }
.badge-declined, .badge-cancelled, .badge-void { background: var(--ground); color: var(--ink-soft); border-color: var(--ink-soft); }
.badge-overdue { background: #b3261e; border-color: #b3261e; color: var(--white); }

@media (min-width: 60rem) {
  .header-links { display: flex; }
}
@media (min-width: 48rem) {
  main { padding-top: var(--s7); }
  .site-header { padding-inline: var(--s6); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
