/* ===================================================================
    AHOK.AS theme - Base
=================================================================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--page);
    padding: 2.5rem 1rem;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius);
}

.icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    fill: currentColor;
}

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

/* Primary button: ink by default, brand accent on hover */
.button-primary {
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--on-ink);
    background: var(--ink);
    border: none;
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.button-primary:hover:not(:disabled) {
    background: var(--accent);
}

.button-primary:active:not(:disabled) {
    transform: translateY(1px) scale(0.99);
}

.button-primary:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* Theme toggle: top-right corner of the page */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    font-size: 1.15rem;
    color: var(--muted);
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sheet);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

/* ahok.as addition: the button stays hidden until theme-toggle.js runs,
   so visitors without JavaScript never see an empty, dead button. */
.theme-toggle[hidden] {
    display: none;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle:active {
    transform: translateY(1px) scale(0.97);
}

/* Below this width the content reaches the corner, so give the button its own space */
@media (max-width: 1000px) {
    body {
        padding-top: 4rem;
    }
}

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

/* ===================================================================
   Shared ahok.as components
   =================================================================== */

/* Sheet: the white (or dark) page card, as on the CV */
.sheet {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem;
    background: var(--sheet);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sheet);
}

@media (max-width: 600px) {
    .sheet {
        padding: 2rem 1.25rem;
    }
}

/* Site footer: same text on every *.ahok.as site */
.site-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}

/* Code blocks */
code,
pre {
    font-family: var(--font-mono);
}

pre {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    tab-size: 4;
}

@media (max-width: 600px) {
    pre {
        font-size: 0.8rem;
        padding: 0.85rem 1rem;
    }
}

/* Card page: one centred card, for simple pages like a front page or an
   "offline" notice. Markup:
   <main class="card-page"><div class="card">
       <h1 class="card-title">...</h1>
       <img class="card-image" ...>   (optional)
       <footer class="site-footer">...</footer>
   </div></main> */
.card-page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 2rem 0;
    margin: -2.5rem 0; /* cancel the body padding so the card centres in the viewport */
}

.card {
    width: 100%;
    max-width: 560px;
    padding: 3rem 2.5rem 1.5rem;
    background: var(--sheet);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sheet);
    text-align: center;
    animation: card-fade-in 0.5s var(--ease-out);
}

.card-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1.15;
    color: var(--ink);
}

.card-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2rem auto 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

@keyframes card-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1000px) {
    .card-page {
        margin-top: -4rem; /* matches the larger top padding used at this width */
    }
}

@media (max-width: 480px) {
    .card {
        padding: 2.25rem 1.5rem 1.25rem;
    }

    .card-title {
        font-size: 1.75rem;
    }
}
