/* Blog / writing pages only — snapshot of pre–A4-revamp main.css body styles */

html {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
    background-color: #f4f4f5;
    background-image: repeating-linear-gradient(135deg, rgba(228, 228, 231, 1) 0, rgba(228, 228, 231, 1) 1px, transparent 1px, transparent 18px);
}

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

body {
    margin: 0 auto;
    width: 100%;
    max-width: 42rem;
    line-height: 1.6;
    font-size: 16px;
    color: #444;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    text-align: justify;
    text-justify: inter-word;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #e4e4e7;
    padding: 1.25rem;
    box-sizing: border-box;
}

/* Viewport corner — not inside the centered body card */
body > a[href="/"] {
    position: fixed;
    top: 4px;
    left: 4px;
    z-index: 100;
    margin: 0;
}

h1,
h2,
h3 {
    line-height: 1.2;
}

h1 {
    margin: 0 0 0.4rem;
}

h2,
h3 {
    margin: 1.25rem 0 0.4rem;
}

p {
    margin: 0.6rem 0;
}

a {
    color: #555;
    text-decoration: none;
    border-bottom: 1px solid #bbb;
    padding: 0 0.1em;
}

a:hover {
    color: #000;
    border-bottom-color: #000;
}

hr {
    border: 0;
    border-top: 1px solid #ddd;
    margin: 1.2rem 0;
}

mark {
    background: #f0f0f0;
    color: inherit;
    padding: 0 0.15em;
}

img {
    text-align: center;
    margin: 1rem 0;
}

.blog-figure {
    margin: 1rem 0;
    text-align: center;
}

.blog-figure img {
    margin: 1rem 0;
}

.blog-figure--half img {
    width: 50%;
}

.blog-figure--stack img {
    width: 100%;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.blog-figure--stack img:first-child {
    margin-bottom: 0;
}

.blog-figure--stack img:last-child {
    margin-top: 0;
}

@media (max-width: 640px) {
    html {
        padding: 0;
        align-items: stretch;
    }

    body {
        width: 100%;
        max-width: none;
        padding: 1rem;
        margin: 0;
        box-sizing: border-box;
    }

    .blog-figure--half img {
        width: 100%;
    }
}

/* Tooltip */
[data-tooltip] {
    position: relative;
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: block;
    width: max-content;
    padding: 6px 10px;
    background: #333;
    color: white;
    font-size: 14px;
    max-width: min(52ch, 92vw);
    white-space: normal;
    overflow-wrap: break-word;
    text-align: left;
    text-justify: auto;
    border-radius: 4px;
    margin-bottom: 5px;
    z-index: 1000;
    pointer-events: none;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    margin-bottom: -5px;
    z-index: 1000;
    pointer-events: none;
}
