/* Internet Notepad — Public Pages Styles
   Landing, Login, Share — Linen design system */

/* ── Public page base + improved contrast ── */
.public-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    line-height: var(--leading);
    /* Button colors — guaranteed WCAG AA (4.5:1+ contrast) */
    --btn-accent-bg: #2563EB;
    --btn-accent-bg-hover: #1D4ED8;
    --btn-gold-bg: #B8860B;
    --btn-gold-bg-hover: #9A7000;
    --btn-accent-text: #FFFFFF;
    --btn-gold-text: #FFFFFF;
    --btn-ghost-text: oklch(0.32 0.02 90);
    /* Darker secondary text for readability */
    --pub-secondary: oklch(0.35 0.03 85);
    --pub-muted: oklch(0.38 0.02 90);
}

.public-page *,
.public-page *::before,
.public-page *::after { box-sizing: border-box; }

@media (prefers-color-scheme: dark) {
    .public-page {
        --btn-ghost-text: oklch(0.85 0.02 95);
        --pub-secondary: oklch(0.78 0.02 95);
        --pub-muted: oklch(0.72 0.015 95);
    }
}
html[data-theme="light"] .public-page {
    --pub-secondary: oklch(0.35 0.03 85);
    --pub-muted: oklch(0.38 0.02 90);
    --btn-ghost-text: oklch(0.32 0.02 90);
}
html[data-theme="dark"] .public-page {
    --pub-secondary: oklch(0.78 0.02 95);
    --pub-muted: oklch(0.72 0.015 95);
    --btn-ghost-text: oklch(0.85 0.02 95);
}

.public-page a:not(.btn) {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
    cursor: pointer;
}
.public-page a:not(.btn):hover { color: var(--accent-hover); }

.landing-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    width: 100%;
}

/* ═══ HEADER ═══ */
.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: var(--border-width) solid var(--line);
    background: var(--paper);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}
.public-header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
}
.public-header-logo:hover { color: var(--ink); }
.public-header-logo svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}
.public-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    line-height: 1.4;
    border: var(--border-width) solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 44px;
}
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.btn-primary {
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text);
    font-weight: var(--weight-semibold);
}
.btn-primary:hover { background: var(--btn-accent-bg-hover); color: var(--btn-accent-text); }
.btn-gold {
    background: var(--btn-gold-bg);
    color: var(--btn-gold-text);
    font-weight: var(--weight-semibold);
}
.btn-gold:hover { background: var(--btn-gold-bg-hover); color: var(--btn-gold-text); }
.btn-ghost {
    background: transparent;
    color: var(--btn-ghost-text);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper-hover); color: var(--ink); }
.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}
.btn-icon {
    background: transparent;
    color: var(--pub-secondary);
    padding: var(--space-2);
    min-width: 44px;
    min-height: 44px;
}
.btn-icon:hover { background: var(--paper-hover); color: var(--ink); }

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger-bg);
    color: var(--danger-hover);
    border-color: var(--danger-hover);
}
.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    min-height: 44px;
}

/* ═══ LANDING — Hero ═══ */
.hero {
    text-align: center;
    padding: var(--space-12) var(--space-6) var(--space-12);
}
.hero-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--ink);
    line-height: var(--leading-tight);
    margin: 0 0 var(--space-4);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--pub-secondary);
    max-width: 560px;
    margin: 0 auto var(--space-8);
    line-height: var(--leading-relaxed);
}
.hero-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

/* ═══ Section headings ═══ */
.section-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    text-align: center;
    margin: 0 0 var(--space-3);
    color: var(--ink);
}
.section-subtitle {
    font-size: var(--text-base);
    color: var(--pub-secondary);
    text-align: center;
    max-width: 560px;
    margin: 0 auto var(--space-10);
}

/* ═══ Features grid ═══ */
.features-section { padding: var(--space-12) var(--space-6); }
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
}
.feature-card {
    background: var(--paper-card);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent);
}
.feature-icon {
    width: 40px;
    height: 40px;
    color: var(--accent);
    margin-bottom: var(--space-3);
}
.feature-card h3 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin: 0 0 var(--space-2);
    color: var(--ink);
}
.feature-card p {
    font-size: var(--text-sm);
    color: var(--pub-secondary);
    margin: 0;
    line-height: var(--leading-relaxed);
}

/* ═══ Steps timeline ═══ */
.steps-section {
    padding: var(--space-12) var(--space-6);
    background: var(--paper-card);
    border-top: var(--border-width) solid var(--line);
    border-bottom: var(--border-width) solid var(--line);
}
.steps-list {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
    position: relative;
    padding: 0;
}
.steps-list::before {
    content: '';
    position: absolute;
    top: 28px;
    left: 28px;
    right: 28px;
    height: 2px;
    background: var(--line);
    z-index: 0;
}
/* Connector line between steps 1-2 and 2-3 */
.steps-list::before {
    left: calc((100% - 3 * 250px - 2 * var(--space-6)) / 2 + 28px);
    right: calc((100% - 3 * 250px - 2 * var(--space-6)) / 2 + 28px);
}
.step {
    flex: 0 0 250px;
    text-align: center;
    position: relative;
    z-index: 1;
    cursor: default;
}
.step-number {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--accent-text);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
}
.step h3 {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin: 0 0 var(--space-1);
}
.step p { font-size: var(--text-sm); color: var(--pub-secondary); margin: 0; }

/* ═══ Screenshots ═══ */
.screenshots-section { padding: var(--space-12) var(--space-6); }
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
    max-width: 1000px;
    margin: 0 auto;
}
.screenshot-card {
    background: var(--paper-card);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    cursor: default;
    transition: box-shadow var(--transition), transform var(--transition);
}
.screenshot-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.screenshot-chrome {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-2) var(--space-3);
    background: var(--paper-hover);
    border-bottom: var(--border-width) solid var(--line);
}
.screenshot-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--line);
}
.screenshot-dot:nth-child(1) { background: var(--danger); }
.screenshot-dot:nth-child(2) { background: var(--gold); }
.screenshot-dot:nth-child(3) { background: var(--success); }
.screenshot-placeholder {
    padding: var(--space-10) var(--space-8);
    text-align: center;
    color: var(--pub-muted);
    font-size: var(--text-sm);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper);
}

/* ═══ Pricing ═══ */
.pricing-section {
    padding: var(--space-12) var(--space-6);
    background: var(--paper-card);
    border-top: var(--border-width) solid var(--line);
    border-bottom: var(--border-width) solid var(--line);
}
.pricing-card {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    padding: var(--space-8);
    background: var(--paper);
    border: 2px solid var(--gold);
    border-radius: var(--radius-xl);
    cursor: default;
    transition: box-shadow var(--transition);
}
.pricing-card:hover { box-shadow: var(--shadow-md); }
.pricing-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-4);
    background: var(--gold-bg);
    color: var(--gold-text);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    margin-bottom: var(--space-4);
}
.pricing-card h3 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    margin: 0 0 var(--space-4);
}
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-6);
    text-align: left;
}
.pricing-features li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    color: var(--pub-secondary);
}
.pricing-features li svg { width: 18px; height: 18px; color: var(--success); flex-shrink: 0; }

/* ═══ FAQ Accordion ═══ */
.faq-section { padding: var(--space-12) var(--space-6); }
.faq-list { max-width: 700px; margin: 0 auto; }
.faq-item {
    border-bottom: var(--border-width) solid var(--line);
    transition: background var(--transition-fast);
}
.faq-item:hover { background: var(--paper-hover); }
.faq-item.open { background: var(--paper-hover); }
.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-4);
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    min-height: 44px;
    transition: color var(--transition-fast);
}
.faq-question:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius);
}
.faq-question:hover { color: var(--accent); }
.faq-question svg {
    width: 20px;
    height: 20px;
    transition: transform var(--transition);
    flex-shrink: 0;
    color: var(--pub-muted);
}
.faq-item.open .faq-question svg { transform: rotate(180deg); }
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow) var(--ease-out);
}
.faq-item.open .faq-answer { max-height: 300px; }
.faq-answer p {
    padding: 0 var(--space-4) var(--space-5);
    margin: 0;
    font-size: var(--text-sm);
    color: var(--pub-secondary);
    line-height: var(--leading-relaxed);
}

/* ═══ Footer ═══ */
.landing-footer {
    margin-top: auto;
    padding: var(--space-8) var(--space-6);
    border-top: var(--border-width) solid var(--line);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--pub-muted);
}
.landing-footer-links {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}
.landing-footer-links a { color: var(--pub-secondary); }
.landing-footer-links a:hover { color: var(--ink); }

/* ═══ LOGIN PAGE ═══ */
.login-wrapper {
    flex: 1;
    display: flex;
    align-items: safe center;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}
.login-page {
    display: flex;
    align-items: safe center;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    padding: var(--space-6);
    --pub-secondary: oklch(0.35 0.03 85);
    --pub-muted: oklch(0.38 0.02 90);
}
@media (prefers-color-scheme: dark) {
    .login-page {
        --pub-secondary: oklch(0.78 0.02 95);
        --pub-muted: oklch(0.72 0.015 95);
    }
}
.login-card {
    background: var(--paper-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-8);
    width: 100%;
    max-width: 420px;
    border: var(--border-width) solid var(--line);
    max-height: calc(100vh - var(--space-12));
    overflow-y: auto;
    overscroll-behavior: contain;
}
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-8);
    border-bottom: 2px solid var(--line);
}
.login-tab {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--pub-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    min-height: 44px;
}
.login-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.login-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.login-tab:hover { color: var(--ink); }
.login-form { display: none; }
.login-form.active { display: block; }

.form-group { margin-bottom: var(--space-4); }
.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--pub-secondary);
    margin-bottom: var(--space-1);
}
.form-group input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
    transition: border-color var(--transition-fast);
    min-height: 44px;
}
.form-group input::placeholder { color: var(--pub-muted); }
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.form-error { font-size: var(--text-xs); color: var(--danger); margin-top: var(--space-1); min-height: 1.2em; }
.login-btn { width: 100%; margin-top: var(--space-2); }

.login-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--pub-muted);
    font-size: var(--text-sm);
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: var(--border-width);
    background: var(--line);
}
.login-oauth-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--space-3); }

.login-toggle { text-align: center; margin-top: var(--space-6); font-size: var(--text-sm); color: var(--pub-muted); }
.login-toggle button { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.login-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.login-toggle button:hover { color: var(--accent-hover); }

.login-api-error {
    background: var(--danger-bg);
    color: var(--danger);
    font-size: var(--text-sm);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    display: none;
}
.login-api-error:not(:empty) { display: block; }

/* ═══ SHARE PAGE ═══ */
.share-content {
    flex: 1;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-10) var(--space-6);
}
.share-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    margin: 0 0 var(--space-2);
}
.share-date { font-size: var(--text-sm); color: var(--pub-muted); margin-bottom: var(--space-8); }
.share-note-content { line-height: var(--leading-relaxed); }
.share-note-content h1, .share-note-content h2, .share-note-content h3 {
    font-family: var(--font-display);
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
}
.share-note-content h1 { font-size: var(--text-2xl); }
.share-note-content h2 { font-size: var(--text-xl); }
.share-note-content h3 { font-size: var(--text-lg); }
.share-note-content p { margin: 0 0 var(--space-4); }
.share-note-content pre {
    background: var(--paper-hover);
    padding: var(--space-4);
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}
.share-note-content code {
    background: var(--paper-hover);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}
.share-note-content pre code { background: none; padding: 0; }
.share-note-content blockquote {
    border-left: 3px solid var(--accent);
    margin: var(--space-4) 0;
    padding: var(--space-1) var(--space-4);
    color: var(--pub-secondary);
}
.share-note-content img { max-width: 100%; border-radius: var(--radius); }
.share-note-content table { border-collapse: collapse; width: 100%; margin: var(--space-4) 0; }
.share-note-content td, .share-note-content th {
    border: var(--border-width) solid var(--line);
    padding: var(--space-2) var(--space-3);
    text-align: left;
}
.share-note-content th { background: var(--paper-hover); font-weight: var(--weight-semibold); }

.share-password {
    max-width: 400px;
    margin: var(--space-16) auto;
    text-align: center;
    padding: var(--space-8);
    background: var(--paper-card);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-xl);
}
.share-password h2 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.share-password p { font-size: var(--text-sm); color: var(--pub-muted); margin: 0 0 var(--space-6); }
.share-password .form-error { margin-top: var(--space-3); }

.share-e2e-banner {
    background: var(--accent-bg);
    color: var(--accent);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    text-align: center;
    margin: var(--space-10) auto;
    max-width: 500px;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.share-error { text-align: center; padding: var(--space-16) var(--space-6); }
.share-error h2 { font-family: var(--font-display); font-size: var(--text-2xl); margin: 0 0 var(--space-3); }
.share-error p { color: var(--pub-muted); margin: 0 0 var(--space-6); }

.share-skeleton {
    animation: shimmer 1.5s infinite;
    background: linear-gradient(90deg, var(--paper-hover) 0%, var(--paper-active) 40%, var(--paper-hover) 80%);
    background-size: 200% 100%;
    border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.share-skeleton-title { height: 36px; width: 60%; margin-bottom: var(--space-3); }
.share-skeleton-date { height: 16px; width: 30%; margin-bottom: var(--space-8); }
.share-skeleton-line { height: 16px; width: 100%; margin-bottom: var(--space-3); }
.share-skeleton-line:last-child { width: 70%; }

.share-footer {
    margin-top: auto;
    padding: var(--space-6);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--pub-muted);
    border-top: var(--border-width) solid var(--line);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
    .hero-title { font-size: var(--text-2xl); }
    .hero { padding: var(--space-10) var(--space-4) var(--space-10); }
    .features-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
    .steps-list { flex-direction: column; align-items: center; gap: var(--space-4); }
    .steps-list::before { display: none; }
    .step { flex: 0 0 auto; }
    .screenshots-grid { grid-template-columns: 1fr; max-width: 500px; }
}

@media (max-width: 600px) {
    .features-grid { grid-template-columns: 1fr; }
    .hero-title { font-size: var(--text-xl); }
    .hero-subtitle { font-size: var(--text-base); }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .public-header { padding: var(--space-3) var(--space-4); flex-wrap: wrap; }
    .login-card { padding: var(--space-6); max-width: 100%; }
    .share-content { padding: var(--space-6) var(--space-4); }
    .section-title { font-size: var(--text-xl); }
    .faq-question { font-size: var(--text-sm); }
}

@media (prefers-reduced-motion: reduce) {
    .share-skeleton { animation: none; }
    .spinner { animation: none; }
}

/* ── Доступность ──────────────────────────────────────
   Обе утилиты были только в style.css, который публичные страницы не
   подключают: .sr-only не работал вовсе, а перейти к содержимому с
   клавиатуры было нельзя — приходилось табать сквозь всю шапку. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.skip-link {
    position: absolute;
    top: -9999px;
    left: var(--space-4);
    z-index: var(--z-toast);
    padding: var(--space-2) var(--space-4);
    background: var(--color-accent);
    color: var(--accent-text);
    border-radius: var(--radius);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-2);
}
