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

/* === Base === */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #fff;
    color: #111;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Page container === */
.page {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Centered input area === */
.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    transition: min-height 0.4s ease, justify-content 0.4s ease;
}

.centered.top {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 48px;
}

/* === URL Form — redesigned === */
.url-form {
    width: 100%;
    max-width: 480px;
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.input-wrap input[type="text"] {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    color: #111;
    font-family: inherit;
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.input-wrap input[type="text"]:focus {
    border-color: #111;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.input-wrap input::placeholder {
    color: #bbb;
}

/* === Paste button === */
.paste-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    color: #aaa;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.paste-btn:hover {
    color: #111;
    border-color: #ccc;
    background: #f0f0f0;
}

/* === Help icon with tooltip === */
.help-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    color: #ccc;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: default;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.help-icon:hover {
    color: #888;
    border-color: #aaa;
}

.tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: -8px;
    width: 260px;
    padding: 14px 16px;
    background: #111;
    color: #eee;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.55;
    border-radius: 10px;
    z-index: 10;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 18px;
    border: 6px solid transparent;
    border-bottom-color: #111;
}

.help-icon:hover .tooltip {
    display: block;
}

/* === Spinner === */
.spinner {
    text-align: center;
    padding: 48px 0;
}

.loading-bar {
    width: 48px;
    height: 2px;
    background: #eee;
    border-radius: 1px;
    margin: 0 auto 16px;
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 50%;
    height: 100%;
    background: #111;
    border-radius: 1px;
    animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
    0% { left: -50%; }
    100% { left: 100%; }
}

.spinner p {
    color: #aaa;
    font-size: 0.875rem;
}

/* === Error === */
.error {
    max-width: 480px;
    margin: 20px auto 0;
    padding: 14px 18px;
    border-left: 2px solid #e55;
    background: #fef8f8;
    color: #a33;
    font-size: 0.9375rem;
}

/* === Dual Columns === */
.dual-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 16px;
}

.column {
    min-width: 0; /* prevent overflow */
}

.column-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

/* === Meta (dev mode only) === */
.meta {
    padding: 10px 14px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    font-size: 0.6875rem;
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 16px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.meta b {
    color: #777;
    font-family: 'Inter', sans-serif;
}

/* === Share link === */
.share-link {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 0.75rem;
    color: #bbb;
    text-decoration: none;
    border-bottom: 1px dashed #ddd;
    transition: color 0.15s;
}

.share-link:hover {
    color: #666;
}

/* === Article typography === */
.article {
    margin-top: 0;
}

.article h1 {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.625rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #111;
    margin-bottom: 24px;
}

.article h2 {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: #111;
    margin-top: 36px;
    margin-bottom: 14px;
}

.article h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111;
    margin-top: 28px;
    margin-bottom: 8px;
}

.article p {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #222;
    margin-bottom: 16px;
}

.article ul, .article ol {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #222;
    margin: 12px 0 16px;
    padding-left: 22px;
}

.article li {
    margin-bottom: 6px;
}

.article li::marker {
    color: #ccc;
}

.article strong {
    font-weight: 600;
    color: #111;
}

.article em {
    font-style: italic;
}

.article blockquote {
    border-left: 2px solid #ddd;
    padding: 2px 18px;
    margin: 20px 0;
    color: #555;
    font-style: italic;
}

.article hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 32px 0;
}

.article table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.article th, .article td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.article th {
    font-weight: 600;
    color: #666;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #ddd;
}

.article a {
    color: #111;
    text-decoration: underline;
    text-decoration-color: #ccc;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s;
}

.article a:hover {
    text-decoration-color: #111;
}

/* === Upgrade to Pro link === */
.upgrade-link {
    text-align: center;
    margin: 40px 0 16px;
}

.pro-upgrade {
    font-size: 0.8125rem;
    color: #999;
    text-decoration: none;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 1px;
    transition: color 0.15s;
}

.pro-upgrade:hover {
    color: #111;
}

.pro-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 40px 0;
}

.pro-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

/* === Back link (article page) === */
.back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: #aaa;
    text-decoration: none;
    transition: color 0.15s;
}

.back-link:hover {
    color: #111;
}

/* === YouTube source link === */
.source-link {
    display: inline-block;
    margin-bottom: 28px;
    font-size: 0.8125rem;
    color: #bbb;
    text-decoration: none;
    transition: color 0.15s;
}

.source-link:hover {
    color: #666;
}

/* === Single article page — narrower === */
.page-single {
    max-width: 680px;
}

/* === Mobile === */
@media (max-width: 900px) {
    .dual-columns {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .column-header {
        padding-top: 16px;
    }
}

@media (max-width: 600px) {
    .page {
        padding: 0 20px 60px;
    }

    .centered {
        min-height: 60vh;
    }

    .url-form {
        max-width: 100%;
    }

    .tooltip {
        width: 220px;
        right: -4px;
    }

    .article h1 {
        font-size: 1.35rem;
    }

    .article h2 {
        font-size: 1.1rem;
    }

    .article p, .article li {
        font-size: 0.9375rem;
        line-height: 1.75;
    }
}
