/* 
 * DISCRIMINATE MEDIA - Mobile-Responsive Stylesheet
 * Modernized from legacy HTML - Maintains original dark aesthetic
 * Optimized for iPhone & Android devices
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Variables)
   ============================================ */
:root {
    --color-bg: #000000;
    --color-text: #ffffff;
    --color-border: #ffffff;
    --color-link: #ffffff;
    --color-link-hover: #cccccc;
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --max-width: 900px;
    --border-style: 1px solid var(--color-border);
    --transition-speed: 0.3s;
    /* Touch target minimum size (44px per Apple/Google guidelines) */
    --touch-target-min: 44px;
    /* Safe area insets for notched phones */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    /* Support for notched phones */
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

/* Ensure images never overflow container */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-speed) ease,
                border-color var(--transition-speed) ease;
    -webkit-touch-callout: none;
}

a:hover,
a:focus {
    color: var(--color-link-hover);
    outline: none;
}

/* Underline links in text content */
.content-text a {
    text-decoration: underline;
}

/* Prevent text selection on interactive elements for mobile */
button, a {
    -webkit-user-select: none;
    user-select: none;
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-sm);
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

.main-content {
    flex: 1;
    padding: var(--spacing-md);
}

/* ============================================
   HEADER & SITE LOGO
   ============================================ */
.site-header {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-md);
    padding-top: calc(var(--spacing-md) + var(--safe-area-inset-top));
    text-align: center;
}

.site-logo {
    max-width: 100%;
    width: 600px;
    height: auto;
    margin: 0 auto;
}

/* Smaller logo on very small screens */
@media (max-width: 480px) {
    .site-logo {
        width: 100%;
        max-width: 320px;
    }
}

.site-logo-link {
    display: inline-block;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */
.page-layout {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-sm);
}

.content-box {
    width: 100%;
    border: var(--border-style);
    padding: var(--spacing-md);
}

@media (min-width: 480px) {
    .page-layout {
        padding: var(--spacing-md);
    }
    
    .content-box {
        padding: var(--spacing-lg);
    }
}

/* ============================================
   INTRO TEXT
   ============================================ */
.intro-text {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-size: 1.1rem;
    line-height: 1.8;
}

.intro-text a {
    text-decoration: underline;
}

@media (min-width: 480px) {
    .intro-text {
        font-size: 1.25rem;
    }
}

/* ============================================
   BOOKS GRID
   ============================================ */
.books-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.book-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.book-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.book-cover-link {
    display: block;
    flex-shrink: 0;
    max-width: 300px;
    margin: 0 auto;
}

.book-cover {
    width: 100%;
    height: auto;
    border: 2px solid var(--color-border);
    transition: transform var(--transition-speed) ease,
                box-shadow var(--transition-speed) ease;
}

@media (hover: hover) {
    .book-cover:hover {
        transform: scale(1.02);
        box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
    }
}

.book-cover:active {
    transform: scale(0.98);
}

.book-info {
    text-align: center;
}

.book-title {
    font-size: 1.25rem;
    font-style: italic;
    margin-bottom: var(--spacing-xs);
}

.book-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--spacing-sm);
}

.book-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
}

.book-meta p {
    margin-bottom: var(--spacing-xs);
}

/* Tablet and up: horizontal card layout */
@media (min-width: 600px) {
    .book-card {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .book-cover-link {
        flex: 0 0 300px;
        margin: 0;
    }
    
    .book-info {
        flex: 1;
        text-align: left;
    }
    
    .book-title {
        font-size: 1.5rem;
    }
}

/* ============================================
   BOOK DETAIL PAGES
   ============================================ */
.book-detail {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.book-detail-cover {
    max-width: 350px;
    margin: 0 auto;
}

.book-detail-cover img {
    width: 100%;
    height: auto;
}

.book-detail-info {
    flex: 1;
}

.book-detail-title {
    font-size: 1.5rem;
    font-style: italic;
    text-align: center;
    margin-bottom: var(--spacing-xs);
}

.book-detail-subtitle {
    font-size: 1rem;
    font-style: italic;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--spacing-md);
}

.book-detail-author {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.book-detail-author a {
    text-decoration: underline;
}

.book-specs {
    margin-bottom: var(--spacing-lg);
    line-height: 2;
}

.book-specs .label {
    text-decoration: underline;
}

.edition-block {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm);
    border-left: 3px solid var(--color-border);
}

.edition-block h3 {
    font-size: 1.1rem;
    text-decoration: underline;
    margin-bottom: var(--spacing-sm);
}

.edition-block p {
    margin-bottom: var(--spacing-xs);
}

.buy-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
    margin-top: var(--spacing-sm);
}

.amazon-button img {
    height: 31px;
    width: auto;
}

/* PayPal button styling */
.paypal-form {
    display: inline-block;
}

.paypal-form input[type="image"] {

    cursor: pointer;
}

@media (min-width: 768px) {
    .book-detail {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .book-detail-cover {
        flex: 0 0 350px;
        margin: 0;
    }
    
    .book-detail-title,
    .book-detail-subtitle,
    .book-detail-author {
        text-align: left;
    }
}

/* ============================================
   DESCRIPTION & REVIEWS SECTIONS
   ============================================ */
.section-heading {
    font-size: 1.1rem;
    text-decoration: underline;
    margin-bottom: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.description-text {
    line-height: 1.8;
}

.description-text p {
    margin-bottom: var(--spacing-md);
}

.description-text a {
    text-decoration: underline;
}

.reviews-section {
    margin-top: var(--spacing-lg);
}

.review {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.review:last-child {
    border-bottom: none;
}

.review-text {
    font-style: normal;
    line-height: 1.8;
    margin-bottom: var(--spacing-sm);
}

.review-source {
    padding-left: var(--spacing-md);
    color: rgba(255, 255, 255, 0.8);
}

.review-source .reviewer-name {
    display: block;
}

.review-source .reviewer-title {
    display: block;
    font-style: normal;
}

/* ============================================
   INTERVIEWS LINKS
   ============================================ */
.interview-link {
    display: block;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    border: var(--border-style);
    text-align: center;
    transition: background-color var(--transition-speed) ease;
    min-height: var(--touch-target-min);
}

.interview-link:hover,
.interview-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md);
    padding-bottom: calc(var(--spacing-md) + var(--safe-area-inset-bottom));
    text-align: center;
    border: var(--border-style);
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}

.copyright {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.8;
}

.copyright a {
    text-decoration: underline;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.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;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

/* ============================================
   TWO COLUMN LAYOUT (for detail pages)
   ============================================ */
.two-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.two-column .column {
    flex: 1;
}

@media (min-width: 768px) {
    .two-column {
        flex-direction: row;
    }
    
    .two-column .column-left {
        flex: 0 0 45%;
    }
    
    .two-column .column-right {
        flex: 0 0 55%;
    }
}

/* ============================================
   CONTENT TEXT (for descriptions, reviews)
   ============================================ */
.content-text {
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.content-text p {
    margin-bottom: var(--spacing-md);
}

.content-text ul {
    margin-left: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.content-text li {
    margin-bottom: var(--spacing-xs);
    padding: var(--spacing-xs) 0;
}

/* ============================================
   BLOCKQUOTES (for press quotes)
   ============================================ */
blockquote {
    border-left: 3px solid var(--color-border);
    padding-left: var(--spacing-md);
    margin: var(--spacing-md) 0;
    font-style: normal;
}

blockquote cite {
    display: block;
    font-style: normal;
    margin-top: var(--spacing-sm);
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 4px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-border: #ffffff;
    }
    
    a:focus {
        outline: 3px solid var(--color-text);
    }
}

/* ============================================
   iOS SPECIFIC FIXES
   ============================================ */
.page-wrapper {
    -webkit-overflow-scrolling: touch;
}

input, select, textarea {
    font-size: 16px;
}

/* ============================================
   LANDSCAPE MODE ADJUSTMENTS
   ============================================ */
@media (orientation: landscape) and (max-height: 500px) {
    .site-header {
        padding: var(--spacing-sm);
    }
    
    .site-logo {
        max-height: 60px;
        width: auto;
    }
}

/* ============================================
   VERY SMALL SCREENS (320px and below)
   ============================================ */
@media (max-width: 350px) {
    :root {
        --font-size-base: 14px;
        --spacing-xs: 0.375rem;
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
    }
    
    .book-title {
        font-size: 1.1rem;
    }
    
    .book-detail-title {
        font-size: 1.25rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white;
        color: black;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    .content-box {
        border: 1px solid black;
    }
    
    .buy-buttons,
    .paypal-form {
        display: none;
    }
}
