/* look.css: shared chrome for the six "looks" of multify.co.
   Loaded BEFORE each look's own stylesheet (lpN.css) so a look can override
   anything here. Everything is written against the --mf-* bridge tokens that
   every lpN.css declares on :root (see the "look chrome" block at the end of
   each one). Defaults below are only a safety net. Pieces:
     1. bridge token defaults
     2. header: palette button + "why this exists" button
     3. "Choose your experience" dialog (built by look.js)
     4. look faces: the six self-coloured tiles/cards
     5. in-page "Pick your look" cards
     6. "why this exists" modal base styles (lp3.css restyles it fully) */

/* ===== 1. bridge tokens ===== */
:root {
    --mf-surface: #ffffff;        /* dialog / modal background */
    --mf-ink: #141414;            /* text on --mf-surface */
    --mf-muted: #666666;
    --mf-line: #141414;           /* outline colour for cards, dialog, buttons */
    --mf-hairline: rgba(0, 0, 0, 0.15);
    --mf-bw: 1px;                 /* outline width */
    --mf-radius: 16px;
    --mf-pill: 999px;
    --mf-shadow: none;            /* offset shadow, e.g. 6px 6px 0 var(--ink) */
    --mf-shadow-sm: none;
    --mf-accent: #141414;         /* primary button background */
    --mf-accent-ink: #ffffff;     /* primary button text */
    --mf-backdrop: rgba(0, 0, 0, 0.6);
    --mf-tilt: 0;                 /* 1 = cards get their playful rotation */
}

/* ===== 2. header controls ===== */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.header-why {
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.header-why .why-short { display: none; }

.mf-palette {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    flex: none;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    box-shadow: var(--mf-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.15s ease;
}

.mf-palette svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    display: block;
}

.mf-palette:hover { transform: translateY(-1px); }
.mf-palette:focus-visible,
.header-why:focus-visible,
.look-card:focus-visible,
.mf-tile:focus-visible,
.mf-look-keep:focus-visible,
.mf-look-close:focus-visible {
    outline: 3px solid var(--mf-accent);
    outline-offset: 2px;
}

/* ===== 3. chooser dialog ===== */
.mf-look-dialog {
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-radius);
    background: var(--mf-surface);
    color: var(--mf-ink);
    box-shadow: var(--mf-shadow);
    padding: 0;
    width: min(960px, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    overflow: hidden;
}

.mf-look-dialog::backdrop { background: var(--mf-backdrop); }

.mf-look-inner {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 2rem);
    position: relative;
}

.mf-look-head {
    padding: 1.75rem 2rem 0.75rem;
    padding-right: 4.5rem;
}

.mf-look-head h2 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.mf-look-head p {
    margin: 0;
    color: var(--mf-muted);
    max-width: 44rem;
}

.mf-look-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 2rem 1.5rem;
    overscroll-behavior: contain;
}

.mf-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0.25rem;
}

.mf-tile {
    display: block;
    width: 100%;
    min-height: 44px;
    text-align: left;
    font: inherit;
    cursor: pointer;
    position: relative;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-radius);
    padding: 1.1rem 1rem 1rem;
    min-width: 0;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mf-tile:hover { transform: translateY(-2px); }

.mf-tile[aria-checked="true"] {
    box-shadow: 0 0 0 3px var(--mf-surface), 0 0 0 6px var(--mf-accent);
}

.mf-look-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem 1.5rem;
    border-top: var(--mf-bw) solid var(--mf-hairline);
}

.mf-look-foot p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--mf-muted);
}

.mf-look-keep {
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    background: var(--mf-accent);
    color: var(--mf-accent-ink);
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-pill);
    padding: 0.7rem 1.4rem;
    min-height: 44px;
    box-shadow: var(--mf-shadow-sm);
    white-space: nowrap;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.mf-look-keep:hover { transform: translateY(-1px); }

.mf-look-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: 50%;
    background: transparent;
    box-shadow: var(--mf-shadow-sm);
    z-index: 1;
}

/* ===== 4. look faces (shared by dialog tiles and in-page cards) =====
   Each face wears its own theme regardless of the host look. Display fonts
   are system stand-ins so the chooser never triggers extra font downloads. */
.mf-lookface {
    --face-muted: inherit;
    --face-font: inherit;
    --face-tt: none;
    --face-ls: 0;
    --face-fw: 800;
}

.mf-lookface h3 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    line-height: 1.2;
    font-family: var(--face-font);
    font-weight: var(--face-fw);
    text-transform: var(--face-tt);
    letter-spacing: var(--face-ls);
}

.mf-lookface p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 600;
    color: var(--face-muted);
}

.mf-lookface .dots {
    display: flex;
    gap: 5px;
    margin-bottom: 0.75rem;
}

.mf-lookface .dots i {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: block;
}

.mf-lookface .mf-current {
    display: none;
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 2px solid currentColor;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    line-height: 1.3;
}

.mf-lookface[aria-checked="true"] .mf-current,
.mf-lookface[aria-pressed="true"] .mf-current { display: inline-block; }

.mf-lookface[data-look-pick="lp1"] {
    background: #FAF6EE;
    color: #141414;
    --face-muted: #5C574B;
    --face-font: Georgia, 'Times New Roman', serif;
    --face-tt: uppercase;
    --face-ls: 0.02em;
    --face-fw: 700;
}

.mf-lookface[data-look-pick="lp2"] {
    background: #FFFBF0;
    color: #2B2622;
    --face-muted: #6E655A;
    --face-font: Georgia, serif;
    --face-fw: 900;
}

.mf-lookface[data-look-pick="lp3"] {
    background: #FFC931;
    color: #141414;
    --face-font: 'Fredoka', 'Nunito', system-ui, sans-serif;
    --face-fw: 700;
}

.mf-lookface[data-look-pick="lp4"] {
    background: #0A0C0A;
    color: #B6FF2E;
    --face-muted: #7C857A;
    --face-font: ui-monospace, SFMono-Regular, Menlo, monospace;
    --face-tt: uppercase;
    --face-ls: 0.04em;
    --face-fw: 700;
}

.mf-lookface[data-look-pick="lp6"] {
    background: #000000;
    color: #E7E9EA;
    --face-muted: #71767B;
    --face-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

.mf-lookface[data-look-pick="lp7"] {
    background: #FFFFFF;
    color: #0F1419;
    --face-muted: #536471;
    --face-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ===== 5. in-page "Pick your look" cards ===== */
.looks-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.looks-grid li { min-width: 0; --r: 0deg; }
.looks-grid li:nth-child(1) { --r: -1deg; }
.looks-grid li:nth-child(2) { --r: 1.2deg; }
.looks-grid li:nth-child(3) { --r: -1.5deg; }
.looks-grid li:nth-child(4) { --r: 1deg; }
.looks-grid li:nth-child(5) { --r: -0.8deg; }
.looks-grid li:nth-child(6) { --r: 0.8deg; }

.look-card {
    display: block;
    width: 100%;
    height: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    position: relative;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-radius);
    box-shadow: var(--mf-shadow);
    padding: 1.4rem 1.25rem;
    min-width: 0;
    transform: rotate(calc(var(--r) * var(--mf-tilt)));
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.look-card:hover {
    transform: translate(-2px, -2px) rotate(calc(var(--r) * var(--mf-tilt)));
}

.look-card .mf-current { top: 0.9rem; right: 0.9rem; }

/* ===== 6. "why this exists" modal (base) ===== */
.why-modal {
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-radius);
    box-shadow: var(--mf-shadow);
    background: var(--mf-surface);
    color: var(--mf-ink);
    padding: 0;
    width: min(640px, calc(100vw - 3rem));
    max-height: calc(100dvh - 5rem);
    margin: auto;
    overflow: hidden;
}

.why-modal::backdrop { background: var(--mf-backdrop); }

.why-inner {
    position: relative;
    padding: 2.5rem 2.5rem 2.25rem;
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
}

.why-inner h2 {
    font-size: clamp(1.9rem, 4.5vw, 2.6rem);
    margin: 0 0 1.1rem;
    padding-right: 3rem;
}

.why-tilt { display: inline-block; color: var(--mf-accent); }

.why-inner p { margin: 0 0 1rem; }
.why-inner p:last-child { margin-bottom: 0; }
.why-inner a { color: inherit; }

.why-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: 50%;
    background: transparent;
    z-index: 1;
}

.why-sticker { display: none; }

/* ===== 7. copy widgets =====
   .mf-verb: the rotating like / heart / bookmark / save icons in the
   "Your profile based on what you ..." heading. Four icons, 8s loop, 2s each. */
.mf-verb {
    display: inline-grid;
    width: 1em;
    height: 1em;
    vertical-align: -0.08em;
}

.mf-verb svg {
    grid-area: 1 / 1;
    width: 1em;
    height: 1em;
    fill: currentColor;
    opacity: 0;
    animation: mf-verb 8s infinite;
}

.mf-verb svg:nth-child(2) { animation-delay: 2s; }
.mf-verb svg:nth-child(3) { animation-delay: 4s; }
.mf-verb svg:nth-child(4) { animation-delay: 6s; }

@keyframes mf-verb {
    0%   { opacity: 0; transform: translateY(0.35em) scale(0.8); }
    6%   { opacity: 1; transform: translateY(0) scale(1); }
    22%  { opacity: 1; transform: translateY(0) scale(1); }
    27%  { opacity: 0; transform: translateY(-0.35em) scale(0.8); }
    100% { opacity: 0; transform: translateY(-0.35em) scale(0.8); }
}

/* icons inside the "right-click / paste / text" chips */
.fallback-chip svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.125em;
    margin-right: 0.45em;
}

/* ===== 8. "Never lose a link again" (search + MCP) section ===== */
.recall-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.recall-card {
    min-width: 0;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-radius);
    background: var(--mf-surface);
    color: var(--mf-ink);
    box-shadow: var(--mf-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.recall-label {
    margin: 0 0 1rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mf-muted);
}

.recall-input {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: var(--mf-bw) solid var(--mf-line);
    border-radius: var(--mf-pill);
    padding: 0.6rem 1rem;
    font-weight: 700;
}

.recall-input svg { width: 1em; height: 1em; flex: none; opacity: 0.7; }

.recall-caret {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: currentColor;
    animation: mf-blink 1.1s steps(1) infinite;
}

@keyframes mf-blink { 50% { opacity: 0; } }

.recall-hit {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.9rem;
    padding: 0.75rem 0.9rem;
    border: var(--mf-bw) solid var(--mf-hairline);
    border-radius: calc(var(--mf-radius) * 0.6);
}

.recall-hit-src {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--mf-hairline);
    border-radius: 50%;
}

.recall-hit-src svg { width: 16px; height: 16px; }

.recall-hit-title { margin: 0; font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.recall-hit-meta { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--mf-muted); }

.recall-chat { display: flex; flex-direction: column; gap: 0.6rem; }

.recall-msg {
    margin: 0;
    padding: 0.7rem 0.95rem;
    border-radius: calc(var(--mf-radius) * 0.8);
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 92%;
}

.recall-msg.user {
    align-self: flex-end;
    background: var(--mf-accent);
    color: var(--mf-accent-ink);
    border: var(--mf-bw) solid var(--mf-line);
}

.recall-msg.ai {
    align-self: flex-start;
    border: var(--mf-bw) solid var(--mf-hairline);
}

.recall-note { margin: 1rem 0 0; font-size: 0.85rem; color: var(--mf-muted); }
.recall-note a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.recall-card .recall-note:last-child { margin-top: auto; padding-top: 1rem; }

.recall-tools {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.recall-tools li { display: inline-flex; align-items: center; gap: 0.4rem; }
.recall-tools svg { width: 18px; height: 18px; flex: none; }

/* ===== responsive ===== */
@media (max-width: 991px) {
    .looks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .recall-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 575px) {
    .mf-look-dialog {
        width: 100vw;
        max-width: 100vw;
        margin: auto 0 0;
        max-height: 94dvh;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-radius: var(--mf-radius) var(--mf-radius) 0 0;
        box-shadow: none;
    }

    .mf-look-inner { max-height: 94dvh; }
    .mf-look-head { padding: 1.25rem 1.25rem 0.5rem; padding-right: 4rem; }
    .mf-look-body { padding: 0.5rem 1.25rem 1rem; }
    .mf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .mf-tile { padding: 0.9rem 0.85rem 0.85rem; }
    .mf-lookface h3 { font-size: 1rem; }
    .mf-lookface p { font-size: 0.82rem; }
    .mf-lookface .dots i { width: 12px; height: 12px; }

    .mf-look-foot {
        padding: 0.85rem 1.25rem calc(1rem + env(safe-area-inset-bottom));
        flex-direction: column-reverse;
        align-items: stretch;
        text-align: center;
    }

    .mf-look-keep { width: 100%; }

    .looks-grid { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }

    .why-modal {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        inset: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .why-inner {
        max-height: 100dvh;
        padding: 2rem 1.5rem calc(2.5rem + env(safe-area-inset-bottom));
    }

    .why-close { position: fixed; top: 1rem; right: 1rem; }

    .header-nav { gap: 0.5rem; }
    .mf-palette { width: 34px; height: 34px; }
    .mf-palette svg { width: 18px; height: 18px; }
}

@media (max-width: 430px) {
    .header-why .why-long { display: none; }
    .header-why .why-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
    .mf-verb svg { animation: none; }
    .recall-caret { animation: none; }
    .mf-verb svg:nth-child(2) { opacity: 1; }
    .mf-palette, .mf-tile, .look-card, .mf-look-keep { transition: none; }
    .mf-tile:hover, .mf-palette:hover, .mf-look-keep:hover { transform: none; }
    .look-card:hover { transform: rotate(calc(var(--r) * var(--mf-tilt))); }
}
