/* =============================================================================
   1. Fonts
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');


/* =============================================================================
   2. Custom properties
   ============================================================================= */

:root {
    --font-sans: 'Inter', system-ui, sans-serif;

    /* Palette */
    --color-bg: #ffffff;
    --color-text: #111111;
    --color-muted: #666666;
    --color-border: #e5e5e5;

    /* Ghost injects --ghost-accent-color from admin → Design → Brand */

    /* Spacing scale (4-point) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 40px;
    --space-6: 64px;

    /* Type scale */
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
}


/* =============================================================================
   3. Reset / base
   ============================================================================= */

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
video {
    max-width: 100%;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    line-height: 1.25;
}

p {
    margin: 0;
}

a {
    color: var(--ghost-accent-color, #000);
}

ul, ol {
    padding-left: var(--space-4);
}


/* =============================================================================
   4. Layout
   ============================================================================= */

.gh-viewport {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.gh-main {
    flex: 1;
}

.gh-main--home {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6) var(--space-4);
}


/* =============================================================================
   5. Components
   ============================================================================= */

/* --- Header --- */

.gh-head {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.gh-head-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.gh-head-logo {
    font-size: var(--text-base);
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text);
    flex-shrink: 0;
}

.gh-head-logo img {
    height: 32px;
    width: auto;
    display: block;
}

.gh-head-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--space-4);
}

.gh-head-nav a {
    font-size: var(--text-sm);
    color: var(--color-text);
    text-decoration: none;
}

.gh-head-nav a:hover {
    color: var(--ghost-accent-color, #000);
}


/* --- Footer --- */

.gh-foot {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.gh-foot-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.gh-foot-link {
    font-size: var(--text-sm);
    color: var(--color-muted);
    text-decoration: none;
}

.gh-foot-link:hover {
    color: var(--ghost-accent-color, #000);
}

.gh-foot-copy {
    font-size: var(--text-sm);
    color: var(--color-muted);
    margin: 0;
}


/* --- Subscribe block --- */

.gh-subscribe {
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.gh-subscribe-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    margin: 0 0 var(--space-3);
}

.gh-subscribe-description {
    font-size: var(--text-lg);
    color: var(--color-muted);
    margin: 0 0 var(--space-5);
    line-height: 1.6;
}

.gh-subscribe-signin {
    margin: var(--space-3) 0 0;
    font-size: var(--text-sm);
    color: var(--color-muted);
}

.gh-subscribe-signin a {
    color: var(--ghost-accent-color, #000);
    text-decoration: none;
}

.gh-subscribe-signin a:hover {
    text-decoration: underline;
}


/* --- Button --- */

.gh-btn {
    display: inline-block;
    padding: var(--space-3) var(--space-5);
    background: var(--ghost-accent-color, #111);
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 500;
    line-height: 1;
    transition: opacity 0.15s ease;
    cursor: pointer;
}

.gh-btn:hover {
    opacity: 0.85;
    color: #ffffff;
}

.gh-btn:focus-visible {
    outline: 2px solid var(--ghost-accent-color, #111);
    outline-offset: 3px;
}


/* --- Article --- */

.gh-article {
    max-width: 720px;
    margin: var(--space-6) auto;
    padding: 0 var(--space-4);
}

.gh-article-header {
    margin-bottom: var(--space-5);
}

.gh-article-image {
    margin: 0 0 var(--space-5);
}

.gh-article-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.gh-article-title {
    font-size: var(--text-3xl);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 var(--space-3);
}

.gh-article-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.gh-article-date {
    font-size: var(--text-sm);
    color: var(--color-muted);
}


/* --- Article content --- */

.gh-article-content {
    font-size: var(--text-lg);
    line-height: 1.75;
}

.gh-article-content > * + * {
    margin-top: var(--space-4);
}

.gh-article-content h2 {
    font-size: var(--text-2xl);
    font-weight: 600;
    margin-top: var(--space-6);
}

.gh-article-content h3 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-top: var(--space-5);
}

.gh-article-content h4,
.gh-article-content h5,
.gh-article-content h6 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-top: var(--space-5);
}

.gh-article-content p {
    margin: 0;
}

.gh-article-content a {
    color: var(--ghost-accent-color, #000);
}

.gh-article-content img {
    max-width: 100%;
    border-radius: 4px;
}

.gh-article-content blockquote {
    border-left: 3px solid var(--ghost-accent-color, #111);
    margin: var(--space-4) 0;
    padding: var(--space-2) var(--space-4);
    color: var(--color-muted);
    font-style: italic;
}

.gh-article-content blockquote p {
    margin: 0;
}

.gh-article-content pre {
    background: #f5f5f5;
    padding: var(--space-4);
    border-radius: 4px;
    overflow-x: auto;
    font-size: var(--text-sm);
    line-height: 1.6;
}

.gh-article-content code {
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: #f5f5f5;
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

.gh-article-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.gh-article-content ul,
.gh-article-content ol {
    padding-left: var(--space-5);
}

.gh-article-content li + li {
    margin-top: var(--space-2);
}

.gh-article-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-5) 0;
}

.gh-article-content figure {
    margin: var(--space-4) 0;
}

.gh-article-content figcaption {
    font-size: var(--text-sm);
    color: var(--color-muted);
    text-align: center;
    margin-top: var(--space-2);
}


/* =============================================================================
   6. Koenig card styles
   ============================================================================= */

/* Width overrides — cards can break out of the article column */
.gh-article-content .kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: var(--space-4) calc(50% - 42.5vw);
}

.gh-article-content .kg-width-full {
    position: relative;
    width: 100vw;
    margin: var(--space-4) calc(50% - 50vw);
}

/* Gallery card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.kg-gallery-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.kg-gallery-image {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

/* Bookmark card */
.kg-bookmark-card {
    width: 100%;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    color: var(--color-text);
}

.kg-bookmark-container:hover {
    border-color: var(--ghost-accent-color, #111);
}

.kg-bookmark-content {
    flex: 1 1 auto;
    padding: var(--space-3);
    min-width: 0;
}

.kg-bookmark-title {
    font-size: var(--text-base);
    font-weight: 500;
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-bookmark-description {
    font-size: var(--text-sm);
    color: var(--color-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-muted);
}

.kg-bookmark-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.kg-bookmark-author {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-bookmark-publisher {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-bookmark-thumbnail {
    flex: 0 0 120px;
    overflow: hidden;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
}


/* =============================================================================
   7. Utilities
   ============================================================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
