/**
 * Monolog — "Moleskine" reskin
 *
 * Authentic pen-and-paper diary: warm aged paper, faint ruled lines, a red
 * margin rule, fountain-pen ink-blue links and an oxblood ribbon accent.
 * Body in a legible book serif (Lora); masthead, dates and titles in a
 * handwriting script (Caveat). Light, sleek, no build step.
 *
 * Remaps Bootstrap's --bs-* vars (and the per-component --bs-btn-* / --bs-card-*
 * vars — BS 5.3 bakes literal hex into component classes, so :root --bs-primary
 * alone never reaches .btn-primary / links).
 *
 * @package Monolog
 */

/* ==========================================================================
   Tokens — palette, type, paper
   ========================================================================== */
:root,
[data-bs-theme="light"] {
    /* Paper + ink */
    --ml-paper:       #F6F1E7;   /* aged off-white canvas */
    --ml-paper-raised:#FCFAF3;   /* the "page" surface (slightly brighter) */
    --ml-paper-sunken:#EFE7D6;   /* bands / insets */
    --ml-ink:         #2B2419;   /* deep sepia-black — body text */
    --ml-ink-soft:    #6B5F4B;   /* muted ink — metadata, captions */
    --ml-ink-faint:   #9C9079;   /* placeholders, hints */
    --ml-ruled:       #E5DAC6;   /* faint horizontal rule lines */
    --ml-margin-rule: #C98A86;   /* the red notebook margin line */
    --ml-border:      #E0D6C2;   /* hairline borders */
    --ml-border-strong:#C9BCA1;

    /* Accents */
    --ml-pen:         #34506B;   /* fountain-pen ink-blue — links, primary */
    --ml-pen-dark:    #26405A;
    --ml-ribbon:      #9B2D2D;   /* oxblood ribbon — active state, flourishes */
    --ml-ribbon-dark: #7E2424;
    --ml-on-pen:      #FBF7EC;   /* cream ink on the pen-blue fill */

    /* Fonts */
    --ml-font-body: 'Lora', Georgia, 'Times New Roman', serif;
    --ml-font-hand: 'Caveat', 'Segoe Script', 'Comic Sans MS', cursive;

    /* Shape + motion */
    --ml-radius: 4px;
    --ml-radius-sm: 3px;
    --ml-shadow-page: 0 1px 2px rgba(43, 36, 25, 0.06), 0 8px 24px rgba(43, 36, 25, 0.06);
    --ml-shadow-soft: 0 1px 3px rgba(43, 36, 25, 0.08);
    --ml-transition: 0.16s ease;

    /* ---- Bootstrap --bs-* remap ---- */
    --bs-primary: var(--ml-pen);           --bs-primary-rgb: 52, 80, 107;
    --bs-secondary: var(--ml-ink-soft);    --bs-secondary-rgb: 107, 95, 75;
    --bs-success: #3F6B43;                 --bs-success-rgb: 63, 107, 67;
    --bs-warning: #B5852A;                 --bs-warning-rgb: 181, 133, 42;
    --bs-danger: var(--ml-ribbon);         --bs-danger-rgb: 155, 45, 45;
    --bs-info: #4A6C7A;                    --bs-info-rgb: 74, 108, 122;

    --bs-body-bg: var(--ml-paper);
    --bs-body-color: var(--ml-ink);
    --bs-emphasis-color: var(--ml-ink);
    --bs-secondary-color: var(--ml-ink-soft);
    --bs-tertiary-bg: var(--ml-paper-sunken);
    --bs-card-bg: var(--ml-paper-raised);
    --bs-border-color: var(--ml-border);
    --bs-link-color: var(--ml-pen);        --bs-link-color-rgb: 52, 80, 107;
    --bs-link-hover-color: var(--ml-pen-dark);

    --bs-border-radius: var(--ml-radius);
    --bs-border-radius-sm: var(--ml-radius-sm);
    --bs-border-radius-lg: 6px;
    --bs-border-radius-xl: 8px;

    --bs-primary-bg-subtle: #E4EAF0;   --bs-primary-text-emphasis: var(--ml-pen-dark);
    --bs-danger-bg-subtle:  #F4E0DE;   --bs-danger-text-emphasis: var(--ml-ribbon-dark);
    --bs-warning-bg-subtle: #F5EBD4;   --bs-warning-text-emphasis: #7E5C16;
    --bs-success-bg-subtle: #E2EBDF;   --bs-success-text-emphasis: #2C4C2F;

    --bs-font-sans-serif: var(--ml-font-body);
}

/* Honor reduced-motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Base
   ========================================================================== */
body {
    font-family: var(--ml-font-body);
    background-color: var(--ml-paper);
    color: var(--ml-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 1.05rem;
    line-height: 1.7;
}
main { flex: 1 0 auto; }

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--ml-font-body);
    font-weight: 600;
    color: var(--ml-ink);
    letter-spacing: 0;
}

a { color: var(--ml-pen); text-underline-offset: 2px; }
a:hover { color: var(--ml-pen-dark); }

::selection { background: rgba(155, 45, 45, 0.16); }

/* The handwriting voice — masthead, day headings, signatures. */
.ml-hand { font-family: var(--ml-font-hand); font-weight: 600; line-height: 1.15; }

/* ==========================================================================
   Buttons — soft, inky, quiet (BS bakes hex into .btn-* → remap --bs-btn-*)
   ========================================================================== */
.btn { font-weight: 500; box-shadow: none !important; transition: background-color var(--ml-transition), color var(--ml-transition), border-color var(--ml-transition); }
.btn:active { transform: none; }

.btn-primary {
    --bs-btn-bg: var(--ml-pen);            --bs-btn-border-color: var(--ml-pen);
    --bs-btn-hover-bg: var(--ml-pen-dark); --bs-btn-hover-border-color: var(--ml-pen-dark);
    --bs-btn-active-bg: var(--ml-pen-dark);--bs-btn-active-border-color: var(--ml-pen-dark);
    --bs-btn-disabled-bg: var(--ml-pen);   --bs-btn-disabled-border-color: var(--ml-pen);
    --bs-btn-color: var(--ml-on-pen); --bs-btn-hover-color: var(--ml-on-pen);
    --bs-btn-active-color: var(--ml-on-pen); --bs-btn-disabled-color: var(--ml-on-pen);
}
.btn-outline-primary {
    --bs-btn-color: var(--ml-pen); --bs-btn-border-color: var(--ml-border-strong);
    --bs-btn-hover-bg: var(--ml-pen); --bs-btn-hover-border-color: var(--ml-pen); --bs-btn-hover-color: var(--ml-on-pen);
    --bs-btn-active-bg: var(--ml-pen-dark); --bs-btn-active-border-color: var(--ml-pen-dark); --bs-btn-active-color: var(--ml-on-pen);
}
.btn-secondary {
    --bs-btn-bg: transparent; --bs-btn-border-color: var(--ml-border-strong);
    --bs-btn-hover-bg: var(--ml-paper-sunken); --bs-btn-hover-border-color: var(--ml-border-strong);
    --bs-btn-active-bg: var(--ml-paper-sunken); --bs-btn-active-border-color: var(--ml-border-strong);
    --bs-btn-color: var(--ml-ink); --bs-btn-hover-color: var(--ml-ink); --bs-btn-active-color: var(--ml-ink);
}
.btn-danger {
    --bs-btn-bg: var(--ml-ribbon); --bs-btn-border-color: var(--ml-ribbon);
    --bs-btn-hover-bg: var(--ml-ribbon-dark); --bs-btn-hover-border-color: var(--ml-ribbon-dark);
    --bs-btn-active-bg: var(--ml-ribbon-dark); --bs-btn-active-border-color: var(--ml-ribbon-dark);
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
}
.btn-link { --bs-btn-color: var(--ml-pen); --bs-btn-hover-color: var(--ml-pen-dark); text-decoration: none; }

/* ==========================================================================
   Cards / surfaces — paper with a hairline, the softest lift
   ========================================================================== */
.card {
    background: var(--ml-paper-raised);
    border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow-soft);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--ml-border);
    font-weight: 600;
}
.dropdown-menu {
    --bs-dropdown-bg: var(--ml-paper-raised);
    --bs-dropdown-border-color: var(--ml-border);
    --bs-dropdown-link-active-bg: var(--ml-paper-sunken);
    --bs-dropdown-link-active-color: var(--ml-ink);
    box-shadow: var(--ml-shadow-page);
}
.form-control, .form-select {
    background: var(--ml-paper-raised);
    border-color: var(--ml-border-strong);
    color: var(--ml-ink);
}
.form-control:focus, .form-select:focus {
    border-color: var(--ml-pen);
    box-shadow: 0 0 0 0.2rem rgba(52, 80, 107, 0.15);
    background: var(--ml-paper-raised);
}
.form-control::placeholder { color: var(--ml-ink-faint); }

/* ==========================================================================
   The "desk" app shell (authenticated pages)
   ========================================================================== */
body.ml-app { background-color: var(--ml-paper); }

.ml-band {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(252, 250, 243, 0.88);
    backdrop-filter: blur(8px) saturate(1.1);
    border-bottom: 1px solid var(--ml-border);
}
.ml-band-inner {
    max-width: 1080px; margin: 0 auto;
    display: flex; align-items: center; gap: 1.25rem;
    padding: 0.5rem 1.25rem;
}
.ml-brand {
    display: inline-flex; align-items: baseline; gap: 0.4rem;
    text-decoration: none; color: var(--ml-ink);
}
.ml-brand .mark { width: 26px; height: 26px; align-self: center; }
.ml-brand .name { font-family: var(--ml-font-hand); font-weight: 700; font-size: 1.7rem; line-height: 1; color: var(--ml-ink); }
.ml-nav { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; flex-wrap: wrap; }
/* Nav links — :not(.btn) so the "Write" button keeps its Bootstrap .btn-primary
   styling. (.ml-nav a is more specific than .btn, so an unscoped rule would
   override the button's colour/padding and mute it.) */
.ml-nav a:not(.btn) {
    color: var(--ml-ink-soft); text-decoration: none;
    padding: 0.35rem 0.7rem; border-radius: var(--ml-radius-sm);
    font-size: 0.95rem; position: relative;
    transition: color var(--ml-transition), background var(--ml-transition);
}
.ml-nav a:not(.btn):hover { color: var(--ml-ink); background: var(--ml-paper-sunken); }
.ml-nav a.is-active:not(.btn) { color: var(--ml-ink); }
.ml-nav a.is-active:not(.btn)::after {
    content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: 0.05rem;
    height: 2px; background: var(--ml-ribbon); border-radius: 2px;
}
.ml-band .ml-write-btn { margin-left: 0.5rem; }
.ml-signout { --bs-btn-color: var(--ml-ink-soft); --bs-btn-hover-color: var(--ml-ribbon); padding: 0.35rem 0.5rem; }

/* Content column — a sheet of paper on the desk */
.ml-content { max-width: 1080px; margin: 1.75rem auto 3rem; padding: 0 1.25rem; }
.ml-page {
    background: var(--ml-paper-raised);
    border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow-page);
    padding: 2rem 2.25rem;
    position: relative;
}
/* Decorative ruling for empty-state pages — same line unit as the writing/
   reading surfaces so spacing is identical everywhere ruling appears. */
.ml-page--ruled {
    --ml-gfs: 1.05rem;
    --ml-gline: calc(var(--ml-gfs) * 1.72);
    --ml-grule: 0.72;
    --ml-rule-buffer: 3px;
    --ml-ry: calc(var(--ml-grule) * var(--ml-gline) + var(--ml-rule-buffer));
    background-image: linear-gradient(to bottom,
        transparent calc(var(--ml-ry) - 0.5px),
        var(--ml-ruled) calc(var(--ml-ry) - 0.5px),
        var(--ml-ruled) calc(var(--ml-ry) + 0.5px),
        transparent calc(var(--ml-ry) + 0.5px));
    background-size: 100% var(--ml-gline);
    background-position: 0 0;
}
/* The red margin rule down the left edge of a page. */
.ml-page--margin { padding-left: 3.25rem; }
.ml-page--margin::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 2.5rem;
    width: 1px; background: var(--ml-margin-rule); opacity: 0.6;
}
/* Empty-state page — taller, content centred, so a blank journal reads like a
   full page rather than a short strip. */
.ml-page--blank {
    min-height: 60vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}

/* The shared dark footer is kept only for its JS bundle — hide it everywhere;
   Monolog renders its own light footer / band instead. */
body > footer.bg-dark { display: none !important; }

/* ==========================================================================
   Day heading + entry cards (timeline)
   ========================================================================== */
.ml-day-heading {
    font-family: var(--ml-font-hand); font-weight: 700;
    font-size: 1.9rem; color: var(--ml-ink);
    margin: 1.75rem 0 0.75rem; display: flex; align-items: baseline; gap: 0.75rem;
}
.ml-day-heading .count { font-family: var(--ml-font-body); font-size: 0.85rem; color: var(--ml-ink-soft); font-weight: 400; }

.ml-entry-card {
    background: var(--ml-paper-raised);
    border: 1px solid var(--ml-border);
    border-left: 3px solid var(--ml-ribbon);
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow-soft);
    padding: 1.1rem 1.35rem;
    margin-bottom: 1rem;
    transition: box-shadow var(--ml-transition), transform var(--ml-transition);
}
.ml-entry-card:hover { box-shadow: var(--ml-shadow-page); }
.ml-entry-card .title { font-weight: 600; font-size: 1.15rem; margin: 0 0 0.15rem; }
.ml-entry-card .title a { color: var(--ml-ink); text-decoration: none; }
.ml-entry-card .title a:hover { color: var(--ml-pen); }
.ml-entry-meta { color: var(--ml-ink-soft); font-size: 0.85rem; display: flex; gap: 0.85rem; flex-wrap: wrap; align-items: center; }
.ml-entry-excerpt { color: var(--ml-ink); margin: 0.5rem 0 0; }

/* ==========================================================================
   Ruled baseline grid — text rests ON the rule everywhere it appears.
   ONE unit (--ml-gline) drives line-height AND the rule period; every block
   margin is a multiple of it; a per-font --ml-grule places the rule under the
   baseline. Shared by the editor, the rendered prose, and the landing preview.
   ========================================================================== */
.ml-editor, .ml-prose, .ml-hero-paper {
    --ml-gfs: 1.05rem;                          /* grid font size */
    --ml-gline: calc(var(--ml-gfs) * 1.72);     /* line unit == rule period */
    --ml-grule: 0.72;                           /* baseline position within a line (per-font) */
    --ml-rule-buffer: 3px;                       /* clear gap below the text before the rule sits */
    --ml-ry: calc(var(--ml-grule) * var(--ml-gline) + var(--ml-rule-buffer));  /* rule Y within a line */
    font-size: var(--ml-gfs);
    line-height: var(--ml-gline);
    color: var(--ml-ink);
    background-image: linear-gradient(to bottom,
        transparent calc(var(--ml-ry) - 0.5px),
        var(--ml-ruled)  calc(var(--ml-ry) - 0.5px),
        var(--ml-ruled)  calc(var(--ml-ry) + 0.5px),
        transparent calc(var(--ml-ry) + 0.5px));
    background-size: 100% var(--ml-gline);
    background-position: 0 0;
    background-repeat: repeat;
}
/* Vertical rhythm — every block snaps to the line unit so nothing drifts. */
.ml-editor > :first-child, .ml-prose > :first-child, .ml-hero-paper > :first-child { margin-top: 0; }
.ml-editor p { margin: 0; }                  /* single-spaced writing — every line lands on a rule */
.ml-prose p { margin: 0 0 var(--ml-gline); } /* one blank ruled line between paragraphs when reading */
.ml-editor h1, .ml-prose h1 { font-size: 1.4rem; line-height: var(--ml-gline); margin: 0; font-weight: 600; }
.ml-editor h2, .ml-prose h2 { font-size: 1.2rem; line-height: var(--ml-gline); margin: 0; font-weight: 600; }
.ml-editor h3, .ml-prose h3 { font-size: 1.05rem; line-height: var(--ml-gline); margin: 0; font-weight: 600; }
.ml-editor ul, .ml-prose ul, .ml-editor ol, .ml-prose ol { margin: 0 0 var(--ml-gline); padding-left: 1.5rem; }
.ml-editor li, .ml-prose li { line-height: var(--ml-gline); margin: 0; }
.ml-editor blockquote, .ml-prose blockquote {
    line-height: var(--ml-gline); margin: 0 0 var(--ml-gline); padding: 0 0 0 1rem;
    border-left: 3px solid var(--ml-border-strong); color: var(--ml-ink-soft); font-style: italic;
}
.ml-editor hr, .ml-prose hr { border: 0; height: var(--ml-gline); margin: 0; position: relative; }
.ml-editor hr::after, .ml-prose hr::after {
    content: ""; position: absolute; left: 0; right: 0;
    top: calc(var(--ml-ry)); height: 1px; background: var(--ml-border-strong);
}
/* Prose draws only the lines over the page paper (no own fill, no top padding). */
.ml-prose { background-color: transparent; padding: 0; }

/* ==========================================================================
   Editor — the writing page
   ========================================================================== */
.ml-editor-shell { max-width: 760px; margin: 0 auto; }

.ml-editor-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }
/* date / mood / weather / location share the row equally, full width. */
.ml-editor-meta > .form-control { flex: 1 1 9rem; min-width: 8rem; width: auto; }
.ml-editor-meta--tags > .form-control { flex: 1 1 100%; }

/* Title written by hand */
.ml-title-input {
    width: 100%; border: 0; background: transparent;
    font-family: var(--ml-font-hand); font-weight: 700; font-size: 2.4rem;
    color: var(--ml-ink); line-height: 1.1; padding: 0.2rem 0;
    margin-bottom: 0.25rem;
}
.ml-title-input::placeholder { color: var(--ml-ink-faint); }
.ml-title-input:focus { outline: none; }

/* Sticky formatting toolbar */
.ml-editor-toolbar {
    position: sticky; top: 56px; z-index: 1020;
    display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center;
    background: var(--ml-paper-raised);
    border: 1px solid var(--ml-border); border-radius: var(--ml-radius);
    padding: 0.3rem; margin-bottom: 0.75rem;
    box-shadow: var(--ml-shadow-soft);
}
.ml-editor-toolbar button {
    border: 0; background: transparent; color: var(--ml-ink-soft);
    width: 34px; height: 32px; border-radius: var(--ml-radius-sm);
    font-size: 0.95rem; cursor: pointer; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--ml-transition), color var(--ml-transition);
}
.ml-editor-toolbar button:hover { background: var(--ml-paper-sunken); color: var(--ml-ink); }
.ml-editor-toolbar button.is-active { background: var(--ml-pen); color: var(--ml-on-pen); }
.ml-editor-toolbar .sep { width: 1px; height: 20px; background: var(--ml-border); margin: 0 0.25rem; }
.ml-editor-toolbar .label { font-weight: 700; font-family: var(--ml-font-body); }

/* The contenteditable page. Font + size come from per-user prefs; the ruled
   baseline grid above keeps every line of text on a rule. Paper ruling is a
   modifier (--ruled default / --dotted / --grid / --plain). padding-top is a
   whole line unit so the first line lands on the grid. */
.ml-editor {
    --ml-gfs: var(--ml-editor-size, 1.125rem);
    font-family: var(--ml-editor-font, var(--ml-font-body));
    min-height: 60vh;
    background-color: var(--ml-paper-raised);
    border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow-page);
    padding: var(--ml-gline) 2rem var(--ml-gline) 3.25rem;
    position: relative;
    outline: none;
}
/* Per-font baseline tuning — handwriting + Georgia sit differently in the line. */
.ml-editor[data-editor-font="Caveat"]  { --ml-grule: 0.62; }
.ml-editor[data-editor-font="Georgia"] { --ml-grule: 0.73; }
/* Paper styles override the ruled gradient from the shared grid. */
.ml-editor--plain { background-image: none; }
.ml-editor--dotted {
    background-image: radial-gradient(circle at center, var(--ml-ruled) 1.1px, transparent 1.5px);
    background-size: 1.6rem var(--ml-gline);
    background-position: 0.8rem calc(var(--ml-ry));
}
.ml-editor--grid {
    background-image:
        linear-gradient(to bottom, transparent calc(var(--ml-ry) - 0.5px), var(--ml-ruled) calc(var(--ml-ry) - 0.5px), var(--ml-ruled) calc(var(--ml-ry) + 0.5px), transparent calc(var(--ml-ry) + 0.5px)),
        linear-gradient(to right, transparent calc(1.6rem - 1px), var(--ml-ruled) calc(1.6rem - 1px), var(--ml-ruled) 1.6rem, transparent 1.6rem);
    background-size: 100% var(--ml-gline), 1.6rem var(--ml-gline);
    background-position: 0 0, 0.8rem 0;
}
.ml-editor::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 2.5rem; width: 1px;
    background: var(--ml-margin-rule); opacity: 0.55;
}
.ml-editor.is-empty::after {
    content: attr(data-placeholder);
    position: absolute; top: var(--ml-gline); left: 3.25rem; color: var(--ml-ink-faint);
    pointer-events: none; font-style: italic;
}
.ml-editor:focus { border-color: var(--ml-border-strong); }

.ml-editor-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 1rem; gap: 1rem; flex-wrap: wrap;
}
.ml-editor-foot .count { color: var(--ml-ink-soft); font-size: 0.9rem; }
.ml-kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem;
    background: var(--ml-paper-sunken); border: 1px solid var(--ml-border);
    border-radius: 3px; padding: 0.05rem 0.3rem; color: var(--ml-ink-soft);
}

/* ==========================================================================
   Calendar
   ========================================================================== */
.ml-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ml-cal-head h2 { font-family: var(--ml-font-hand); font-size: 2.1rem; margin: 0; }
.ml-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ml-cal-dow { text-align: center; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ml-ink-soft); padding-bottom: 0.25rem; }
.ml-cal-cell {
    aspect-ratio: 1 / 1; border: 1px solid var(--ml-border); border-radius: var(--ml-radius-sm);
    background: var(--ml-paper-raised); padding: 0.3rem 0.4rem; position: relative;
    display: flex; flex-direction: column; text-decoration: none; color: var(--ml-ink);
    transition: border-color var(--ml-transition), background var(--ml-transition);
}
a.ml-cal-cell:hover { border-color: var(--ml-pen); background: var(--ml-paper); }
.ml-cal-cell.is-empty { background: transparent; border-color: transparent; }
.ml-cal-cell.is-future { color: var(--ml-ink-faint); background: var(--ml-paper); }
.ml-cal-cell.is-today { border-color: var(--ml-ribbon); }
.ml-cal-cell.is-selected { background: var(--bs-primary-bg-subtle); border-color: var(--ml-pen); }
.ml-cal-cell .num { font-size: 0.9rem; font-weight: 600; }
.ml-cal-cell.is-today .num { color: var(--ml-ribbon); }
.ml-cal-dots { margin-top: auto; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.ml-cal-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ml-pen); }
.ml-cal-dots .more { font-size: 0.7rem; color: var(--ml-ink-soft); }

@media (max-width: 640px) {
    .ml-cal-cell { padding: 0.2rem 0.25rem; }
    .ml-cal-cell .num { font-size: 0.8rem; }
}

/* ==========================================================================
   Chips / tags / mood
   ========================================================================== */
.ml-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.1rem 0.55rem; border-radius: 999px;
    font-size: 0.8rem; border: 1px solid var(--ml-border-strong);
    color: var(--ml-ink-soft); text-decoration: none; background: var(--ml-paper);
}
.ml-chip:hover { color: var(--ml-ink); border-color: var(--ml-ink-soft); }
.ml-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ml-ink-soft); }

/* ==========================================================================
   On this day
   ========================================================================== */
.ml-onthisday {
    background: var(--ml-paper-sunken);
    border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius);
    padding: 1rem 1.25rem;
}
.ml-onthisday-chip {
    display: inline-flex; flex-direction: column; gap: 0.1rem;
    background: var(--ml-paper-raised); border: 1px solid var(--ml-border);
    border-left: 3px solid var(--ml-ribbon); border-radius: var(--ml-radius-sm);
    padding: 0.4rem 0.7rem; text-decoration: none; color: var(--ml-ink);
    max-width: 18rem; transition: border-color var(--ml-transition);
}
.ml-onthisday-chip:hover { border-color: var(--ml-pen); color: var(--ml-ink); }
.ml-onthisday-chip strong { color: var(--ml-ribbon); font-size: 0.9rem; }
.ml-onthisday-chip span { font-size: 0.85rem; color: var(--ml-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Public landing — full-bleed light splash
   ========================================================================== */
body.ml-public { background: var(--ml-paper); }

.ml-splash-nav {
    max-width: 1080px; margin: 0 auto; padding: 1.1rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
}
.ml-splash-nav .name { font-family: var(--ml-font-hand); font-weight: 700; font-size: 2rem; line-height: 1; color: var(--ml-ink); }
.ml-splash-nav .spacer { flex: 1; }
.ml-splash-nav a.nav { color: var(--ml-ink-soft); text-decoration: none; margin-left: 1rem; }
.ml-splash-nav a.nav:hover { color: var(--ml-ink); }

.ml-hero {
    max-width: 820px; margin: 2.5rem auto 1rem; padding: 0 1.5rem; text-align: center;
}
.ml-hero .kicker {
    font-family: var(--ml-font-hand); font-size: 1.5rem; color: var(--ml-ribbon);
}
.ml-hero h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); line-height: 1.1; margin: 0.4rem 0 1rem; font-weight: 600; }
.ml-hero h1 em { font-family: var(--ml-font-hand); font-style: normal; color: var(--ml-pen); }
.ml-hero p.lead { font-size: 1.2rem; color: var(--ml-ink-soft); max-width: 38rem; margin: 0 auto 1.6rem; }
.ml-hero-cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* The paper preview under the hero */
/* Landing preview — uses the shared ruled grid (background-COLOR only, so it
   doesn't reset the grid's background-image; padding-top is one line unit). */
.ml-hero-paper {
    max-width: 640px; margin: 2.5rem auto 0;
    padding: var(--ml-gline) 2rem var(--ml-gline) 3rem;
    background-color: var(--ml-paper-raised); border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius); box-shadow: var(--ml-shadow-page);
    position: relative; text-align: left;
}
.ml-hero-paper::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 2.1rem; width: 1px;
    background: var(--ml-margin-rule); opacity: 0.55;
}
.ml-hero-paper .date { font-family: var(--ml-font-hand); font-size: 1.6rem; line-height: var(--ml-gline); margin: 0; color: var(--ml-ink); }
.ml-hero-paper .line { margin: 0; }
.ml-hero-paper .line.dim { color: var(--ml-ink-soft); }

.ml-section { max-width: 1080px; margin: 3.5rem auto; padding: 0 1.5rem; }
.ml-section-head { text-align: center; max-width: 40rem; margin: 0 auto 2rem; }
.ml-section-head .kicker { font-family: var(--ml-font-hand); font-size: 1.4rem; color: var(--ml-ribbon); }
.ml-section-head h2 { font-size: 2rem; margin: 0.2rem 0 0.5rem; }
.ml-section-head p { color: var(--ml-ink-soft); }

.ml-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.ml-feature {
    background: var(--ml-paper-raised); border: 1px solid var(--ml-border);
    border-radius: var(--ml-radius); padding: 1.5rem; box-shadow: var(--ml-shadow-soft);
}
.ml-feature i { font-size: 1.4rem; color: var(--ml-pen); }
.ml-feature h3 { font-size: 1.15rem; margin: 0.6rem 0 0.3rem; }
.ml-feature p { color: var(--ml-ink-soft); margin: 0; font-size: 0.97rem; }

.ml-band-cta {
    text-align: center; background: var(--ml-paper-sunken);
    border-top: 1px solid var(--ml-border); border-bottom: 1px solid var(--ml-border);
    padding: 3rem 1.5rem;
}
.ml-band-cta h2 { font-size: 2rem; margin-bottom: 0.4rem; }
.ml-band-cta p { color: var(--ml-ink-soft); margin-bottom: 1.4rem; }

/* ==========================================================================
   Sign-in — split screen: a dark Moleskine "cover" + the light paper form
   ========================================================================== */
.ml-login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.ml-login-brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.ml-login-brand .name { font-family: var(--ml-font-hand); font-weight: 700; font-size: 1.9rem; color: var(--ml-ink); }
.ml-login-brand--sm { display: none; margin-bottom: 1.5rem; }

/* The whole cover is one ruled page: line-height == rule period, padding-top and
   the brand are sized to whole lines, so the brand + quote land on the full-panel
   rules. --crule places the rule just under the big-Caveat baseline. */
.ml-login-cover {
    --cl: 3.1rem;
    --crule: calc(var(--cl) * 0.68 + 3px);
    background-color: var(--ml-ink); color: var(--ml-on-pen);
    background-image: linear-gradient(to bottom,
        transparent calc(var(--crule) - 0.5px),
        rgba(255, 255, 255, 0.09) calc(var(--crule) - 0.5px),
        rgba(255, 255, 255, 0.09) calc(var(--crule) + 0.5px),
        transparent calc(var(--crule) + 0.5px));
    background-size: 100% var(--cl);
    background-position: 0 0;
    padding: var(--cl) 3rem;
    display: flex; flex-direction: column;
    line-height: var(--cl);
    position: relative; overflow: hidden;
}
/* brand occupies exactly one line cell so everything after it stays on the grid */
.ml-login-cover .ml-login-brand { height: var(--cl); align-items: center; margin: 0 0 calc(var(--cl) * 2); }
.ml-login-cover .ml-login-brand .name { color: #fff; line-height: 1; }
.ml-login-cover-body { position: relative; }
.ml-login-cover-body .quote {
    font-family: var(--ml-font-hand); font-weight: 700;
    font-size: 2.45rem; line-height: var(--cl);
    margin: 0; max-width: 15ch;
}
.ml-login-cover-body .by { color: rgba(255, 255, 255, 0.6); margin: 0; line-height: var(--cl); }
.ml-login-cover-foot { color: rgba(255, 255, 255, 0.5); margin: 0; margin-top: auto; position: relative; }

.ml-login-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--ml-paper); }
.ml-login-card { width: 100%; max-width: 23rem; }
.ml-login-card h1 { font-size: 2.6rem; margin: 0 0 0.15rem; }
.ml-login-alt { margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--ml-ink-soft); }

@media (max-width: 800px) {
    .ml-login { grid-template-columns: 1fr; }
    .ml-login-cover { display: none; }
    .ml-login-brand--sm { display: inline-flex; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    body { font-size: 1rem; }
    .ml-page { padding: 1.4rem 1.25rem; }
    .ml-page--margin { padding-left: 2.6rem; }
    .ml-page--margin::before { left: 1.9rem; }
    .ml-nav { gap: 0; }
    .ml-nav a:not(.btn) { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
    .ml-brand .name { font-size: 1.45rem; }
}
