/* krten.com stylesheet */
/* Design: technical documentation meets personal workshop log */

:root {
    --bg:           #f5f2eb;
    --bg-nav:       #1c1c1c;
    --bg-content:   #ffffff;
    --text:         #2a2a2a;
    --text-light:   #555555;
    --accent:       #8b2500;        /* deep engineering red */
    --accent-mid:   #b33a00;
    --rule:         #c8c0b0;
    --code-bg:      #eeebe3;
    --nav-text:     #d0ccc4;
    --nav-active:   #ff7a3d;
    --nav-hover:    #ffffff;

    --font-body:    'Georgia', 'Times New Roman', serif;
    --font-mono:    'Courier New', 'Lucida Console', monospace;
    --font-head:    'Georgia', serif;

    --max-width:    860px;
    --nav-width:    200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* == Navigation ============================================= */

#site-header {
    background: var(--bg-nav);
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
}

#site-title {
    padding: 18px 24px;
    min-width: var(--nav-width);
    border-right: 1px solid #333;
}

#site-title a {
    color: #ffffff;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 0.03em;
}

#site-title .tagline {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #777;
    margin-top: 3px;
    letter-spacing: 0.05em;
}

nav#main-nav {
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex-wrap: wrap;
}

nav#main-nav a {
    color: var(--nav-text);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 6px 14px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

nav#main-nav a:hover {
    color: var(--nav-hover);
    background: #333;
}

nav#main-nav a.active {
    color: var(--nav-active);
    font-weight: bold;
}

/* == Layout ================================================= */

#page-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 32px 16px 48px;
}

article#content {
    background: var(--bg-content);
    max-width: var(--max-width);
    width: 100%;
    padding: 40px 48px;
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* == Typography ============================================= */

h1, h2, h3, h4 {
    font-family: var(--font-head);
    color: var(--accent);
    margin-top: 1.6em;
    margin-bottom: 0.5em;
    line-height: 1.25;
}

h1 { font-size: 1.9rem; margin-top: 0; border-bottom: 2px solid var(--rule); padding-bottom: 0.3em; }
h2 { font-size: 1.4rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.2em; }
h3 { font-size: 1.15rem; color: var(--accent-mid); }
h4 { font-size: 1.0rem; color: var(--text); font-style: italic; }

p { margin-bottom: 1em; }

a { color: var(--accent-mid); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
a:hover { border-bottom-color: var(--accent-mid); }

strong { color: #1a1a1a; }
em { font-style: italic; }

/* Prose lists — restore indentation killed by the * reset */
article#content ul,
article#content ol {
    margin: 0.6em 0 1em 1.6em;
    padding-left: 0.4em;
}

article#content li {
    margin-bottom: 0.3em;
}

/* Each nesting level adds another 1.4em */
article#content li ul,
article#content li ol {
    margin-top: 0.3em;
    margin-left: 1.4em;
    margin-bottom: 0.2em;
}

hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 2em 0;
}

/* == Code =================================================== */

pre code {
	tab-size: 4;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--code-bg);
    padding: 0.1em 0.35em;
    border-radius: 2px;
    color: #1a1a1a;
}

pre {
    background: #1c1c1c;
    color: #f0ece0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 18px 20px;
    overflow-x: auto;
    margin: 1.2em 0 1.4em;
    border-left: 3px solid var(--accent);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* == Images ================================================= */

.img-block {
    margin: 1.8em 0;
}

/* Row of images side by side */
.img-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

/* Individual image cell */
.img-cell {
    display: inline-block;
    vertical-align: top;
}

.img-block:not(.img-row) .img-cell {
    display: block;
}

/* Hover wrapper: position context for the preview popup */
.img-hover-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.img-hover-wrap > a > img,
.img-hover-wrap > img {
    border: 1px solid var(--rule);
    display: block;
}

/* Medium preview: hidden by default, shown on hover */
.img-preview {
    display: none;
    position: absolute;
    top: 0;
    left: calc(100% + 10px);
    z-index: 100;
    background: var(--bg-content);
    border: 1px solid var(--rule);
    box-shadow: 2px 2px 12px rgba(0,0,0,0.25);
    padding: 4px;
}

.img-preview img {
    display: block;
    max-width: 640px;
}

.img-hover-wrap:hover .img-preview {
    display: block;
}

/* Caption and XL link on one line below thumbnail */
.img-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 0.4em;
}

.img-caption {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    flex: 1;
}

.img-xl {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-mid);
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: none !important;
}

.img-xl:hover {
    text-decoration: underline;
}

/* inline float for smaller images */
.img-right {
    float: right;
    margin: 0 0 1em 2em;
    max-width: 280px;
}

.img-right img {
    max-width: 100%;
    border: 1px solid var(--rule);
}

.clearfix::after { content: ''; display: block; clear: both; }

/* == Project index cards ==================================== */

.project-grid {
    margin-top: 1.5em;
}

.project-category {
    margin-bottom: 2.5em;
}

.project-category h2 {
    font-size: 1.2rem;
}

.project-list {
    list-style: none;
    margin-top: 0.8em;
}

.project-list li {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
}

.project-list li:last-child {
    border-bottom: none;
}

.project-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    object-fit: cover;
    border: 1px solid var(--rule);
}

.project-thumb-placeholder {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    background: var(--code-bg);
    border: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: #999;
}

.project-info a {
    font-size: 1.0rem;
    font-weight: bold;
    color: var(--accent);
    border-bottom: none;
}

.project-info a:hover {
    text-decoration: underline;
}

.project-info p {
    margin: 0.2em 0 0;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* == Tables ================================================= */

table {
    border-collapse: collapse;
    margin: 1.4em 0;
    font-size: 0.92rem;
    width: auto;
}

th {
    text-align: left;
    padding: 8px 18px 8px 8px;
    border-bottom: 2px solid var(--accent);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    padding: 7px 18px 7px 8px;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #f0ece3;
}

/* Table style variants */

.table-wide table {
    width: 100%;
}

.table-compact th,
.table-compact td {
    padding: 4px 12px 4px 6px;
}

.table-compact {
    font-size: 0.85rem;
}

/* == Note blocks (@@NOTE@@ ... @@ENDNOTE@@) ================ */

.note-block {
    background: #fffbe6;
    border-left: 4px solid #c8a000;
    border-top: 1px solid #e0cc80;
    border-right: 1px solid #e0cc80;
    border-bottom: 1px solid #e0cc80;
    padding: 14px 18px;
    margin: 1.4em 0;
}

.note-block::before {
    content: 'Note';
    display: block;
    font-weight: bold;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a6800;
    margin-bottom: 6px;
}

.note-block p:last-child {
    margin-bottom: 0;
}

/* == Notes (```notes fenced blocks) ======================== */

pre:has(code.language-notes) {
    background: #fffbe6;
    border-left: 4px solid #c8a000;
    border-top: 1px solid #e0cc80;
    border-right: 1px solid #e0cc80;
    border-bottom: 1px solid #e0cc80;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 14px 18px;
    white-space: pre-wrap;
    word-break: break-word;
}

pre:has(code.language-notes)::before {
    content: 'Note';
    display: block;
    font-weight: bold;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a6800;
    margin-bottom: 6px;
}

pre:has(code.language-notes) code {
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}

/* prevent highlight.js from restyling notes blocks */
pre:has(code.language-notes) code.hljs {
    background: none;
    color: inherit;
    padding: 0;
}

/* == Footer ================================================= */

#site-footer {
    background: var(--bg-nav);
    color: #666;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

#site-footer a { color: #888; text-decoration: none; }
#site-footer a:hover { color: #aaa; }

/* == Responsive ============================================= */

@media (max-width: 640px) {
    article#content { padding: 24px 20px; }
    #site-title { min-width: unset; }
    .img-right { float: none; max-width: 100%; margin: 1em 0; }
}
