/*
 * A pal's profile (/pals/{id}) and diary day (/pals/{id}/diary/{dayId}), drawn like the phone's
 * CharacterProfileComposable, PhotoViewComposable and the diary composables (the Day tab's rules
 * left with the tab on 5 Nov 2026: disabled-features/pal-day-tab/). Colours are the shared --md-* roles from web-app.css; the few phone
 * roles that file doesn't have (status colours, surfaceVariant, onBackground, tertiary, the story
 * ring) are defined below with the phone's values. Also loaded on every signed-in page, so the
 * profile placeholder (the same boxes as this file) is already styled before the screen arrives.
 */

/* the phone's diary handwriting (composeResources/font), one face per pal */
@font-face { font-family: "Patrick Hand"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/patrick-hand-regular.woff) format("woff"); }
@font-face { font-family: "Gochi Hand"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/gochi-hand-regular.woff) format("woff"); }
@font-face { font-family: "Architects Daughter"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/architects-daughter-regular.woff) format("woff"); }
@font-face { font-family: "Kalam"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/kalam-regular.woff) format("woff"); }
@font-face { font-family: "Kalam"; font-weight: 700; font-display: swap; src: url(/static/fonts/diary/kalam-bold.woff) format("woff"); }
@font-face { font-family: "Indie Flower"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/indie-flower-regular.woff) format("woff"); }
@font-face { font-family: "Satisfy"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/satisfy-regular.woff) format("woff"); }
@font-face { font-family: "Shadows Into Light"; font-weight: 400; font-display: swap; src: url(/static/fonts/diary/shadows-into-light-regular.woff) format("woff"); }

.wa-pal-hand-patrick-hand { font-family: "Patrick Hand", "Comic Sans MS", cursive; }
.wa-pal-hand-gochi-hand { font-family: "Gochi Hand", "Comic Sans MS", cursive; }
.wa-pal-hand-architects-daughter { font-family: "Architects Daughter", "Comic Sans MS", cursive; }
.wa-pal-hand-kalam { font-family: "Kalam", "Comic Sans MS", cursive; }
.wa-pal-hand-indie-flower { font-family: "Indie Flower", "Comic Sans MS", cursive; }
.wa-pal-hand-satisfy { font-family: "Satisfy", "Comic Sans MS", cursive; }
.wa-pal-hand-shadows-into-light { font-family: "Shadows Into Light", "Comic Sans MS", cursive; }

:root {
    /* phone roles web-app.css doesn't define (design/theme/Color.kt), light */
    --wa-pal-surface-variant: #666666;
    --wa-pal-on-background: #AAAAAA;
    --wa-pal-tertiary: #984061;
    --wa-pal-on-success-container: #005E04;
    --wa-pal-warning: #F59E0B;
    --wa-pal-on-warning-container: #92400E;
    --wa-pal-story-ring: linear-gradient(135deg, #F77737, #E1306C, #833AB4);
    --wa-pal-viewer-chrome: #383838;
    --wa-pal-on-viewer-chrome: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --wa-pal-surface-variant: #B3B3B3;
        --wa-pal-on-background: #555555;
        --wa-pal-tertiary: #F5E6EB;
        --wa-pal-on-success-container: #A5D6A7;
        --wa-pal-warning: #FFCA28;
        --wa-pal-on-warning-container: #FFE082;
    }
}
:root[data-theme="dark"] {
    --wa-pal-surface-variant: #B3B3B3;
    --wa-pal-on-background: #555555;
    --wa-pal-tertiary: #F5E6EB;
    --wa-pal-on-success-container: #A5D6A7;
    --wa-pal-warning: #FFCA28;
    --wa-pal-on-warning-container: #FFE082;
}

/* ==================== profile screen: header, tab row, one scrolling panel per tab ==================== */

.wa-pal-profile {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--md-background);
    color: var(--md-on-surface);
}
.wa-pal-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: var(--md-background);
}
.wa-pal-profile-header-start { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wa-pal-profile-header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.wa-pal-profile-header .wa-floating-title-pill { min-width: 0; }

/* the phone's SecondaryScrollableTabRow: 16 px edge padding, onSurface underline, divider below */
.wa-pal-profile-tabs {
    display: flex;
    flex: none;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 16px;
    background: var(--md-background);
    border-bottom: 1px solid var(--md-outline-variant);
}
.wa-pal-profile-tabs::-webkit-scrollbar { display: none; }
.wa-pal-profile-tab {
    position: relative;
    flex: none;
    min-width: 90px;
    height: 48px;
    padding: 0 16px;
    border: 0;
    background: transparent;
    color: color-mix(in srgb, var(--md-on-surface) 50%, transparent);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 500;
    line-height: calc(16px * var(--wa-text-scale, 1));
    cursor: pointer;
}
.wa-pal-profile-tab.is-selected { color: var(--md-on-surface); }
.wa-pal-profile-tab.is-selected::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--md-on-surface);
}
.wa-pal-profile-tab:hover { background: var(--md-surface-container-low); }

.wa-pal-profile-panels { position: relative; flex: 1; min-height: 0; }
.wa-pal-profile-panel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--md-background);
}
.wa-pal-profile-panel[hidden] { display: none; }
.wa-pal-profile-panel-body { max-width: 720px; margin: 0 auto; padding-bottom: calc(48px + var(--wa-bottom-inset)); }

/* "No diary entries yet" (the phone's DrawNoContentAvailable) */
.wa-pal-no-content {
    min-height: 60dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
}
.wa-pal-no-content-icon .wa-icon svg { width: 48px; height: 48px; color: var(--md-on-surface-variant); }
.wa-pal-no-content-title { margin: 0; font-size: calc(18px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-pal-no-content-message { margin: 0; font-size: calc(14px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); max-width: 320px; }

.wa-pal-list-loader { display: flex; justify-content: center; padding: 12px 0; }

/* ==================== About, Personality, Appearance, Background, Food ==================== */

.wa-pal-hero {
    position: relative;
    display: block;
    width: 100%;
    height: min(400px, 62dvh);
    padding: 0;
    border: 0;
    background: var(--md-surface-container-highest);
    cursor: pointer;
    overflow: hidden;
}
.wa-pal-hero.is-loading { cursor: default; animation: wa-loading-look-pulse 1s linear infinite alternate; }
.wa-pal-hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.wa-pal-hero-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 96px;
    background: linear-gradient(to bottom, transparent, #000);
    pointer-events: none;
}
.wa-pal-name-block { padding: 12px 16px; }
.wa-pal-name { margin: 0; font-size: calc(30px * var(--wa-text-scale, 1)); line-height: 1.1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-pal-profession { margin: 4px 0 0; font-size: calc(16px * var(--wa-text-scale, 1)); line-height: calc(24px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }

/* the phone's ProfileSection + ProfileFieldRow (pal version) */
.wa-pal-field-section { padding: 16px 16px 0; }
.wa-pal-field-section-title { margin: 0 0 8px; font-size: calc(16px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-pal-field-card { border-radius: 12px; background: var(--md-inverse-on-surface); overflow: hidden; }
.wa-pal-field-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.wa-pal-field-row + .wa-pal-field-row { border-top: 1px solid var(--md-outline-variant); }
.wa-pal-field-icon {
    width: 32px;
    height: 32px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--wa-pal-on-background);
    color: var(--md-on-surface);
}
.wa-pal-field-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wa-pal-field-label { font-size: calc(12px * var(--wa-text-scale, 1)); line-height: calc(16px * var(--wa-text-scale, 1)); font-weight: 500; color: var(--wa-pal-surface-variant); }
.wa-pal-field-value { font-size: calc(16px * var(--wa-text-scale, 1)); line-height: calc(24px * var(--wa-text-scale, 1)); color: var(--md-on-surface); overflow-wrap: anywhere; }
.wa-pal-field-value--not-set { color: var(--md-on-surface-variant); }

/* the phone's ProfileTextCard and AppearanceCard */
.wa-pal-text-card-block { padding: 16px 16px 0; }
.wa-pal-text-card-title { margin: 0 0 8px; font-size: calc(16px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-pal-text-card { border-radius: 12px; background: var(--md-inverse-on-surface); padding: 16px; }
.wa-pal-text-card--rows { padding: 0; }
.wa-pal-text-card-body { margin: 0; font-size: calc(14px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); white-space: pre-line; }
.wa-pal-appearance-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.wa-pal-appearance-row + .wa-pal-appearance-row { border-top: 1px solid var(--md-outline-variant); margin: 0 16px; padding: 12px 0; }
.wa-pal-appearance-icon { color: var(--md-on-surface-variant); }
.wa-pal-appearance-icon svg { width: 24px; height: 24px; }
.wa-pal-appearance-text { margin: 0; font-size: calc(14px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); white-space: pre-wrap; }

/* ==================== full-screen photo viewer (hero photo, a quoted Day photo) ==================== */

.wa-pal-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: #000;
    color: #FFFFFF;
    animation: wa-pal-fade-in 180ms ease-out;
}
@keyframes wa-pal-fade-in { from { opacity: 0; } }
.wa-pal-photo-viewer { display: flex; align-items: center; justify-content: center; }
.wa-pal-photo-viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; }

.wa-pal-day-viewer-close,
.wa-pal-day-viewer-download {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    z-index: 3;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--wa-pal-viewer-chrome);
    color: var(--wa-pal-on-viewer-chrome);
    cursor: pointer;
}
.wa-pal-day-viewer-close { right: 16px; }
.wa-pal-day-viewer-download { left: 16px; }
.wa-pal-day-viewer-download[hidden] { display: none; }

/* ==================== small sheets (the diary's privacy sheet) ==================== */

.wa-pal-info-sheet { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 4px 12px; }
.wa-pal-info-sheet-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--md-inverse-on-surface);
    color: var(--md-on-surface);
}
.wa-pal-info-sheet-icon--large { width: 64px; height: 64px; background: transparent; color: var(--md-on-surface-variant); }
.wa-pal-info-sheet-icon--large svg { width: 64px; height: 64px; }
.wa-pal-info-sheet-title { margin: 16px 0 0; font-size: calc(18px * var(--wa-text-scale, 1)); line-height: calc(24px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-pal-info-sheet-title--large { margin-top: 20px; font-weight: 700; }
.wa-pal-info-sheet-body { margin: 8px 0 0; font-size: calc(14px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); max-width: 420px; }
.wa-pal-info-sheet-button { width: 100%; margin-top: 24px; }

/* ==================== Diary tab: the list of days ==================== */

.wa-pal-diary-list { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.wa-pal-diary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    text-decoration: none;
}
.wa-pal-diary-card:hover { filter: brightness(0.98); }
/* a day with a page about the viewer: the unwatched-episode story ring */
.wa-pal-diary-card--about-you {
    border: 2px solid transparent;
    padding: 14px;
    background:
        linear-gradient(var(--md-surface-container-high), var(--md-surface-container-high)) padding-box,
        var(--wa-pal-story-ring) border-box;
}
.wa-pal-diary-card-icon { flex: none; color: var(--md-on-surface-variant); }
.wa-pal-diary-card-icon--about-you { color: var(--md-on-surface); }
.wa-pal-diary-card-icon svg, .wa-pal-diary-card-lock svg { width: 24px; height: 24px; }
.wa-pal-diary-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wa-pal-diary-card-title {
    font-size: calc(22px * var(--wa-text-scale, 1));
    line-height: calc(28px * var(--wa-text-scale, 1));
    font-weight: 600;
    color: var(--md-on-surface);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.wa-pal-diary-card-date { font-size: calc(14px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-pal-diary-card-lock { flex: none; margin-left: 8px; color: var(--md-on-surface-variant); }

/* ==================== Diary day: the notebook page with floating bars ==================== */

.wa-pal-diary-screen {
    /* the room the floating bars take: back button row on top, page switcher (and a gap) at the bottom */
    --wa-pal-diary-top-bar-room: calc(max(8px, env(safe-area-inset-top)) + 56px);
    --wa-pal-diary-switcher-room: calc(34px + 32px * var(--wa-text-scale, 1) + var(--wa-bottom-inset));
    position: relative;
    flex: 1;
    min-height: 0;
    background: var(--md-background);
    color: var(--md-on-surface);
}
.wa-pal-diary-pages { position: absolute; inset: 0; max-width: 720px; margin: 0 auto; }
.wa-pal-diary-page { position: absolute; inset: 0; overflow: hidden; }
.wa-pal-diary-page[hidden] { display: none; }
.wa-pal-diary-paper-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #F6EFE3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wa-pal-diary-paper-frame { background: #2A2430; } }
:root[data-theme="dark"] .wa-pal-diary-paper-frame { background: #2A2430; }

/*
 * no paper page: a framed leaf between the floating bars (so the back button and switcher never sit
 * on its edge), the same thin even rim on both pages, with the notes in the pal's handwriting
 */
.wa-pal-diary-leaf {
    position: absolute;
    top: var(--wa-pal-diary-top-bar-room);
    bottom: var(--wa-pal-diary-switcher-room);
    left: 20px;
    right: 20px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 16px;
    background: var(--md-surface-container-low);
    overflow: hidden;
}
.wa-pal-diary-leaf-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 24px; }
.wa-pal-diary-leaf-date { margin: 0; font-size: calc(18px * var(--wa-text-scale, 1)); line-height: calc(24px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-pal-diary-leaf-title { margin: 8px 0 0; font-size: calc(30px * var(--wa-text-scale, 1)); line-height: 1.15; font-weight: 700; }
.wa-pal-diary-leaf-notes { margin-top: 20px; font-size: calc(22px * var(--wa-text-scale, 1)); line-height: calc(28px * var(--wa-text-scale, 1)); overflow-wrap: anywhere; }
.wa-pal-diary-leaf-notes p { margin: 0 0 0.85em; }
.wa-pal-diary-leaf-notes.is-frosted { filter: blur(6px); user-select: none; -webkit-user-select: none; pointer-events: none; }

/* the haze over a locked page (the whole paper page, or just the leaf), and the cards on it */
.wa-pal-diary-frost-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--md-surface-container-low) 55%, transparent); }
.wa-pal-diary-unlock-card,
.wa-pal-diary-thin-day-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 520px;
    padding: 24px 20px;
    border-radius: 16px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-high);
    text-align: center;
}
/* locked: docked at the foot of the page, 20 px in from its sides, just above the switcher like the phone */
.wa-pal-diary-unlock-card {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: calc(var(--wa-pal-diary-switcher-room) + 12px);
    margin: 0 auto;
}
.wa-pal-diary-leaf .wa-pal-diary-unlock-card { bottom: 20px; }
/* thin day: at the top of the blank leaf, 20 px in from its rim (never in the middle of an empty page) */
.wa-pal-diary-thin-day-card { margin: 20px auto 0; width: calc(100% - 40px); }
.wa-pal-diary-unlock-card-lock { color: var(--md-on-surface-variant); margin-bottom: 20px; }
.wa-pal-diary-unlock-card-lock svg { width: 64px; height: 64px; }
.wa-pal-diary-overlay-card-title { margin: 0; font-size: calc(18px * var(--wa-text-scale, 1)); line-height: calc(24px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-pal-diary-overlay-card-message { margin: 8px 0 0; font-size: calc(14px * var(--wa-text-scale, 1)); line-height: calc(20px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-pal-diary-overlay-card-message .wa-coin-price { vertical-align: middle; }
.wa-pal-diary-unlock-button { margin-top: 24px; }

/* floating top bar (back + "Meera's diary" pill) with no background, so the paper shows through */
.wa-pal-diary-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-width: 720px;
    margin: 0 auto;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    pointer-events: none;
}
.wa-pal-diary-top-bar > * { pointer-events: auto; }
.wa-pal-diary-privacy-button { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; z-index: 5; }

/*
 * bottom page switcher: Page 1 (their day) / Page 2 (about you). The selected page is filled with the
 * web app's selected-tab red (like .wa-tab), not the phone's onSurface block, which read as a flat
 * grey slab on the dark theme (Anudeep, 2026-11-05).
 */
.wa-pal-diary-switcher {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: calc(8px + var(--wa-bottom-inset));
    z-index: 4;
    max-width: 440px;
    margin: 0 auto;
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-high);
}
.wa-pal-diary-switcher-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--md-on-surface);
    cursor: pointer;
}
.wa-pal-diary-switcher-number { font-size: calc(12px * var(--wa-text-scale, 1)); line-height: calc(16px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-pal-diary-switcher-subtitle { font-size: calc(10px * var(--wa-text-scale, 1)); line-height: calc(16px * var(--wa-text-scale, 1)); font-weight: 500; color: var(--md-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wa-pal-diary-switcher-tab:hover { background: var(--md-surface-container-highest); }
.wa-pal-diary-switcher-tab.is-selected { background: var(--wa-primary); color: var(--wa-on-primary); }
.wa-pal-diary-switcher-tab.is-selected .wa-pal-diary-switcher-subtitle { color: color-mix(in srgb, var(--wa-on-primary) 85%, transparent); }

/* ==================== placeholders: the same boxes as the loaded profile ==================== */

.wa-pal-loading-name { width: 148px; height: 20px; border-radius: 999px; }
.wa-pal-loading-section { width: 88px; height: 20px; }
.wa-pal-diary-loading-icon { width: 24px; height: 24px; border-radius: 8px; flex: none; }
.wa-pal-diary-loading-title { width: 68%; height: 28px; }
.wa-pal-diary-loading-date { width: 42%; height: 20px; }
.wa-pal-about-loading-name { width: 55%; height: 33px; }
.wa-pal-about-loading-profession { width: 40%; height: 24px; }
.wa-pal-about-loading-icon { width: 32px; height: 32px; border-radius: 999px; flex: none; }
.wa-pal-about-loading-label { width: 28%; height: 16px; }
.wa-pal-about-loading-value { width: 62%; height: 24px; }
.wa-pal-appearance-loading-icon { width: 24px; height: 24px; border-radius: 8px; flex: none; }
.wa-pal-text-loading-line { width: 100%; height: 20px; }
.wa-pal-text-card > .wa-pal-text-loading-line + .wa-pal-text-loading-line { margin-top: 0; }
.wa-pal-text-card > .wa-pal-text-loading-line:last-child { width: 72%; }
@media (prefers-reduced-motion: reduce) {
    .wa-pal-hero.is-loading { animation: none; }
}
