/*
 * matty.page: main stylesheet
 *
 * Copyright (c) 2026 matty.page
 * Licensed under the GNU General Public License, version 3.
 * See the LICENSE file in the repository root for the full licence text.
 *
 * Targets: Safari 15.4+, Chrome 86+, Firefox 85+.
 * Logical properties (margin-inline) are deliberately avoided because
 * Chrome 86 does not support them. Physical margins are used instead.
 */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Colours */
    --colour-body: #24232e;
    --colour-chrome: #3c3760;
    --colour-text: #d1d1d1;
    --colour-text-hover: #d4d4d4;
    --colour-focus: #70a7ff;
    --colour-rule: #70a7ff;

    /* Type */
    --font-heading: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-body: Georgia, "Times New Roman", Times, serif;
    --font-size-base: 1.125rem;
    --line-height-base: 1.6;

    /* Layout */
    --measure: 42rem;
    --gutter: 1rem;
}

/* ==========================================================================
   2. Base
   ========================================================================== */

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

body {
    margin: 0;
    background-color: var(--colour-body);
    color: var(--colour-text);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
}

/* ==========================================================================
   3. Links and focus
   ========================================================================== */

a {
    color: var(--colour-text);
    text-decoration: underline;
}

a:hover {
    color: var(--colour-text-hover);
}

:focus-visible {
    outline: 2px solid var(--colour-focus);
    outline-offset: 2px;
}

/* ==========================================================================
   4. Layout wrappers
   The coloured bands stay on <header> and <footer> at full viewport width.
   The wrappers below carry the reading measure and the centring.
   ========================================================================== */

.header-inner,
.article-inner,
.footer-inner {
    max-width: var(--measure);
    margin-left: auto;
    margin-right: auto;
    padding: var(--gutter);
}

/* ==========================================================================
   5. Header
   ========================================================================== */

.site-header {
    background-color: var(--colour-chrome);
}

.site-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* The site title is the one link that is not underlined. */
.site-title a {
    text-decoration: none;
}

.site-title a:hover {
    text-decoration: underline;
}

/* The paperclip sits inside the <h1>, so 1em resolves against the heading's
   own font-size and the icon scales with the text. The fill is currentColor,
   so the icon always matches the text colour, including on hover and in print. */
.site-icon {
    width: 1em;
    height: 1em;
    margin-right: 0.35em;
    vertical-align: -0.125em;
}

/* ==========================================================================
   6. Article
   ========================================================================== */

.article-inner {
    margin-bottom: 3rem;
    overflow-wrap: break-word;
}

h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h2 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.875rem;
}

h3 {
    margin: 2rem 0 0.75rem;
    font-size: 1.375rem;
}

p {
    margin: 0 0 1.5rem;
}

.article-date {
    margin: 0 0 2rem;
    font-size: 1rem;
}

ul {
    margin: -1rem 0 1.25rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   7. Blockquote
   ========================================================================== */

blockquote {
    margin: 0 0 1.5rem;
    padding-left: 1.25rem;
    border-left: 3px solid var(--colour-rule);
}

blockquote p {
    margin-bottom: 0.75rem;
}

blockquote footer {
    font-style: italic;
}

/* ==========================================================================
   8. Aside (call-out)

   No tinted background, so the text stays at #afafaf on #303030 (6.02:1).
   The distinction comes from the larger type and the surrounding space.
   ========================================================================== */

aside {
    margin: 1.5rem;
    font-size: 1.25em;
}

/* ==========================================================================
   9. Figure
   The margin reset overrides the browser default of 1em 40px, without which
   the image would not line up with the width of the body text.
   ========================================================================== */

figure {
	margin-top: 2.5rem;
    margin-bottom: 2rem;
	margin-left: 0;
	margin-right: 0;
    break-inside: avoid;
}

figure img {
    display: block;
    width: 100%;
    height: auto;
}

figcaption {
    margin-top: 0.5rem;
    font-size: 1rem;
    text-align: right;
}

/* ==========================================================================
   10. Footer
   ========================================================================== */

.site-footer {
    background-color: var(--colour-chrome);
}

.site-footer p {
    margin: 0;
}
