/* Reset, typography and layout primitives.
   Depends on tokens.css for every value — no literals below. */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

body {
    margin: 0;
    font: 400 16px/1.6 var(--font-body);
    color: var(--text-body);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .5em;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-heading);
    text-wrap: balance;
}

h1 { font-size: clamp(26px, 4vw, 34px); letter-spacing: var(--ls-tight); }
h2 { font-size: clamp(21px, 3vw, 26px); }
h3 { font-size: clamp(17px, 2.4vw, 20px); }

p {
    margin: 0 0 1rem;
    text-wrap: pretty;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

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

/* Visible focus for keyboard users only. Removing focus outlines outright is
   an accessibility failure; :focus-visible keeps them off mouse clicks. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-xs);
}

img,
picture,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

fieldset {
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
}

legend {
    padding: 0;
    font: 600 15px/1.3 var(--font-display);
    color: var(--text-heading);
}

/* Layout ------------------------------------------------------------------ */

.igm-container {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 16px;
}

.igm-container--narrow {
    max-width: 780px;
}

.igm-site {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.igm-main {
    flex: 1 0 auto;
    padding-block: 26px 40px;
}

/* Accessibility ----------------------------------------------------------- */

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 12px 18px;
    background: var(--navy-700);
    color: var(--white);
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
    left: 0;
    top: 0;
    color: var(--white);
    text-decoration: none;
}

/* Honour the OS "increase contrast" setting. */
@media (prefers-contrast: more) {
    :root {
        --gray-600: #4a4a4a;
        --gray-500: #5c5c5c;
    }
}

/* Comments ---------------------------------------------------------------- */

.igm-comments {
    margin-top: 36px;
    padding-top: 26px;
    border-top: 1px solid var(--gray-200);
}

.igm-comments__title {
    margin-bottom: 16px;
    font-size: 20px;
}

.igm-comments__list {
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.igm-comments__list ol.children {
    margin: 14px 0 0 20px;
    padding: 0;
    list-style: none;
}

.igm-comments__list .comment-body {
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-200);
}

.igm-comments__closed {
    font: 13.5px/1.6 var(--font-body);
    color: var(--gray-600);
}

/* Post navigation --------------------------------------------------------- */

.post-navigation {
    display: grid;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

@media (min-width: 640px) {
    .post-navigation .nav-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .post-navigation .nav-next {
        text-align: right;
    }
}

.post-navigation a {
    font: 600 14px/1.5 var(--font-body);
}

/* Shop archives run a 6-up product grid beside a 260px filter sidebar. At the
   standard 1180px measure that leaves ~137px per card — too narrow for an
   image, title, price and button. The archive gets more room instead, and only
   once the viewport can actually spare it. */
@media (min-width: 1360px) {
    .igm-container--wide { max-width: 1440px; }
}

/* Placeholders sit at --gray-450, one step lighter than body-muted text.
   A placeholder is exempt from the contrast rules precisely because it is not
   content — it must read as a prompt, not as a filled-in value. Anything the
   user actually has to read uses --gray-500. */

::placeholder {
    color: var(--gray-450);
    opacity: 1; /* Firefox dims placeholders further by default. */
}

:disabled,
[aria-disabled="true"] {
    cursor: not-allowed;
}
