/*!
 * slightwater.css — a classless stylesheet in the manner of water.css,
 * derived from slightknack.dev's reset.css + base.css.
 *
 * Drop it in and write plain HTML: no classes, no build step.
 * Light and dark themes follow the system preference.
 *
 * Fonts: the slightknack.dev faces (Ibarra Real Nova, Texturina,
 * IBM Plex Mono, Archivo Narrow), vendored in the fonts/ folder next to
 * this file — keep the two together.
 */

/* ---- fonts (fonts.css, families used by base.css) --------------------- */

@font-face {
    font-family: "Archivo Narrow";
    src: url("fonts/archivo-narrow-regular.ttf");
    font-display: swap;
}

@font-face {
    font-family: "Archivo Narrow";
    src: url("fonts/archivo-narrow-bold.ttf");
    font-weight: bold;
    font-display: swap;
}

@font-face {
    font-family: "Texturina";
    src: url("fonts/texturina-variable.ttf");
    font-display: swap;
}

@font-face {
    font-family: "Texturina";
    src: url("fonts/texturina-variable-italic.ttf");
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("fonts/plex-mono-regular.ttf");
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("fonts/plex-mono-italic.ttf");
    font-style: italic;
    font-display: swap;
}

@font-face {
    size-adjust: 115%;
    font-family: "Ibarra";
    src: url("fonts/ibarra-variable.ttf");
    font-display: swap;
}

@font-face {
    size-adjust: 115%;
    font-family: "Ibarra";
    src: url("fonts/ibarra-variable-italic.ttf");
    font-style: italic;
    font-display: swap;
}

/* ---- reset (Meyer v2.0, public domain, as used by the original) ------ */

html, body, div, span, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}

blockquote, q { quotes: none; }
blockquote::before, blockquote::after,
q::before, q::after { content: ""; content: none; }

table { border-collapse: collapse; border-spacing: 0; }

/* One departure from the original reset: predictable sizing for forms. */
*, *::before, *::after { box-sizing: border-box; }

/* ---- design tokens ---------------------------------------------------- */

:root {
    --fill-bg: #f7f2ed;
    --fill-text: #0f0e0b;
    /* should both be close to bg color */
    --fill-accent: #3a5a8a;
    --fill-soft: #d8dbe0;

    --font-base: 14pt;
    --font-heading: 20pt;
    --font-body: "Ibarra", serif, sans-serif;
    --font-title: "Texturina", serif;
    --font-mono: "IBM Plex Mono", monospace;
    --font-narrow: "Archivo Narrow", sans-serif;

    --line-height-body: 1.7;
    --line-height-narrow: 1.4;
    --line-height-heading: 1.1;
    --line-height-heading-link: 1.5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fill-text: #f7f2ed;
        --fill-bg: #0f0e0b;
        --fill-accent: #9eb5d7;
        --fill-soft: #242932;
    }
}

::selection {
    background: var(--fill-accent);
    color: var(--fill-bg);
}

/* ---- page ------------------------------------------------------------- */

html {
    color-scheme: light dark;
}

body {
    background-color: var(--fill-bg);
    color: var(--fill-text);
    font-family: var(--font-body);
    font-size: var(--font-base);
    line-height: var(--line-height-body);

    /* the .narrow column, made classless */
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    padding: 20pt;
    padding-top: 40pt;
    padding-bottom: 40pt;
}

p {
    font-size: var(--font-base);
    margin-top: 20pt;
    margin-bottom: 20pt;
    text-wrap: pretty;
}

/* ---- headings ----------------------------------------------------------
 * Sizes converge on the base size: 14pt + 20pt/n.
 */

h1, h2, h3, h4, h5, h6 {
    line-height: var(--line-height-heading);
    letter-spacing: 0.05em;
    hyphens: auto;
    margin-top: 40pt;
    margin-bottom: 20pt;
    font-family: var(--font-title);
    font-weight: 900;
    text-wrap: balance;
}

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
    line-height: var(--line-height-heading-link);
}

h1 { font-size: calc(var(--font-base) + var(--font-heading) / 2); }
h2 { font-size: calc(var(--font-base) + var(--font-heading) / 3); }
h3 { font-size: calc(var(--font-base) + var(--font-heading) / 4); }
h4 { font-size: calc(var(--font-base) + var(--font-heading) / 5); }
h5 { font-size: calc(var(--font-base) + var(--font-heading) / 6); }
h6 { font-size: calc(var(--font-base) + var(--font-heading) / 7); }

/* ---- inline text -------------------------------------------------------- */

em, i { font-style: italic; }
strong, b { font-weight: bolder; }
del, s { opacity: 0.7; text-decoration: line-through; }
u, ins { text-decoration: underline; }
small { font-size: 0.8em; }

sub, sup { font-size: 0.75em; line-height: 0; position: relative; }
sub { vertical-align: baseline; bottom: -0.25em; }
sup { vertical-align: baseline; top: -0.5em; }

abbr[title] {
    text-decoration: underline dotted 2px;
    text-underline-offset: 3px;
    cursor: help;
}

mark {
    background: var(--fill-accent);
    color: var(--fill-bg);
    padding: 0 2px;
    border-radius: 2px;
}

/* ---- links --------------------------------------------------------------
 * The signature move: an accent underline that floods upward on hover.
 */

a {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid var(--fill-accent);

    background-image: linear-gradient(
        0deg,
        var(--fill-accent) 0%,
        var(--fill-accent) 100%
    );
    background-repeat: no-repeat;
    background-size: 100% 0;
    background-position: 0 100%;
    transition:
        background-size 100ms ease,
        color 100ms ease;
}

a:hover,
a:active,
a:focus {
    background-size: 100% 100%;
    color: var(--fill-bg);
}

:focus-visible {
    outline: 2px dashed var(--fill-accent);
    outline-offset: 2px;
}

/* ---- code ---------------------------------------------------------------- */

pre {
    font-family: var(--font-mono), monospace;
    overflow: auto;
    padding: 20pt;
    margin-top: 20pt;
    margin-bottom: 20pt;
    background-color: var(--fill-soft);
    border-radius: 2px;
}

code, kbd, samp {
    font-family: var(--font-mono), monospace;
    background-color: var(--fill-soft);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    hyphens: none;
    padding: 2px;
    border-radius: 2px;
}

kbd {
    border: 2px solid var(--fill-text);
    border-radius: 2px;
    padding: 0 4px;
    font-size: 0.85em;
}

pre code {
    white-space: pre;
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

/* ---- block elements -------------------------------------------------------- */

blockquote {
    margin-top: 20pt;
    margin-bottom: 20pt;
    padding-left: 20pt;
    border-left: 2px dashed var(--fill-text);
    font-family: var(--font-body);
}

hr {
    margin-top: 20pt;
    margin-bottom: 20pt;
    border: 0 solid var(--fill-text);
    border-top: 2px dashed var(--fill-text);
}

ol, ul { padding-left: 40pt; }
ul { list-style: disc outside none; }
ol { list-style: decimal outside none; }

li {
    margin-top: 10pt;
    margin-bottom: 10pt;
}

dt {
    font-family: var(--font-narrow);
    font-weight: bold;
    letter-spacing: 0.05em;
    margin-top: 10pt;
}

dd {
    margin-left: 20pt;
    margin-bottom: 10pt;
}

img, video {
    display: block;
    margin: 30pt auto;
    max-width: 100%;
    border-radius: 2px;
}

figure { margin: 30pt auto; }
figure img, figure video { margin: 0 auto; }

figcaption {
    font-family: var(--font-narrow);
    line-height: var(--line-height-narrow);
    text-align: center;
    opacity: 0.7;
    margin-top: 10pt;
}

canvas { width: 100%; height: inherit; }

/* ---- tables ------------------------------------------------------------------ */

table {
    margin-top: 20pt;
    margin-bottom: 20pt;
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
}

thead {
    white-space: nowrap;
    background-color: var(--fill-soft);
}

tr:nth-child(even) {
    background-color: var(--fill-soft);
}

td, th {
    border-right: 2px solid var(--fill-soft);
    padding: 0.8pt 20pt;
    text-align: start;
    text-wrap: balance;
}

td code, th code {
    background-color: inherit;
    white-space: nowrap;
}

td pre code, th pre code { white-space: pre; }

tr:nth-child(even) td,
thead th,
tr:nth-child(even) th {
    border-right: 2px solid var(--fill-bg);
}

th {
    font-family: var(--font-narrow);
    font-weight: bold;
    letter-spacing: 0.05em;
    vertical-align: bottom;
}

tr th:last-child,
tr td:last-child {
    border: none;
}

caption {
    font-family: var(--font-narrow);
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 10pt;
}

/* ---- details ------------------------------------------------------------------- */

summary::-webkit-details-marker { display: none; }

summary {
    display: block;
    cursor: pointer;
}

summary::before {
    content: "►";
    width: var(--font-base);
    display: inline-block;
    font-size: calc(var(--font-base) * 2 / 3);
}

details[open] summary::before {
    content: "▼";
}

/* ---- forms ---------------------------------------------------------------------
 * Not in the original base.css; extended here in the same voice —
 * narrow-face controls, 2px borders, soft fills, accent focus.
 */

button,
input,
select,
textarea {
    font-family: var(--font-narrow);
    font-size: calc(var(--font-base) * 0.9);
    line-height: var(--line-height-narrow);
    color: var(--fill-text);
    background-color: var(--fill-bg);
    border: 2px solid var(--fill-soft);
    border-radius: 2px;
    padding: 6pt 10pt;
    margin: 4pt 0;
    max-width: 100%;
    transition:
        border-color 100ms ease,
        background-color 100ms ease,
        color 100ms ease;
}

label, legend {
    font-family: var(--font-narrow);
    line-height: var(--line-height-narrow);
    letter-spacing: 0.05em;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--fill-accent);
    outline: none;
}

::placeholder {
    color: var(--fill-text);
    opacity: 0.45;
}

button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
    font-weight: bold;
    letter-spacing: 0.05em;
    background-color: var(--fill-soft);
    border-color: var(--fill-soft);
    cursor: pointer;
}

button:hover,
button:focus-visible,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover {
    background-color: var(--fill-accent);
    border-color: var(--fill-accent);
    color: var(--fill-bg);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"],
input[type="range"] {
    accent-color: var(--fill-accent);
    padding: 0;
    margin: 0 6pt 0 0;
    vertical-align: middle;
}

input[type="color"] { padding: 2pt; height: 2.2em; }
input[type="file"] { border-style: dashed; }

textarea {
    display: block;
    width: 100%;
    resize: vertical;
    font-family: var(--font-mono);
}

fieldset {
    border: 2px dashed var(--fill-soft);
    border-radius: 2px;
    padding: 10pt 20pt 20pt;
    margin: 20pt 0;
}

legend {
    font-weight: bold;
    padding: 0 6pt;
}

progress, meter {
    accent-color: var(--fill-accent);
    width: 100%;
}

output {
    font-family: var(--font-mono);
}

/* ---- misc ------------------------------------------------------------------------ */

dialog {
    background-color: var(--fill-bg);
    color: var(--fill-text);
    border: 2px solid var(--fill-text);
    border-radius: 2px;
    padding: 20pt;
    max-width: min(650px, 90vw);
}

dialog::backdrop {
    background: rgb(15 14 11 / 0.5);
}

footer {
    margin-top: 40pt;
    font-family: var(--font-narrow);
    line-height: var(--line-height-narrow);
    opacity: 0.7;
}
