/* ═══════════════════════════════════════════════════════════════════
   site.css — Shared across ALL tano.to pages
   Provides: grid background, glossy red header, squigglevision,
             profile modal (center), sub-page content shell.
═══════════════════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Graph-paper background ── */
:root {
    --font-ui: 'Metrophobic', 'Nunito', 'Segoe UI', sans-serif;
    
    /* Color variables for consistent theming */
    --color-primary: #CC1111;  /* Primary red */
    --color-primary-hover: #AA0E0E;  /* Darker red for hover states */
    --color-text-primary: #1a1a28;  /* Primary text color */
    --color-text-secondary: rgba(30,30,50,0.55);  /* Secondary text */
    --color-text-muted: rgba(80,80,110,0.35);  /* Muted text */
    --color-bg-page: #f3f3f5;  /* Page background */
    --color-bg-grid: rgba(0,0,0,0.055);  /* Grid line color */
    
    /* Dreams page color overrides */
    --color-dreams-bg: #06060e;  /* Dreams page background — very dark */
    --color-dreams-primary: #9bb4f0;  /* Dreams page blue accent */
    --color-dreams-text: rgba(255,255,255,0.90);  /* Dreams page text */
    --color-dreams-grid: rgba(155,180,240,0.05);  /* Dreams page subtle blue grid */
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--color-bg-page);
    background-image:
        linear-gradient(var(--color-bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--color-bg-grid) 1px, transparent 1px);
    background-size: 28px 28px;
    padding-top: 44px; /* clear fixed header */
    font-family: var(--font-ui);
}

/* ═══════════════════════════════════════════════════════════════════
   FIXED TOP BAR — Glossy skeuomorphic plastic finish
═══════════════════════════════════════════════════════════════════ */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 500;

    background-color: var(--color-primary);
    background-image: linear-gradient(
        to bottom,
        rgba(255,255,255,0.30) 0%,
        rgba(255,255,255,0.07) 46%,
        rgba(0,0,0,0.00)       50%,
        rgba(0,0,0,0.10)       100%
    );
    border-bottom: 1px solid rgba(70,0,0,0.45);
    box-shadow:
        0 3px 14px rgba(140,0,0,0.38),
        inset 0  1px 0 rgba(255,255,255,0.40),
        inset 0 -1px 0 rgba(0,0,0,0.24);
}

/* ── Squigglevision keyframes (used by logo + sub-page icon nav) ── */
@keyframes squig {
    0%   { filter: url(#sq0); -webkit-filter: url(#sq0); }
    20%  { filter: url(#sq1); -webkit-filter: url(#sq1); }
    40%  { filter: url(#sq2); -webkit-filter: url(#sq2); }
    60%  { filter: url(#sq3); -webkit-filter: url(#sq3); }
    80%  { filter: url(#sq4); -webkit-filter: url(#sq4); }
}

/* ── Left: squigglevision logo ── */
.bar-logo {
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 27px;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    text-decoration: none;
    user-select: none;
    animation: squig 0.45s steps(1, end) infinite;
    flex-shrink: 0;
}

/* Pause squig during SPA navigation to prevent Firefox rendering artifacts */
.subpage-nav-icon-svg.pause-squig,
.subpage-nav-label.pause-squig {
    animation-play-state: paused;
}

/* ── Right: datetime + profile ── */
.bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Combined date+time display — right side, AM/PM format */
.bar-datetime {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    letter-spacing: 0.01em;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    display: flex;
    align-items: center;
}

/* Skeuomorphic groove — replaces the · dot divider */
.bar-groove {
    display: inline-block;
    width: 2px;
    height: 22px;
    margin: 0 9px;
    background: linear-gradient(to right,
        rgba(0,0,0,0.30) 0px, rgba(0,0,0,0.30) 1px,
        rgba(255,255,255,0.22) 1px, rgba(255,255,255,0.22) 2px
    );
    border-radius: 1px;
    flex-shrink: 0;
}

/* Vertical separator between datetime and profile button */
.bar-sep {
    display: block;
    width: 2px;
    height: 22px;
    background: linear-gradient(to right,
        rgba(0,0,0,0.30) 0px, rgba(0,0,0,0.30) 1px,
        rgba(255,255,255,0.22) 1px, rgba(255,255,255,0.22) 2px
    );
    border-radius: 1px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   PROFILE BUTTON
═══════════════════════════════════════════════════════════════════ */
.profile-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.18s, border-color 0.18s;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-btn:hover,
.profile-btn.active {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.85);
}
.profile-btn svg.smiley { width: 100%; height: 100%; display: block; }

/* ═══════════════════════════════════════════════════════════════════
   PROFILE MODAL — center screen, backdrop blur (photoglobe-style)
═══════════════════════════════════════════════════════════════════ */
.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.48);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.profile-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.profile-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.94) translateY(10px);
    width: 300px;
    max-width: calc(100vw - 32px);
    background: #f5f3f0;
    border: 2px solid rgba(0,0,0,0.22);
    box-shadow: 5px 5px 0 rgba(0,0,0,0.14), 0 16px 48px rgba(0,0,0,0.28);
    z-index: 801;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.23, 1, 0.32, 1);
    font-family: var(--font-ui);
    font-size: 13px;
    color: #1a1a28;
    overflow: hidden;
}
.profile-modal.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1.0) translateY(0);
}

/* Modal header strip — matches top bar */
.pm-header {
    background: var(--color-primary);
    background-image: linear-gradient(to bottom,
        rgba(255,255,255,0.22) 0%,
        transparent 50%,
        rgba(0,0,0,0.10) 100%
    );
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(70,0,0,0.4);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.32), inset 0 -1px 0 rgba(0,0,0,0.18);
}
.pm-title {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.pm-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.82);
    cursor: pointer;
    padding: 0;
    width: 22px; height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.pm-close-btn:hover { color: #fff; background: rgba(255,255,255,0.18); }

/* Modal body */
.pm-body { padding: 0; }

/* ── Smiley row ── */
.pp-smiley-row {
    display: flex;
    justify-content: center;
    padding: 18px 16px 12px;
    background: linear-gradient(to bottom, #eeeae6, #f5f3f0);
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.pp-smiley {
    width: 72px; height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

/* ── Name row ── */
.pp-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 4px;
    gap: 8px;
}
.pp-username {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 15px;
    color: #111122;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pp-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 4px;
    border-radius: 2px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.pp-edit-btn:hover { color: #333; background: rgba(0,0,0,0.07); }

/* ── Edit row ── */
.pp-edit-row {
    display: none;
    padding: 4px 14px 8px;
    gap: 6px;
    align-items: center;
}
.pp-edit-row.visible { display: flex; }
.pp-username-input {
    flex: 1;
    border: 1.5px solid rgba(0,0,0,0.22);
    border-radius: 0;
    padding: 5px 8px;
    font-family: var(--font-ui);
    font-size: 13px;
    outline: none;
    background: #fff;
    transition: border-color 0.15s;
}
.pp-username-input:focus { border-color: #CC1111; }
.pp-save-btn {
    background: #CC1111;
    color: #fff;
    border: none;
    border-radius: 0;
    padding: 5px 10px;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s;
}
.pp-save-btn:hover { background: #aa0e0e; }
.pp-error { font-size: 11px; color: #CC1111; padding: 0 14px 6px; min-height: 16px; }

/* ── UID row ── */
.pp-divider { height: 1px; background: rgba(0,0,0,0.1); margin: 2px 0; }
.pp-uid-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
}
.pp-uid-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #aaa;
    flex-shrink: 0;
}
.pp-uid-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #555;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pp-copy-btn {
    background: none;
    border: 1.5px solid rgba(0,0,0,0.2);
    border-radius: 0;
    padding: 3px 7px;
    font-family: var(--font-ui);
    font-size: 11px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.pp-copy-btn:hover { background: rgba(0,0,0,0.05); color: #333; }
.pp-copy-btn.copied { border-color: #22c55e; color: #22c55e; }

/* ── Actions row ── */
.pp-actions { display: flex; gap: 0; padding: 8px 14px 14px; gap: 8px; }
.pp-signout-btn, .pp-delete-btn {
    flex: 1;
    border: 1.5px solid rgba(0,0,0,0.18);
    border-radius: 0;
    padding: 7px 0;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}
.pp-signout-btn { background: rgba(0,0,0,0.05); color: #333; }
.pp-signout-btn:hover { background: rgba(0,0,0,0.10); }
.pp-delete-btn { background: #fef2f2; color: #CC1111; }
.pp-delete-btn:hover { background: #fee2e2; }

/* ── Setup state (no account) ── */
.pp-setup { padding: 16px 14px 14px; }
.pp-setup-title {
    font-family: var(--font-ui);
    font-weight: 900;
    font-size: 14px;
    margin-bottom: 4px;
    color: #111122;
}
.pp-setup-sub {
    font-size: 11px;
    color: #777;
    margin-bottom: 12px;
    line-height: 1.55;
}
.pp-setup-input {
    width: 100%;
    border: 1.5px solid rgba(0,0,0,0.22);
    border-radius: 0;
    padding: 7px 10px;
    font-family: var(--font-ui);
    font-size: 13px;
    margin-bottom: 8px;
    outline: none;
    background: #fff;
    transition: border-color 0.15s;
}
.pp-setup-input:focus { border-color: #CC1111; }
.pp-join-btn {
    width: 100%;
    background: #CC1111;
    color: #fff;
    border: none;
    border-radius: 0;
    padding: 8px 0;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 8px;
}
.pp-join-btn:hover { background: #aa0e0e; }
.pp-restore-link {
    display: block;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 11px;
    color: #888;
    text-decoration: none;
    cursor: pointer;
}
.pp-restore-link:hover { color: #CC1111; }
.pp-setup-error {
    font-size: 11px;
    color: #CC1111;
    margin-top: 4px;
    min-height: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   SUB-PAGE CONTENT AREA
═══════════════════════════════════════════════════════════════════ */
.site-wrapper {
    padding-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   BROWSER COMPATIBILITY ENHANCEMENTS
═══════════════════════════════════════════════════════════════════ */

/* Prevent iOS Safari from auto-inflating font sizes on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Smooth font rendering on WebKit (Safari, Chrome) and Firefox/macOS */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Faster tap response on iOS — suppresses the 300ms click delay */
a, button {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — TOP BAR
   Tablet (≤760px): shrink datetime
   Mobile (≤480px): compact logo, hide date (keep time only)
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
    .bar-datetime { font-size: 14px; }
    .bar-right { gap: 8px; }
}

@media (max-width: 480px) {
    .bar-logo { font-size: 22px; letter-spacing: 1px; }
    .bar-datetime { font-size: 13px; }
    .bar-right { gap: 6px; }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — PROFILE MODAL
   Ensure modal doesn't overflow very small screens
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    .profile-modal {
        max-width: calc(100vw - 16px);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   REDUCED MOTION — respect OS accessibility preference
   Disables squigglevision SVG filter animations (performance +
   motion-sensitivity). Elements fall back to unfiltered state.
═══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .bar-logo,
    .subpage-nav-icon-svg,
    .subpage-nav-label,
    .dream-sleeper-svg,
    .dream-bubble-svg {
        animation: none !important;
        filter: none !important;
        -webkit-filter: none !important;
    }
    .cal-icon {
        animation: none !important;
    }
}
