/* Kernwerk — styles. Preserves the original kernwerk.org look:
   iA Writer Quattro type, light/night themes, wavy wordmark, dotted bars. */

* {
    font-family: 'iAWriterQuattroS', monospace;
    box-sizing: border-box;
}

@font-face {
    font-family: 'iAWriterQuattroS';
    src: local('iAWriterQuattroS'), url('./fonts/iAWriterQuattroS-Bold.woff2') format('woff2');
    font-weight: bold;
}
@font-face {
    font-family: 'iAWriterQuattroS';
    src: local('iAWriterQuattroS'), url('./fonts/iAWriterQuattroS-Regular.woff2') format('woff2');
    font-weight: normal;
}
@font-face {
    font-family: 'iAWriterQuattroS';
    src: local('iAWriterQuattroS'), url('./fonts/iAWriterQuattroS-Italic.woff2') format('woff2');
    font-style: italic;
}
@font-face {
    font-family: 'iAWriterQuattroS';
    src: local('iAWriterQuattroS'), url('./fonts/iAWriterQuattroS-BoldItalic.woff2') format('woff2');
    font-weight: bold;
    font-style: italic;
}

[data-theme="light"] {
    --red: #ee5253;
    --yellow: #ffa801;
    --green: #27ae60;
    --select: #00b894;
    --bg: #ecf0f1;
    --front: #34495e;
    --frontBrightText: #34495ea6;
    --frontBrightBorder: #34495e87;
    --codeBg: #272822fc;
    --disabled: #34495e42;
    --arrow: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
}

[data-theme="night"] {
    --red: #f35b5b;
    --yellow: #ffa801;
    --green: #00b894;
    --select: #00b894;
    --bg: #3a5168;
    --front: #ecf0f1;
    --frontBrightText: #ecf0f1;
    --frontBrightBorder: #ecf0f1;
    --codeBg: #3a5168;
    --disabled: #ecf0f157;
    --arrow: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
}

html {
    font-size: 20px;
    font-family: 'iAWriterQuattroS', monospace;
    line-height: 35px;
    /* Always reserve room for the scrollbar so switching between a page that
       scrolls and one that doesn't no longer shifts the centered layout. */
    scrollbar-gutter: stable;
}

body {
    background-color: var(--bg);
    color: var(--front);
    margin: 0;
    font-size: 18px;
    /* fill the viewport so there's no dead band below the footer */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 30px;
    box-sizing: border-box;
}

/* each band fills the window width (minus padding); the cap only kicks in
   on very large monitors so lines never get unreadably long */
header, main, footer {
    width: 100%;
    max-width: 1545px;
}

/* main takes the leftover height and centers its content vertically,
   so the whitespace is balanced instead of dumped at the bottom */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    /*justify-content: center;*/
    margin-top: 15px;
    max-width: 1545px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(90, 90, 90); }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }

::selection { background: var(--select); }

a, .link { color: var(--front); text-underline-offset: 5px; }
a:visited { color: inherit; }
a:hover { border-color: var(--frontBrightBorder); color: var(--frontBrightText); }

/* ---------- header / nav ---------- */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px 40px;
    margin-top: 10px;
    margin-bottom: 25px;
}

.mainTitle {
    text-decoration: none;
    text-decoration-thickness: 2px;
    text-decoration-style: wavy;
    text-underline-offset: 10px;
    user-select: none;
    font-size: 1.6em;
    font-weight: bold;
    white-space: nowrap;
    display: flex;
    align-items: center;
    text-transform: lowercase;
    margin-bottom: 0px;
}
.mainTitle:hover { color: var(--front); }

.menu {
    user-select: none;
    font-weight: bold;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px 6px;
}
.menu a {
    margin-left: 5px;
    margin-right: 5px;
    text-decoration: none;
}
.menu .sep { opacity: .4; }
.menu a:hover, .menu a.current {
    text-decoration: underline !important;
    text-underline-offset: 6px;
    color: var(--front);
}
#daynight { cursor: pointer; }

/* ---------- main / content ---------- */

h1 {
    margin-top: 10px;
    font-size: clamp(1.7em, 1.1em + 2.4vw, 2.2em);
    line-height: 1.18;
    font-weight: bold;
    letter-spacing: -0.01em;
}
h2 {
    font-size: 1.25em;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 15px;
    margin-bottom: 5px;
}
h2::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    background: var(--select);
    border-radius: 2px;
}
h3 { font-size: 1.05em; margin-top: 25px; margin-bottom: 0; }

.lead { font-size: 1.1em; line-height: 1.55; }
.italic { font-style: italic; }
.bold { font-weight: bold; }
.muted { color: var(--frontBrightText); }
.tag {
    font-style: italic;
    opacity: .85;
    font-size: .95em;
}
.accent { color: var(--select); font-weight: bold; }
.mono-tag {
    font-size: .8em;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--frontBrightText);
    font-weight: bold;
}

/* ---------- hero: copy left, line-art diagram right ---------- */
.hero {
    display: flex;
    align-items: center;
    gap: clamp(30px, 5vw, 80px);
    width: 100%;
    margin-bottom: 0px;
    margin-top: 0px;
}
.hero-copy { flex: 1 1 520px;  }
.hero-copy h1 { margin-bottom: 24px; }
.hero-art {
    flex: 1 1 380px;
    max-width: 480px;
    display: flex;
    justify-content: center;
}
.hero-art svg { width: 100%; height: auto; }
.hero-art .struct { stroke: var(--front); }
.hero-art .accent-stroke { stroke: var(--select); }
.hero-art .accent-fill { fill: var(--select); }
@media (max-width: 860px) {
    .hero { flex-direction: column; align-items: flex-start; }
    .hero-art { display: none; }
    .hero { display: block; }

}

/* the ── build / shrink / seal ── cards */
.steps {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    margin: 22px 0 35px;
}
.step {
    flex: 1 1;
    position: relative;
    border: 2px solid var(--frontBrightBorder);
    border-radius: 6px;
    padding: 24px 26px 28px;
    overflow: hidden;
    transition: transform .18s ease, border-color .18s ease;
}
/* thin accent rule along the top edge of each card */
.step::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--select);
    opacity: .8;
}
.step:hover {
    transform: translateY(-3px);
    border-color: var(--select);
}
.step-icon {
    display: block;
    width: 34px;
    height: 34px;
    margin-bottom: 14px;
}
.step-icon svg { width: 100%; height: 100%; }
.step-icon .struct { stroke: var(--front); }
.step-icon .accent-stroke { stroke: var(--select); }
.step .num {
    font-weight: bold;
    font-size: .78em;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--frontBrightText);
}
.step h3 { margin-top: 4px; font-size: 1.3em; }
.step p { margin-bottom: 0; }

/* ---------- why: expandable FAQ list ---------- */
.faq { margin: 1em 0 0em; }
/*.faq-item { border-bottom: 2px dotted var(--frontBrightBorder); }*/
.faq-item > summary {
    list-style: none;
    cursor: pointer;
    position: relative;
    padding: 17px 44px 17px 26px;
    font-weight: bold;
    user-select: none;
}
.faq-item > summary::-webkit-details-marker { display: none; }
/* accent tick, matching the .proof / .step markers */
.faq-item > summary::before {
    content: "";
    position: absolute;
    left: 0;
    top: 34px;
    width: 12px;
    height: 2px;
    background: var(--select);
}
/* chevron on the right, rotates when the row is open */
.faq-item > summary::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 28px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--front);
    border-bottom: 2px solid var(--front);
    transform: rotate(45deg);
    transition: transform .2s ease;
}
.faq-item[open] > summary::after { transform: rotate(-135deg); top: 31px; }
/* only apply hover where a real pointer exists, so the colour doesn't
   "stick" after a tap on touch screens */
@media (hover: hover) {
    .faq-item > summary:hover { color: var(--frontBrightText); }
}
.faq-item > summary:focus-visible {
    outline: 2px solid var(--select);
    outline-offset: 2px;
    border-radius: 2px;
}
.faq-body { padding: 0 44px 20px 26px; }
.faq-body > :first-child { margin-top: 0; }
.faq-body > :last-child { margin-bottom: 0; }

/* fade + gentle slide-in when a row is opened (native <details> otherwise
   snaps open). Only runs when the visitor is fine with motion. */
@media (prefers-reduced-motion: no-preference) {
    .faq-item[open] > .faq-body { animation: faq-reveal .28s ease both; }
    @keyframes faq-reveal {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

ul.proof { list-style: none; padding: 0; margin: 0; }
ul.proof li {
    padding: 16px 0 5px 26px;
    position: relative;
    /*border-bottom: 2px dotted var(--frontBrightBorder);*/
}
/*ul.proof li:first-child { border-top: 2px dotted var(--frontBrightBorder); }*/
/* accent tick marker on each proof / contact row */
ul.proof li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 33px;
    width: 12px;
    height: 2px;
    background: var(--select);
}

.founder { margin-bottom: 30px; }
.founder h3 { margin-bottom: 4px; }
.founder .role { font-style: italic; color: var(--frontBrightText); font-size: .95em; }
.founder p { margin-top: 6px; }

blockquote {
    border-left: 3px solid var(--select);
    padding: 5px 5px 5px 30px;
    margin-left: 0;
}
blockquote > p { margin: 0; }

.cta {
    display: inline-block;
    border: 2px solid var(--front);
    border-radius: 3px;
    padding: 11px 28px;
    font-weight: bold;
    text-decoration: none;
    margin-top: 14px;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
/* solid fill on hover — reads deliberate, still monochrome */
.cta:hover {
    background: var(--front);
    color: var(--bg);
    border-color: var(--front);
}

code {
    font-family: monospace;
    color: var(--bg);
    background-color: var(--codeBg);
    padding: 5px 6px 5px 6px;
    border-radius: 7px;
}

.highlight {
	margin: 25px 10px;
}
.highlight > pre {
    padding: 0;
    margin: 0px;
    background-color: unset !important;
}
.highlight > pre > code {
    padding: 0px;
    display: block;
    padding: 15px 25px;
    border-radius: 7px;
    background-color: var(--codeBg);
   	overflow: auto;
}
code, code * {
	font-family: monospace !important;
}
/* dotted separators, as on the original */
.bar {
    width: 100%;
    border-top: 2px dotted var(--front);
    margin: 50px 0;
    /*margin-bottom: 60px;*/
}
hr {
	margin: 40px;
}
/* ---------- footer ---------- */

footer {
    margin-top: 40px;
}
footermenu {
    display: block;
    text-align: end;
    font-weight: bold;
    user-select: none;
    border-top: 2px dotted var(--front);
    padding-top: 40px;
    padding-bottom: 15px;
}
footermenu > * { text-decoration: none; }
footermenu a:hover {
    text-decoration: underline !important;
    text-underline-offset: 6px;
    color: var(--front);
}
footermenu .sep { opacity: .4; }

/* ---------- responsive ---------- */

@media only screen and (max-width: 860px), only screen and (max-device-width: 860px) {
    body { padding: 25px 28px; }
    main { margin-top: 25px; }
    header { margin-top: 5px; margin-bottom: 0px; }
    .steps { flex-direction: column; gap: 20px; }
    .bar { margin: 28px 0; }
    footermenu { padding-top: 35px; padding-bottom: 10px;}
    h1 { margin-top: 10px; }
}

/* ---------- polish: focus, motif, motion ---------- */

/* keyboard focus — visible accent ring, never on mouse click */
a:focus-visible,
.cta:focus-visible,
#daynight:focus-visible {
    outline: 2px solid var(--select);
    outline-offset: 4px;
    border-radius: 2px;
}

/* very faint engineering grid — echoes the dotted-bar motif, stays out of the way */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(var(--front) 1px, transparent 1px),
        linear-gradient(90deg, var(--front) 1px, transparent 1px);
    background-size: 46px 46px;
    opacity: .035;
}

/* subtle reveal on scroll — progressive enhancement, added by script.js.
   Wrapped so it only hides content when motion is welcome AND JS ran. */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(16px);
        transition: opacity .55s ease, transform .55s ease;
        transition-delay: var(--reveal-delay, 0s);
    }
    .reveal.is-visible {
        opacity: 1;
        transform: none;
    }
}

/* ---------- blog ---------- */

/* two columns: the article on the left, a sticky list of posts on the right */
.blog-layout {
    display: flex;
    align-items: flex-start;
    gap: clamp(30px, 4vw, 64px);
    width: 100%;
}
.blog-main {
	min-width: 800px;
    width: 70%;
    margin: auto;
}
.blog-main h1 { margin: 0 0 8px 0; }
.blog-main h2 { margin-top: 45px; }
.post-meta {
    font-style: italic;
    color: var(--frontBrightText);
    font-size: .9em;
    margin-top: 0;
}

article.blog-main blockquote {
    padding: 5px;
    padding-left: 25px;
}

/* "previous article" link at the foot of a post */
.post-nav {
    margin-top: 40px;
    padding-top: 18px;
    font-weight: bold;
}
.post-nav a { text-decoration: none; }
.post-nav a:hover { text-decoration: underline; text-underline-offset: 5px; }

.blog-link {
	text-decoration: none;
}
.blog-link:hover {
	color: unset;
}
.blog-link:hover > .article-title {
	text-decoration: underline;
}


/* prose images: the alt text is printed underneath as a caption */
.post-figure {
	margin: 28px 0;
}
.post-figure img { max-width: 100%; height: auto; display: block; border-radius: 4px; margin: auto; }
.post-figure figcaption {
     margin-top: -5px;
    font-size: .85em;
    font-style: italic;
    color: var(--frontBrightText);
    text-align: center;
}

/* prose tables: a bordered grid so rows and columns read clearly as a table */
.blog-main table {
    border-collapse: collapse;
    width: 100%;
    margin: 28px 0;
    font-size: .95em;
    border: 2px solid var(--front);
    word-break: break-word;
    margin: 40px 0 40px 0;
}
.blog-main th,
.blog-main td {
    border: 1px solid var(--frontBrightBorder);
    padding: 8px 12px;
}
.blog-main thead th {
    border-bottom: 2px solid var(--front);
}

/* the left-hand panel */
.blog-side {
	display: none;
    flex: 0 0 clamp(190px, 22vw, 260px);
    position: sticky;
    top: 34px;
    border-right: 2px dotted var(--frontBrightBorder);
    padding-right: clamp(20px, 2vw, 30px);
}
/*.blog-side h2 { font-size: 1.05em; margin-bottom: 4px; }*/

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
    padding: 14px 0;
    border-bottom: 2px dotted var(--frontBrightBorder);
}
.post-list li:last-child { border-bottom: none; }
.post-list li:first-child { padding-top: 0; }
.post-list a { font-weight: bold; text-decoration: none; line-height: 1.35; }
.post-list a:hover { text-decoration: underline; text-underline-offset: 5px; }
.post-list li.current a { color: var(--select); }
.post-list .post-date {
    display: block;
    font-size: .78em;
    color: var(--frontBrightText);
    margin-top: 2px;
}

/* the /blog landing index — one row per article, with its description */
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li {
    position: relative;
    padding: 22px 0 22px 26px;
}
/* accent tick marker, matching the .proof rows elsewhere on the site */
.article-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 39px;
    width: 12px;
    height: 2px;
    background: var(--select);
}
.article-title { font-weight: bold; font-size: 1.15em; text-decoration: none; }
.article-title:hover { text-decoration: underline; text-underline-offset: 5px; }
.article-date {
    font-size: .8em;
    font-style: italic;
    color: var(--frontBrightText);
    margin-top: 2px;
}
.article-desc { margin: 2px 0 0; color: var(--frontBrightText); }

/* stack on narrow screens: panel sits above the article, divider on its bottom */
@media (max-width: 860px) {
	.blog-main { min-width: 0; width: 100%; }
    .blog-layout {
    	flex-direction: column;
	    padding-top: 20px;
    }
    .blog-side {
	   	display: none;
    }
}
