/* MEMORIES JOURNAL - a private diary that writes itself back to you (D252).
   ===========================================================================
   ITS OWN STYLESHEET, AND IT LOADS NEITHER aios.css NOR receipts.css. The same
   measurement F149 and D194 already recorded: aios.css is half a megabyte of a
   three-column dashboard, four layout modes, a weather scene and a note editor,
   none of which exists here. Receipts is closer in spirit and still wrong -- it
   is a table and a scanner; this is a page somebody writes on.
   .
   WHAT IS SHARED IS THE PALETTE, COPIED BY VALUE from aios.css's :root, exactly
   as receipts.css copies it. Copied rather than imported because an @import is
   a second render-blocking request for a dozen declarations, and the products
   are meant to LOOK like family rather than track each other's every change.
   .
   THE ONE DELIBERATE DEPARTURE IS THE WRITING SURFACE. Everything else in this
   family is a console: mono labels, hard edges, cyan on near-black. A journal
   is read at length and written in at night, so the TEXT AREAS get a warmer
   ground, a longer line-height and a measure that stops around 68 characters.
   The chrome stays in the family; the paper does not. That is the one place
   this app is allowed to look unlike its siblings, and it is the place a person
   spends all their time.
   .
   NO WEBFONT AND NO EXTERNAL REQUEST OF ANY KIND, so this directory's CSP needs
   nothing but 'self' and the installed app renders identically with no network.
   .
   ONE BREAKPOINT, AT 780px. One column of cards either way; above it the day
   and the timeline can sit side by side. A second threshold would be a number
   nobody measured.
   =========================================================================== */

:root {
    --mj-bg: #050505;
    --mj-surface: #0f0f0f;
    --mj-surface-2: #151515;
    --mj-border: rgba(46, 230, 214, 0.25);
    --mj-border-soft: rgba(255, 255, 255, 0.09);
    --mj-text: #ffffff;
    --mj-muted: #a8a8a8;
    --mj-accent: #2ee6d6;
    --mj-accent-deep: #1a9fa1;
    --mj-warn: #ffc65c;
    --mj-danger: #ff4b5c;
    --mj-ok: #4fdc8b;
    --mj-radius: 12px;
    --mj-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);

    /* THE PAPER. Warmer and lighter than the chrome, because this is the only
       surface anybody reads a paragraph on. */
    --mj-paper: #12100e;
    --mj-paper-text: #f2ede4;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--mj-bg);
    color: var(--mj-text);
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}

/* [hidden] MUST WIN. Every class rule below that sets `display` would otherwise
   beat the user agent's [hidden] rule -- F60's trap, which has bitten this
   project five times and once showed an admin control to every account. */
[hidden] { display: none !important; }

a { color: var(--mj-accent); }

/* --- layout ------------------------------------------------------------ */
.mj-wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }

.mj-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--mj-border-soft);
    position: sticky; top: 0; background: var(--mj-bg); z-index: 20;
}
/* The brand takes the space the controls do not, and the controls keep their
   own size -- the flex-shrink lesson this stylesheet family has learned four
   times: a width on a flex item is a starting size, not a size. */
.mj-brand { flex: 1 1 auto; min-width: 0; font-weight: 700; letter-spacing: .04em; }
.mj-brand span { color: var(--mj-accent); }
.mj-bar-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.mj-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
@media (min-width: 780px) {
    .mj-cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

.mj-card {
    background: var(--mj-surface); border: 1px solid var(--mj-border-soft);
    border-radius: var(--mj-radius); padding: 16px;
}
.mj-card h2 {
    margin: 0 0 4px; font-size: 1.05rem; letter-spacing: .03em; text-transform: uppercase;
    color: var(--mj-accent);
}
.mj-card .mj-sub { margin: 0 0 14px; color: var(--mj-muted); font-size: .86rem; }

/* --- THE PAGE ------------------------------------------------------------
   The one place this app deliberately stops looking like its siblings. Every
   other surface in the AIOS family is a console -- mono labels, hard edges,
   cyan on near-black. A diary is read at length and written in at night, so
   the page gets a warmer ground, a longer line and a measure that stops around
   68 characters. The chrome stays in the family; the paper does not.

   AND IT IS ONE SURFACE, NOT A SET OF BOXES. The first version gave each
   section its own field and read as a form to fill in rather than a page to
   write on. */
.mj-day { display: flex; flex-direction: column; min-height: 0; }
.mj-day-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 10px;
}
.mj-day-head h2 { flex: 1 1 auto; min-width: 0; margin: 0; }
.mj-day-tools { display: flex; gap: 6px; flex: 0 0 auto; }

.mj-icon-btn {
    /* inline-flex, not block: a block control's height is a LINE BOX, and an
       emoji brings its own font's ascent and descent with it -- 36px in a box
       asking for 28, which no amount of padding takes back (lesson 79). */
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 34px; padding: 5px 11px;
    background: transparent; color: var(--mj-muted);
    border: 1px solid var(--mj-border-soft); border-radius: 8px;
    font: inherit; font-size: .8rem; cursor: pointer;
}
.mj-icon-btn:hover { color: var(--mj-text); border-color: var(--mj-border); }
.mj-icon-btn:focus-visible { outline: 2px solid var(--mj-accent); outline-offset: 2px; }
.mj-icon-btn[aria-pressed="true"] {
    background: rgba(46, 230, 214, 0.12); color: var(--mj-accent);
    border-color: var(--mj-border);
}

.mj-page {
    background: var(--mj-paper); color: var(--mj-paper-text);
    border: 1px solid var(--mj-border-soft); border-radius: 10px;
    padding: 20px 22px;
    /* 16px so iOS does not zoom the page when the caret lands. */
    font-size: 16px; line-height: 1.75;
    /* THE NOTE IS MARKDOWN AND WHITESPACE IS PART OF IT. `pre-wrap` keeps the
       user's blank lines and indentation exactly as typed -- without it the
       browser collapses runs of spaces and the file stops matching the screen,
       which is the one thing P1 forbids. */
    white-space: pre-wrap;
    word-break: break-word;
    /* A height the page divides rather than states, so the editor grows to the
       card and the card is what scrolls. */
    flex: 1 1 auto; min-height: 320px; max-height: 60vh;
}
.mj-page:focus-visible { outline: 2px solid var(--mj-accent); outline-offset: 2px; }
.mj-page:empty::before {
    content: "Write about today."; color: rgba(242, 237, 228, 0.3);
}

/* A picture inside the page. The wrapper is contentEditable=false, so the
   caret steps over it rather than into it. */
.mj-img-wrap { display: block; margin: 10px 0; }
.mj-img-wrap img {
    max-width: 100%; max-height: 320px; border-radius: 8px; display: block;
}

/* --- read mode ---------------------------------------------------------- */
.mj-read-h {
    margin: 18px 0 6px; color: var(--mj-accent); font-size: 1rem;
    letter-spacing: .02em;
}
.mj-read-h:first-child { margin-top: 0; }
.mj-read-p { margin: 0 0 10px; }
.mj-read-list { margin: 0 0 12px; padding-left: 20px; }
.mj-read-list li { margin-bottom: 4px; }
.mj-read-img { margin: 12px 0; }
.mj-read-img img { max-width: 100%; border-radius: 8px; display: block; }

/* --- controls ----------------------------------------------------------- */
.mj-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--mj-accent); background: transparent; color: var(--mj-accent);
    font: inherit; font-size: .86rem; font-weight: 600; letter-spacing: .04em;
    text-decoration: none;
    /* A tap target a fingertip can hit. 44px is what both platform guidelines
       set and what F66 measured going wrong at 32. */
    min-height: 44px;
}
.mj-btn:hover { background: rgba(46, 230, 214, 0.1); }
.mj-btn:focus-visible { outline: 2px solid var(--mj-accent); outline-offset: 3px; }
.mj-btn[disabled] { opacity: .45; cursor: default; }
.mj-btn-primary { background: var(--mj-accent); color: #04211f; }
.mj-btn-primary:hover { background: var(--mj-accent-deep); color: #04211f; }
.mj-btn-quiet { border-color: var(--mj-border-soft); color: var(--mj-muted); }
.mj-btn-quiet:hover { background: rgba(255,255,255,.05); }

.mj-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* A WRAPPING ROW THAT CANNOT SHRINK NEVER WRAPS (F76): it sizes to its content,
   grows past its parent, and draws its last buttons off the side of the screen
   with no document overflow to report it. Both declarations are needed. */
.mj-row > * { max-width: 100%; min-width: 0; }

.mj-msg { min-height: 1.2em; font-size: .85rem; color: var(--mj-muted); margin: 8px 0 0; }
.mj-msg-ok { color: var(--mj-ok); }
.mj-msg-err { color: var(--mj-danger); }
.mj-msg-warn { color: var(--mj-warn); }

/* --- the timeline ------------------------------------------------------- */
.mj-feed { display: flex; flex-direction: column; gap: 12px; }
.mj-post {
    border: 1px solid var(--mj-border-soft); border-radius: 10px;
    padding: 12px 14px; background: var(--mj-surface-2);
}
.mj-post h3 { margin: 0 0 4px; font-size: .95rem; }
.mj-post .mj-post-line { margin: 0; color: var(--mj-muted); font-size: .88rem; }
.mj-post-photos { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mj-post-photos img {
    width: 74px; height: 74px; object-fit: cover; border-radius: 8px;
    max-width: 100%;
}
.mj-empty { color: var(--mj-muted); font-size: .9rem; }

/* --- settings ----------------------------------------------------------- */
.mj-choice { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.mj-choice label {
    display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
    text-transform: none; letter-spacing: 0; color: var(--mj-text); font-size: .92rem;
    margin: 0;
}
.mj-choice input { margin-top: 4px; flex: 0 0 auto; accent-color: var(--mj-accent); }
.mj-choice .mj-choice-why { display: block; color: var(--mj-muted); font-size: .82rem; }

.mj-custom-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.mj-custom-row { display: flex; gap: 8px; align-items: center; }
.mj-input {
    flex: 1 1 auto; min-width: 0;
    background: var(--mj-surface-2); color: var(--mj-text);
    border: 1px solid var(--mj-border-soft); border-radius: 8px;
    padding: 9px 12px; font: inherit; font-size: 16px;
}
.mj-input:focus-visible { outline: 2px solid var(--mj-accent); outline-offset: 2px; }

/* --- the trial banner --------------------------------------------------- */
.mj-banner {
    border: 1px solid var(--mj-border); border-radius: var(--mj-radius);
    background: rgba(46, 230, 214, 0.06); padding: 12px 14px; margin-top: 16px;
    font-size: .9rem;
}
.mj-banner-warn { border-color: var(--mj-warn); background: rgba(255, 198, 92, 0.08); }
.mj-banner strong { color: var(--mj-accent); }
.mj-banner-warn strong { color: var(--mj-warn); }

/* --- scrollbars, one everywhere (F66) ----------------------------------- */
.mj-scroll { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
             scrollbar-color: var(--mj-accent-deep) transparent; }
.mj-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.mj-scroll::-webkit-scrollbar-thumb {
    background: var(--mj-accent-deep); border-radius: 8px;
}
.mj-scroll::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}


/* ===========================================================================
   THE SIGN-IN SCREEN, AND WHY EVERY RULE BELOW IS SCOPED TO body.mj-auth-body
   ===========================================================================
   These are receipts.css's auth rules, renamed. Ported rather than shared
   because the two apps deliberately load no stylesheet in common -- see the top
   of this file -- and ported rather than rewritten because a sign-in screen is
   the one surface where looking like the rest of the family is the whole job.

   THE SCOPE IS NOT TIDINESS. Two class names collide with the app's own:
   `.mj-wrap` and `.mj-brand` mean something here and something else in
   app.html, and these rules come LATER in the file, so unscoped they would
   silently take `max-width` and `padding` from the app's page wrapper. That is
   the F112 family in its quietest form -- both rules valid, both applying, one
   declaration changing hands -- and it would have shown up as the app's bottom
   padding vanishing, which nobody would have connected to the login page.

   `body.mj-auth-body` is (0,2,1) and login.html carries the class, so every
   rule below applies exactly where it is meant to and nowhere else.
   =========================================================================== */
body.mj-auth-body .mj-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
body.mj-auth-body .mj-mark {
    display: inline-flex; flex-direction: column; align-items: center;
    justify-content: center;
    width: 44px; height: 44px; flex: 0 0 auto;
    border-radius: 11px;
    background: radial-gradient(circle at 30% 20%, #2ee6d6 0%, #1a9fa1 55%, #0b3b3c 100%);
    color: #fff; font-weight: 800; letter-spacing: 0.02em;
    line-height: 1; text-decoration: none;
}
body.mj-auth-body .mj-mark span:first-child { font-size: 12px; }
body.mj-auth-body .mj-mark span:last-child { font-size: 11px; }
body.mj-auth-body .mj-mark,
body.mj-auth-body .mj-brand-text { flex: 0 0 auto; }
body.mj-auth-body .mj-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
body.mj-auth-body .mj-brand-text { display: flex; flex-direction: column; }
body.mj-auth-body .mj-brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
body.mj-auth-body .mj-brand-sub { font-size: 11px; color: var(--mj-muted); letter-spacing: 0.06em; text-transform: uppercase; }
body.mj-auth-body .mj-topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(5, 5, 5, 0.96);
    border-bottom: 1px solid var(--mj-border-soft);
}
body.mj-auth-body .mj-topbar-inner {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px 20px; max-width: 1120px; margin: 0 auto;
}
body.mj-auth-body .mj-topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
body.mj-auth-body .mj-topnav a { font-size: 13px; text-decoration: none; padding: 8px 10px; border-radius: 8px; color: var(--mj-muted); }
body.mj-auth-body .mj-topnav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
body.mj-auth-body .mj-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    
    min-height: 44px; padding: 10px 18px;
    border-radius: 10px; border: 1px solid var(--mj-border);
    background: transparent; color: var(--mj-accent);
    font: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
    text-decoration: none; cursor: pointer;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}
body.mj-auth-body .mj-btn:hover { background: rgba(46, 230, 214, 0.12); color: #fff; }
body.mj-auth-body .mj-btn:focus-visible { outline: 2px solid var(--mj-accent); outline-offset: 2px; }
body.mj-auth-body .mj-btn-primary {
    background: linear-gradient(135deg, var(--mj-accent), var(--mj-accent-deep));
    color: #041312; border-color: transparent;
}
body.mj-auth-body .mj-btn-primary:hover { color: #000; filter: brightness(1.08); }
body.mj-auth-body .mj-btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12.5px; }
body.mj-auth-body .mj-btn-danger { color: var(--mj-danger); border-color: rgba(255, 75, 92, 0.4); }
body.mj-auth-body .mj-btn-danger:hover { background: rgba(255, 75, 92, 0.14); color: #fff; }
body.mj-auth-body .mj-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
body.mj-auth-body .mj-btn[disabled]:hover { background: transparent; color: var(--mj-accent); }
body.mj-auth-body .mj-card {
    background: linear-gradient(145deg, var(--mj-surface-2), var(--mj-surface));
    border: 1px solid var(--mj-border-soft);
    border-radius: var(--mj-radius);
    padding: 18px;
}
body.mj-auth-body .mj-card h3 { color: var(--mj-accent); }
body.mj-auth-body .mj-card p:last-child { margin-bottom: 0; }
body.mj-auth-body .mj-card-icon { display: block; margin-bottom: 10px; }
body.mj-auth-body .mj-table td.mj-wrap-cell { white-space: normal; min-width: 200px; }
body.mj-auth-body .mj-field { margin-bottom: 14px; }
body.mj-auth-body .mj-field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
body.mj-auth-body .mj-hint { font-size: 12px; color: var(--mj-muted); margin-top: 5px; text-transform: none; letter-spacing: 0; }
body.mj-auth-body .mj-msg { min-height: 20px; font-size: 13px; margin: 8px 0; }
body.mj-auth-body .mj-msg-ok { color: var(--mj-ok); }
body.mj-auth-body .mj-msg-warn { color: var(--mj-warn); }
body.mj-auth-body .mj-msg-err { color: var(--mj-danger); }
body.mj-auth-body .mj-promo {
    border: 1px solid var(--mj-border);
    background: linear-gradient(135deg, rgba(46, 230, 214, 0.10), rgba(26, 159, 161, 0.04));
    border-radius: var(--mj-radius); padding: 16px 18px;
}
body.mj-auth-body .mj-promo h3 { color: var(--mj-accent); margin-bottom: 6px; }
body.mj-auth-body .mj-promo p { color: var(--mj-muted); font-size: 13.5px; }
body.mj-auth-body .mj-promo p:last-of-type { margin-bottom: 12px; }
body.mj-auth-body .mj-footer { border-top: 1px solid var(--mj-border-soft); padding: 28px 0 40px; color: var(--mj-muted); font-size: 13px; }
body.mj-auth-body .mj-footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
body.mj-auth-body { min-height: 100dvh; display: flex; flex-direction: column; }
body.mj-auth-body .mj-auth-main { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 28px 20px 60px; }
body.mj-auth-body .mj-auth-card { width: 100%; max-width: 430px; }
body.mj-auth-body .mj-auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
body.mj-auth-body .mj-auth-tabs .mj-btn { flex: 1 1 0; }
body.mj-auth-body .mj-auth-tabs .mj-btn[aria-selected="true"] { background: rgba(46, 230, 214, 0.14); color: #fff; }
body.mj-auth-body .mj-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
body.mj-auth-body .mj-skip {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--mj-accent); color: #041312; padding: 10px 14px;
    border-radius: 0 0 8px 0; font-weight: 600;
}
body.mj-auth-body .mj-skip:focus { left: 0; }
body.mj-auth-body .mj-trial .mj-btn { margin-left: auto; }
