/* ============================================================================
   DAILY BARS - GUAPDAD 4000 EDITION
   Oakland Energy meets Brutalist Design
   ============================================================================ */

/* CSS RESET & ROOT VARIABLES */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --black: #000000;
    --white: #FFFFFF;
    --paper: #F4F4F0;
    --gray: #888888;
    --light-gray: #E5E5E5;
    --electric: #EAB308;
    --gold: #EAB308;
    --brand-green: #166534;
    --brand-red: #7F1D1D;
    --beat-purple: #7C3AED;
    --recording-red: #EF4444;
    --archive-brown: #4A2C2A;
    --crates-blue: #1E3A8A;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

html { 
    scroll-behavior: smooth; 
    -webkit-tap-highlight-color: transparent;
    font-size: 16px;
    overscroll-behavior: none;
}

body {
    font-family: 'IBM Plex Mono', 'Space Mono', monospace;
    background: var(--paper);
    color: var(--black);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection { background: var(--electric); color: var(--black); }
::-webkit-scrollbar { width: 0; height: 0; }

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

.font-display { font-family: 'Archivo Black', sans-serif; }
.font-serif { font-family: 'Playfair Display', Georgia, serif; }
.font-mono { font-family: 'IBM Plex Mono', monospace; }

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes slideUp { 
    from { opacity: 0; transform: translateY(20px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@keyframes slideIn { 
    from { opacity: 0; transform: translateX(20px); } 
    to { opacity: 1; transform: translateX(0); } 
}

@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes pulse { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0.5; } 
}

@keyframes scaleIn { 
    from { opacity: 0; transform: scale(0.95); } 
    to { opacity: 1; transform: scale(1); } 
}

@keyframes rock {
    0% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(-1.5deg) translateY(-1px); }
    75% { transform: rotate(1.5deg) translateY(-1px); }
    100% { transform: rotate(0deg) translateY(0); }
}

@keyframes flash {
    0%, 100% { fill: #FFFFFF; opacity: 1; }
    50% { fill: #999999; opacity: 0.8; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Animation Classes */
.animate-slide-up { animation: slideUp 0.3s ease-out; }
.animate-slide-in { animation: slideIn 0.3s ease-out; }
.animate-fade-in { animation: fadeIn 0.2s ease-out; }
.animate-scale-in { animation: scaleIn 0.2s ease-out; }
.animate-pulse { animation: pulse 1s ease-in-out infinite; }
.animate-rock { 
    animation: rock 0.2s ease-in-out infinite; 
    transform-origin: center bottom;
}
.animate-flash { animation: flash 0.08s steps(2) infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-shimmer {
    background: linear-gradient(90deg, var(--paper) 0%, var(--white) 50%, var(--paper) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.animate-bounce { animation: bounce 0.5s ease-in-out; }

/* ============================================================================
   UTILITY PATTERNS
   ============================================================================ */

.halftone {
    background-image: radial-gradient(circle, var(--black) 1px, transparent 1px);
    background-size: 4px 4px;
}

.scrollable {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overflow-anchor: none;
}

.swipe-container {
    touch-action: pan-y pinch-zoom;
}

/* View transition */
.view-enter { animation: slideIn 0.25s ease-out; }
.view-exit { animation: slideIn 0.25s ease-out reverse; }

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

input, textarea {
    font-family: 'IBM Plex Mono', monospace;
    border: none;
    outline: none;
    background: transparent;
}

input::placeholder, textarea::placeholder { color: var(--gray); }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

button:active { transform: scale(0.98); }

/* ============================================================================
   CARD & IMAGE STYLES
   ============================================================================ */

.card-image {
    filter: grayscale(80%) contrast(1.05);
    transition: filter 0.3s ease;
}

.card-image:hover { filter: grayscale(0%) contrast(1); }

.crate-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid var(--black);
    background: rgba(255,255,255,0.85);
    font-size: 10px;
    letter-spacing: 0.03em;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

/* ============================================================================
   INLINE EDIT
   ============================================================================ */

.inline-edit {
    cursor: text;
    transition: background 0.2s ease;
}

.inline-edit:hover { background: rgba(250, 255, 0, 0.1); }

.inline-edit:focus { 
    background: var(--electric);
    outline: none;
}

/* ============================================================================
   DAILY DROP WIDGET - INSPIRATION PROMPT (Header Version)
   ============================================================================ */

/* Header dice trigger - clean minimal style */
.daily-drop-header-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.daily-drop-header-trigger:hover {
    transform: scale(1.1);
}

.daily-drop-header-trigger:active {
    transform: scale(0.95);
}

.daily-drop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.daily-drop-card {
    width: 100%;
    max-width: 380px;
    background-image: url('../images/smooth-paper-texture.jpg');
    background-size: cover;
    background-position: center;
    border: 4px solid var(--black);
    box-shadow: 12px 12px 0 var(--black);
    padding: 0;
    overflow: hidden;
}

.daily-drop-header {
    background: var(--black);
    color: var(--electric);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.daily-drop-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.daily-drop-content {
    padding: 32px 24px;
    text-align: center;
}

.daily-drop-prompt-type {
    display: inline-block;
    background: var(--electric);
    color: var(--black);
    padding: 6px 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.daily-drop-prompt-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--black);
    margin-bottom: 24px;
}

.daily-drop-challenge {
    font-size: 12px;
    color: var(--gray);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.daily-drop-footer {
    border-top: 2px solid var(--black);
    padding: 16px 24px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
}

.daily-drop-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 2px solid var(--black);
    cursor: pointer;
    transition: all 0.15s ease;
}

.daily-drop-btn-primary {
    background: var(--brand-green);
    color: var(--white);
}

.daily-drop-btn-primary:hover {
    background: #14532d;
}

.daily-drop-btn-secondary {
    background: var(--white);
    color: var(--black);
}

.daily-drop-btn-secondary:hover {
    background: var(--paper);
}

.daily-drop-streak {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(234, 179, 8, 0.15);
    border-top: 1px dashed var(--electric);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--black);
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 380px) {
    .daily-drop-prompt-text {
        font-size: 22px;
    }
    
    .daily-drop-card {
        margin: 10px;
    }
}

/* Safe area support for iPhone notch */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================================================
   RHYME HIGHLIGHTING SYSTEM
   Simple visible textarea with rhyme legend below
   No overlay tricks - cursor is always correct
   ============================================================================ */

/* Container for rhyme-enabled textareas */
.rhyme-editor-active {
    position: relative;
}

/* Main container */
.rhyme-textarea-container {
    position: relative;
    width: 100%;
}

/* The actual textarea - fully visible, no tricks */
.rhyme-textarea-input {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: text;
    -webkit-user-select: text;
    caret-color: var(--black) !important;
    /* Ensure proper line height */
    line-height: 1.5;
}

/* Focus state */
.rhyme-textarea-input:focus {
    outline: none;
}

/* Placeholder styling */
.rhyme-textarea-input::placeholder {
    color: var(--gray);
    opacity: 0.6;
}

/* Mobile-specific fixes */
@media (pointer: coarse) {
    .rhyme-textarea-input {
        /* Larger touch target */
        min-height: 100px;
        /* Prevent zoom on focus in iOS - must be 16px+ */
        font-size: 16px !important;
        /* Better touch scrolling */
        -webkit-overflow-scrolling: touch;
        /* Disable auto features that interfere */
        autocomplete: off;
        autocorrect: off;
        autocapitalize: sentences;
    }
    
    .rhyme-textarea-container {
        touch-action: manipulation;
    }
}

/* iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    .rhyme-textarea-input {
        /* Prevent iOS zoom on input */
        font-size: max(16px, 1em) !important;
        /* Fix iOS textarea quirks */
        -webkit-appearance: none;
        border-radius: 0;
        /* Prevent iOS from adding shadows */
        -webkit-box-shadow: none;
        box-shadow: none;
    }
}
