/* Apple-inspired Design System */
/* Using CSS custom properties for seamless dark/light mode switching */

:root {
    /* Light mode colors - iOS systemGroupedBackground style */
    --bg-primary: #ffffff;
    --bg-secondary: #f2f2f7;
    --bg-tertiary: #ffffff;
    --bg-elevated: #ffffff;
    --text-primary: #000000;
    --text-secondary: rgba(60, 60, 67, 0.6);
    --text-tertiary: rgba(60, 60, 67, 0.3);
    --link-color: #007aff;
    --link-hover: #0056b3;
    --border-color: rgba(60, 60, 67, 0.12);
    --separator-color: rgba(60, 60, 67, 0.29);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --accent-color: #007aff;
    --divider-color: rgba(60, 60, 67, 0.12);
    --toggle-bg: rgba(120, 120, 128, 0.16);
    --toggle-knob: #ffffff;
    --info-box-bg: rgba(0, 122, 255, 0.08);
    --info-box-border: rgba(0, 122, 255, 0.3);
}

/* Dark mode colors - iOS elevated surface style */
[data-theme="dark"] {
    --bg-primary: #1c1c1e;
    --bg-secondary: #000000;
    --bg-tertiary: #2c2c2e;
    --bg-elevated: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);
    --link-color: #0a84ff;
    --link-hover: #5ac8fa;
    --border-color: rgba(84, 84, 88, 0.65);
    --separator-color: rgba(84, 84, 88, 0.65);
    --card-shadow: none;
    --card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --accent-color: #0a84ff;
    --divider-color: rgba(84, 84, 88, 0.65);
    --toggle-bg: rgba(120, 120, 128, 0.32);
    --toggle-knob: #ffffff;
    --info-box-bg: rgba(10, 132, 255, 0.15);
    --info-box-border: rgba(10, 132, 255, 0.4);
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1c1c1e;
        --bg-secondary: #000000;
        --bg-tertiary: #2c2c2e;
        --bg-elevated: #2c2c2e;
        --text-primary: #ffffff;
        --text-secondary: rgba(235, 235, 245, 0.6);
        --text-tertiary: rgba(235, 235, 245, 0.3);
        --link-color: #0a84ff;
        --link-hover: #5ac8fa;
        --border-color: rgba(84, 84, 88, 0.65);
        --separator-color: rgba(84, 84, 88, 0.65);
        --card-shadow: none;
        --card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
        --accent-color: #0a84ff;
        --divider-color: rgba(84, 84, 88, 0.65);
        --toggle-bg: rgba(120, 120, 128, 0.32);
        --toggle-knob: #ffffff;
        --info-box-bg: rgba(10, 132, 255, 0.15);
        --info-box-border: rgba(10, 132, 255, 0.4);
    }
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Header with theme toggle */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 980px;
    margin: 0 auto;
    padding: 12px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-size: 21px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-logo:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

/* Theme toggle switch */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 51px;
    height: 31px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg);
    border-radius: 31px;
    transition: 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: var(--toggle-knob);
    border-radius: 50%;
    transition: 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Theme icons (SVG-based for performance) */
.theme-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon svg {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
}

/* Main container */
.container {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 100px 22px 60px;
}

/* Card container */
.card {
    background: var(--bg-primary);
    border-radius: 18px;
    padding: 48px;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
}

/* Typography - iOS Large Title style */
h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

h2 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.005em;
    margin-top: 36px;
    margin-bottom: 14px;
    color: var(--text-primary);
}

h3 {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.003em;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.lead {
    font-size: 18px;
    line-height: 1.45;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.meta {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--divider-color);
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 17px;
    font-weight: 400;
    color: var(--link-color);
    margin-bottom: 32px;
    text-decoration: none;
    transition: gap 0.2s ease;
}

.back-link:hover {
    gap: 10px;
    text-decoration: none;
}

.back-link::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.back-link:hover::before {
    transform: rotate(45deg) translateX(-2px) translateY(2px);
}

/* Lists */
ul {
    padding-left: 24px;
    margin-bottom: 17px;
}

ul li {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 4px;
}

ul li::marker {
    color: var(--accent-color);
}

/* App cards for homepage */
.app-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 16px;
}

.app-card {
    display: block;
    padding: 20px 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    will-change: transform;
}

.app-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--card-hover-shadow);
    text-decoration: none;
    border-color: var(--accent-color);
}

.app-title {
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    transition: color 0.2s ease;
}

.app-card:hover .app-title {
    color: var(--link-color);
}

.app-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Info box / callout */
.info-box {
    background: var(--info-box-bg);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 24px 0;
    border-left: 3px solid var(--info-box-border);
}

.info-box p {
    margin-bottom: 0;
    font-size: 15px;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--divider-color);
    text-align: center;
}

footer p {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

footer a {
    color: var(--text-tertiary);
}

footer a:hover {
    color: var(--link-color);
}

/* Section divider */
.section-divider {
    height: 1px;
    background: var(--divider-color);
    margin: 40px 0;
}

/* Strong text */
strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 734px) {
    .container {
        padding: 76px 16px 40px;
    }

    .card {
        padding: 24px 20px;
        border-radius: 12px;
    }

    h1 {
        font-size: 32px;
    }

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

    h3 {
        font-size: 17px;
    }

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

    .lead {
        font-size: 16px;
    }

    .header-content {
        padding: 10px 16px;
    }

    .app-card {
        padding: 16px 20px;
    }

    .meta {
        font-size: 13px;
    }
}

/* Print styles */
@media print {
    .site-header,
    .theme-toggle {
        display: none;
    }

    .container {
        padding-top: 0;
    }

    body {
        background: white;
        color: black;
    }
}
