/* PawLedger Website Styles */
/* Last updated: December 2025 */

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

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

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

@keyframes breathe {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-4px) scale(1.02);
    }
}

/* Removed subtlePulse animation - was causing visual flashing */

@keyframes logoGlow {
    0%, 100% {
        box-shadow: var(--shadow-subtle);
    }
    50% {
        box-shadow: var(--shadow-subtle), 0 0 16px rgba(255, 107, 74, 0.3);
    }
}

:root {
    /* Colors */
    --color-primary: #FF6B4A;
    --color-primary-light: #FF8A6F;
    --color-primary-dark: #E55A3A;

    /* Light mode */
    --color-bg: #FAFAFA;
    --color-bg-glass: rgba(255, 255, 255, 0.72);
    --color-surface: rgba(255, 255, 255, 0.85);
    --color-text: #1C1C1E;
    --color-text-secondary: #6E6E73;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-highlight-bg: rgba(255, 107, 74, 0.08);

    /* Shadows */
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.04);

    /* Sizing */
    --max-width: 720px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #000000;
        --color-bg-glass: rgba(28, 28, 30, 0.72);
        --color-surface: rgba(44, 44, 46, 0.85);
        --color-text: #F5F5F7;
        --color-text-secondary: #98989D;
        --color-border: rgba(255, 255, 255, 0.1);
        --color-highlight-bg: rgba(255, 107, 74, 0.15);
        --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.32), 0 1px 3px rgba(0, 0, 0, 0.24);
        --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.24);
    }
}

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

/* Base */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-text);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-subtle);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.logo:hover .logo-icon {
    transform: scale(1.08);
    animation: logoGlow 1.5s ease-in-out infinite;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-primary);
}

/* Main Content */
.main {
    flex: 1;
    padding: 48px 24px;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Glass Card */
.glass-card {
    background: var(--color-surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-glass);
    padding: 40px;
    animation: fadeInUp 0.6s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glass), 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* App Icon Breathing Animation */
.glass-card .app-icon,
.glass-card img[alt*="icon"],
.glass-card img[alt*="Icon"] {
    animation: breathe 4s ease-in-out infinite;
}

/* Removed staggered content animation - was causing visual flashing on load */

@media (max-width: 600px) {
    .glass-card {
        padding: 24px;
        border-radius: var(--radius-md);
    }
}

/* Typography */
.page-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--color-text);
}

.updated-date {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 32px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 40px;
    margin-bottom: 16px;
    color: var(--color-text);
}

h2:first-of-type {
    margin-top: 0;
}

h3 {
    font-size: 17px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--color-text);
}

p {
    margin-bottom: 16px;
    color: var(--color-text);
}

/* Highlight Box */
.highlight-box {
    background: var(--color-highlight-bg);
    border-left: 3px solid var(--color-primary);
    padding: 20px 24px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 24px 0;
}

.highlight-box strong {
    color: var(--color-primary);
}

/* Lists */
ul, ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

li {
    margin-bottom: 10px;
    color: var(--color-text);
}

li strong {
    color: var(--color-text);
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

a:hover {
    opacity: 0.85;
    transform: translateX(2px);
}

/* Buttons */
.button,
button,
input[type="submit"] {
    transition: all 0.2s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    transform: scale(1.02);
}

/* Horizontal Rule */
hr {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: 40px 0;
}

/* Footer */
.footer {
    background: var(--color-bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--color-border);
    padding: 32px 24px;
    animation: fadeIn 0.8s ease-out 0.5s both;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-copyright {
    font-size: 13px;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Section Divider */
.section-divider {
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: 2px;
    margin: 32px 0;
}

/* ===================================
   RESPONSIVE - MOBILE FIRST
   =================================== */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
}

/* Safe area support for notched devices */
@supports (padding: env(safe-area-inset-top)) {
    .header {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(32px, env(safe-area-inset-bottom));
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }

    .main {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
}

/* Tablet */
@media (max-width: 768px) {
    .glass-card {
        padding: 32px;
    }

    .highlight-box {
        padding: 16px 20px;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .header {
        padding: 12px 16px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .nav-links {
        gap: 20px;
    }

    /* Minimum touch target size (44px) */
    .nav-links a {
        padding: 10px 4px;
        font-size: 15px;
    }

    .main {
        padding: 20px 16px;
    }

    .page-title {
        font-size: 24px;
        line-height: 1.3;
    }

    h2 {
        font-size: 18px;
        margin-top: 28px;
    }

    h3 {
        font-size: 16px;
    }

    p, li {
        font-size: 15px;
    }

    /* Smaller app icon on mobile */
    .glass-card img[alt="PawLedger"] {
        width: 96px !important;
        height: 96px !important;
        border-radius: 22px !important;
    }

    /* Better link layout on mobile */
    .glass-card > div:last-of-type {
        flex-direction: column;
        gap: 16px !important;
    }

    .glass-card > div:last-of-type a {
        padding: 12px 0;
    }

    .highlight-box {
        padding: 16px;
        margin: 20px 0;
    }

    .section-divider {
        margin: 24px 0;
    }

    .footer {
        padding: 20px 16px;
    }

    .footer-links {
        gap: 12px;
        flex-direction: column;
        align-items: center;
    }

    .footer-links a {
        padding: 8px 0;
        font-size: 15px;
    }

    .footer-copyright {
        font-size: 12px;
    }

    /* Disable hover effects on touch devices */
    .glass-card:hover {
        transform: none;
        box-shadow: var(--shadow-glass);
    }

    .section-accordion:hover {
        transform: none;
    }

    a:hover {
        transform: none;
    }
}

/* Small phones */
@media (max-width: 375px) {
    .glass-card {
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }

    .page-title {
        font-size: 22px;
    }

    .logo-text {
        font-size: 18px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .glass-card img[alt="PawLedger"] {
        width: 80px !important;
        height: 80px !important;
        border-radius: 18px !important;
    }
}

/* ===================================
   TERMS OF SERVICE PAGE STYLES
   =================================== */

:root {
    --color-warning: #FF9500;
    --color-warning-bg: rgba(255, 149, 0, 0.08);
    --color-legal: #5856D6;
    --color-legal-bg: rgba(88, 86, 214, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-warning-bg: rgba(255, 149, 0, 0.15);
        --color-legal-bg: rgba(88, 86, 214, 0.15);
    }
}

/* Table of Contents */
.toc {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
}

.toc-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 24px;
}

.toc-list li {
    margin: 0;
}

.toc-list a {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    transition: color 0.2s ease;
}

.toc-list a:hover {
    color: var(--color-primary);
    opacity: 1;
}

.toc-list .toc-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* Section Accordion */
.section-accordion {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.section-accordion:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-subtle);
}

.section-accordion[open] {
    box-shadow: var(--shadow-glass);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.2s ease;
}

.section-header::-webkit-details-marker {
    display: none;
}

.section-header:hover {
    background: var(--color-highlight-bg);
}

.section-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.section-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.section-chevron {
    font-size: 12px;
    color: var(--color-text-secondary);
    transition: transform 0.3s ease;
}

.section-accordion[open] .section-chevron {
    transform: rotate(180deg);
}

.section-content {
    padding: 0 20px 20px 52px;
    animation: fadeIn 0.3s ease-out;
}

.section-content p:last-child,
.section-content ul:last-child,
.section-content ol:last-child {
    margin-bottom: 0;
}

.section-content h3 {
    margin-top: 20px;
}

.section-content h3:first-child {
    margin-top: 0;
}

/* Warning Section Modifier */
.section--warning {
    border-color: var(--color-warning);
    border-width: 2px;
    background: var(--color-warning-bg);
}

.section--warning .section-header:hover {
    background: rgba(255, 149, 0, 0.12);
}

.section--warning .section-title {
    color: var(--color-warning);
}

/* Legal Section Modifier */
.section--legal {
    border-left: 3px solid var(--color-legal);
}

.section--legal .section-icon {
    color: var(--color-legal);
}

/* Responsive - Table of Contents */
@media (max-width: 600px) {
    .toc {
        padding: 16px;
    }

    .toc-list {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .toc-list a {
        font-size: 13px;
        padding: 8px 0;
    }

    .section-header {
        padding: 14px 16px;
    }

    .section-content {
        padding: 0 16px 16px 44px;
    }

    .section-title {
        font-size: 15px;
    }

    .section-icon {
        font-size: 18px;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .toc {
        display: none;
    }

    .glass-card {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    body {
        background: white;
        color: black;
    }

    .section-accordion {
        border: none;
        box-shadow: none;
        background: transparent;
        margin-bottom: 24px;
    }

    .section-accordion[open] {
        box-shadow: none;
    }

    .section-header {
        padding: 0;
        margin-bottom: 12px;
    }

    .section-chevron {
        display: none;
    }

    .section-content {
        padding: 0;
    }

    .section-accordion:not([open]) .section-content {
        display: block !important;
    }

    .section--warning,
    .section--legal {
        border: none;
        background: transparent;
    }
}

/* ===================================
   REDUCED MOTION - ACCESSIBILITY
   =================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .glass-card,
    .glass-card:hover {
        animation: none;
        transform: none;
    }

    .glass-card > * {
        animation: none !important;
    }

    .logo-icon,
    .logo:hover .logo-icon {
        animation: none;
        transform: none;
    }

    .highlight-box {
        animation: none;
    }

    .section-accordion,
    .section-accordion:hover {
        transform: none;
    }

    a:hover {
        transform: none;
    }

    .button:hover,
    button:hover,
    input[type="submit"]:hover {
        transform: none;
    }
}
