/* Laora suite, identity "Clairière" */
@font-face { font-family: "DM Sans"; src: url(fonts/dm-sans-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(fonts/dm-sans-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DM Serif Display"; src: url(fonts/dm-serif-display-400.woff2) format("woff2"); font-display: swap; }

:root {
  --bg: #F3F0E8; --surface: #FBFAF6; --card: #FFFFFF; --ink: #23302A; --muted: #4D5A53;
  --line: #DCD7CA; --forest: #2F5240; --on-forest: #F3F0E8; --mist: #DCE3DA;
  --terra: #C4623A; --terra-strong: #A9502C;
  --serif: "DM Serif Display", Georgia, serif; --sans: "DM Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151C18; --surface: #1B2420; --card: #212C27; --ink: #E7EAE3; --muted: #A9B4AC;
    --line: #34413A; --forest: #24402F; --on-forest: #E7EAE3; --mist: #2C3A32;
    --terra: #D9774E; --terra-strong: #B65C35;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }
[hidden] { display: none !important; }
.dot { color: var(--terra); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button { cursor: pointer; }
.primary { background: var(--terra-strong); color: #fff; border: 0; border-radius: 22px; min-height: 44px; padding: 0 20px; font-weight: 700; }
.primary.wide { width: 100%; }
.ghost { display: block; background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 10px; color: inherit; width: 100%; text-decoration: none; font-size: 14px; }
.ghost:hover { background: rgba(255,255,255,.08); }
.icon { width: 44px; height: 44px; border: 0; border-radius: 22px; background: none; display: inline-grid; place-items: center; flex: none; }
.icon:hover { background: var(--mist); }
.icon svg, .fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link { background: none; border: 0; color: var(--terra-strong); font-weight: 700; padding: 8px 0; }
@media (prefers-color-scheme: dark) { .link { color: var(--terra); } }

/* login */
#login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font: 44px/1 var(--serif); margin: 4px 0 0; font-weight: 400; }
.login-card p { margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
input:not([type=checkbox]), select, textarea { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 12px; font-size: 16px; color: var(--ink); }
textarea { padding: 10px 12px; resize: vertical; }
.error { color: #B3261E; min-height: 1em; font-size: 14px; margin: 0; }

/* layout */
#app { display: flex; height: 100%; overflow: hidden; }
#side { width: 320px; flex: none; background: var(--forest); color: var(--on-forest); display: flex; flex-direction: column; gap: 14px; padding: 22px 14px 12px; overflow-y: auto; }
.side-head { padding: 0 8px; }
.side-head h1 { font: 34px/1.1 var(--serif); margin: 0; font-weight: 400; }
.side-head p { margin: 4px 0 0; opacity: .8; }
.side-title { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 6px 8px 0; opacity: .8; }
#calendars { list-style: none; margin: 0; padding: 0 4px; }
#calendars label { flex-direction: row; align-items: center; gap: 10px; color: inherit; font-size: 15px; padding: 8px; border-radius: 10px; cursor: pointer; }
#calendars label:hover { background: rgba(255,255,255,.08); }
#calendars input { appearance: none; width: 20px; height: 20px; min-height: 0; border-radius: 6px; border: 2px solid var(--c); background: transparent; padding: 0; margin: 0; flex: none; }
#calendars input:checked { background: var(--c); }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding-top: 8px; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--surface); }
.top { display: flex; align-items: center; gap: 6px; padding: 12px 12px 4px; }
.top h2 { flex: 1; margin: 0; font: 26px/1.2 var(--serif); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu { display: none; }
.chip-btn { height: 36px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 14px; font-weight: 700; }

.pills { display: flex; gap: 6px; padding: 6px 16px 10px; }
.pills button { flex: 1; max-width: 140px; height: 38px; border-radius: 19px; border: 0; background: var(--mist); color: var(--ink); font-size: 14px; }
.pills button[aria-selected="true"] { background: var(--forest); color: var(--on-forest); font-weight: 700; }

#main-month { display: none; }
#fc-wrap { flex: 1; min-height: 0; padding: 0 12px 12px; }
#fc { height: 100%; }
.fab { display: none; position: absolute; right: 18px; bottom: 18px; width: 58px; height: 58px; border-radius: 29px; border: 0; background: var(--terra-strong); color: #fff; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 5; }
.fab svg { width: 26px; height: 26px; }

/* month grid + day cards */
.month { padding: 4px 4px 8px; }
.month-head { display: flex; align-items: center; justify-content: space-between; }
.month-head h3 { margin: 0; font: 22px/1.2 var(--serif); font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: 4px; touch-action: pan-y; }
.wd { text-align: center; font-size: 12px; font-weight: 700; opacity: .7; padding: 4px 0; }
.cell { height: 46px; border: 0; background: none; color: inherit; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; }
.cell .n { width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; font-size: 14px; }
.cell.out { opacity: .45; }
.cell:hover .n { background: rgba(127,127,127,.15); }
.cell.today .n { border: 2px solid var(--terra); font-weight: 700; }
.cell[aria-current="date"] .n { background: var(--terra-strong); color: #fff; font-weight: 700; border-color: transparent; }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 3px; }
.day { padding: 6px 4px 12px; }
.day-head h3 { margin: 4px 4px 10px; font: 20px/1.2 var(--serif); font-weight: 400; }
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card { width: 100%; text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 12px 20px; display: flex; flex-direction: column; gap: 3px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c); }
.card-title { font-weight: 700; font-size: 15px; }
.card-time { font-size: 14px; color: var(--muted); }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.card-meta .loc::before { content: "⌖ "; }
.chip { background: var(--mist); color: var(--ink); border-radius: 8px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 6px; opacity: .9; }
#side .card { border-color: transparent; }

/* editor */
dialog { border: 0; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,28,24,.45); }
#event-form { display: flex; flex-direction: column; max-height: inherit; }
.ed-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ed-head h2 { flex: 1; margin: 0; font: 22px/1.2 var(--serif); font-weight: 400; }
.ed-body { padding: 16px 20px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.title-input { font: 26px/1.2 var(--serif) !important; border: 0 !important; border-bottom: 2px solid var(--mist) !important; border-radius: 0 !important; background: none !important; padding: 4px 0 !important; }
.when { display: flex; flex-direction: column; gap: 10px; }
.pair { display: flex; gap: 8px; }
.pair input[type=date] { flex: 1.4; min-width: 0; }
.pair input[type=time] { flex: 1; min-width: 0; }
fieldset { border: none; padding: 0; margin: 0; }
legend { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
#swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 0; padding: 0; outline-offset: 3px; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); }
.swatch.none { background: conic-gradient(var(--line) 25%, var(--card) 0 50%, var(--line) 0 75%, var(--card) 0) 0 0/12px 12px; }
.note { margin: 0; font-size: 13px; background: var(--mist); padding: 10px 12px; border-radius: 12px; }
.danger { align-self: flex-start; background: none; border: 1px solid #B3261E; color: #B3261E; border-radius: 22px; min-height: 44px; padding: 0 18px; font-weight: 700; }
@media (prefers-color-scheme: dark) { .danger { color: #F2B8B5; border-color: #F2B8B5; } .error { color: #F2B8B5; } }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 20px; font-size: 14px; max-width: calc(100% - 32px); z-index: 30; }

/* FullCalendar in Clairière */
.fc {
  --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--bg);
  --fc-today-bg-color: color-mix(in srgb, var(--terra) 9%, transparent); --fc-now-indicator-color: var(--terra);
  --fc-button-bg-color: var(--card); --fc-button-text-color: var(--ink); --fc-button-border-color: var(--line);
  --fc-button-hover-bg-color: var(--mist); --fc-button-hover-border-color: var(--line);
  --fc-button-active-bg-color: var(--forest); --fc-button-active-border-color: var(--forest);
  --fc-event-border-color: transparent; font-size: 14px;
}
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 8px; }
.fc .fc-toolbar-title { font: 22px/1.2 var(--serif); text-transform: capitalize; }
.fc .fc-button { border-radius: 18px; padding: 4px 12px; }
.fc .fc-col-header-cell-cushion { text-transform: capitalize; font-weight: 700; color: var(--ink); text-decoration: none; padding: 6px 2px; }
.fc .fc-daygrid-day-number, .fc .fc-col-header-cell a { color: var(--ink); text-decoration: none; }
.fc .fc-timegrid-slot-label { font-size: 12px; color: var(--muted); }
.fc .fc-timegrid-slot { height: 2.6em; }
.fc-event { cursor: pointer; border-radius: 8px; }
.fc-timegrid-event { border-left: 4px solid rgba(0,0,0,.25) !important; padding: 1px 2px; }
.fc .fc-scrollgrid { border-radius: 14px; overflow: hidden; }

/* tablet & phone: sidebar becomes a drawer */
@media (max-width: 899px) {
  #menu { display: inline-grid; }
  #side { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; width: 300px; }
  body.drawer #side { transform: none; }
  #side-new { display: none; }
  #scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 19; }
  .fab { display: grid; }
  body.month-mode #main-month { display: block; flex: 1; overflow-y: auto; padding: 0 12px 96px; }
  body.month-mode #fc-wrap { display: none; }
  .fc .fc-toolbar-title { font-size: 19px; }
  dialog { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; margin: 0; }
}
