/*
Theme Name: Small Chatham
Theme URI: https://blog.willchatham.com
Author: Will Chatham
Description: A tiny, fast, hand-made small-web theme. No frameworks, no webfonts, one stylesheet.
Version: 0.2.0
License: GPL-2.0-or-later
Text Domain: small-chatham
*/

/* =============================================
   PALETTE - same hues as the dark site, inverted.
   Blue hue 210, gold hue 50.
   ============================================= */
:root {
    --bg:      oklch(97% 0.005 210);  /* off-white, faint cool tint */
    --bg-2:    oklch(94% 0.01  210);  /* cards, code, wells */
    --ink:     oklch(25% 0.06  210);  /* deep blue-black text */
    --ink-2:   oklch(45% 0.05  210);  /* muted secondary */
    --ink-3:   oklch(58% 0.04  210);  /* meta, timestamps */
    --acc:     oklch(55% 0.14  50);   /* gold, darkened for light-bg contrast */
    --acc-dk:  oklch(45% 0.13  50);   /* hover */
    --border:  oklch(88% 0.015 210);
    --max:     42rem;
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: "Barlow", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.65;
}

/* =============================================
   LAYOUT
   ============================================= */
.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* =============================================
   HEADER
   ============================================= */
.site-head {
    padding: 2.25rem 0 1.5rem;
    border-bottom: 3px solid var(--ink);
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.site-title a {
    color: var(--ink);
    text-decoration: none;
}

.site-tagline {
    margin: 0.2rem 0 0;
    color: var(--ink-3);
    font-size: 0.95rem;
    font-style: italic;
}

.site-nav {
    margin-top: 1rem;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}

.site-nav a {
    color: var(--ink-2);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.site-nav a:hover,
.site-nav .current-menu-item a {
    color: var(--acc);
    border-bottom-color: var(--acc);
}

/* =============================================
   CONTENT / H-ENTRY
   ============================================= */
main {
    padding: 2.5rem 0 3rem;
}

.h-entry + .h-entry {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
}

.entry-meta {
    color: var(--ink-3);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.4rem;
}

.entry-meta a { color: inherit; text-decoration: none; }
.entry-meta a:hover { color: var(--acc); }

h1.p-name, h1.entry-title {
    font-size: 2rem;
    line-height: 1.15;
    margin: 0 0 1rem;
    letter-spacing: -0.01em;
}

h2.p-name, h2.entry-title {
    font-size: 1.5rem;
    line-height: 1.2;
    margin: 0 0 0.75rem;
}

.entry-title a {
    color: var(--ink);
    text-decoration: none;
}

.entry-title a:hover { color: var(--acc); }

.e-content a,
.entry-summary a,
p a {
    color: var(--acc);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
}

.e-content a:hover, p a:hover { color: var(--acc-dk); }

.e-content img, figure img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
}

figure { margin: 1.75rem 0; }
figcaption {
    color: var(--ink-3);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 0.4rem;
}

blockquote {
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1.25rem;
    border-left: 3px solid var(--acc);
    color: var(--ink-2);
    font-style: italic;
}

pre, code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.9em;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 4px;
}

code { padding: 0.1em 0.35em; }
pre { padding: 1rem 1.25rem; overflow-x: auto; }
pre code { border: 0; background: none; padding: 0; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

.more-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
}

/* =============================================
   PAGINATION + POST NAV
   ============================================= */
.paging, .post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.9rem;
}

.paging a, .post-navigation a {
    color: var(--acc);
    text-decoration: none;
}

.paging a:hover, .post-navigation a:hover { color: var(--acc-dk); }
.post-navigation .nav-next { text-align: right; }

/* =============================================
   FOOTER + H-CARD
   ============================================= */
.site-foot {
    border-top: 3px solid var(--ink);
    padding: 1.75rem 0 2.5rem;
    font-size: 0.9rem;
    color: var(--ink-2);
}

.site-foot .h-card { margin-bottom: 0.5rem; }
.site-foot .u-photo {
    width: 44px; height: 44px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0.6rem;
    border: 1px solid var(--border);
}

.site-foot a { color: var(--acc); text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }

.foot-links {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}

.foot-note {
    margin-top: 1rem;
    color: var(--ink-3);
    font-size: 0.8rem;
}

/* =============================================
   MOBILE
   ============================================= */
@media (max-width: 480px) {
    body { font-size: 1rem; }
    h1.p-name, h1.entry-title { font-size: 1.6rem; }
    .site-head { padding-top: 1.5rem; }
}

/* =============================================
   PROJECTS PAGE
   ============================================= */
.wrap--wide { max-width: 68rem; }

.projects-header {
    text-align: center;
    max-width: 42rem;
    margin: 0 auto 2rem;
}

.projects-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.project-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: var(--acc);
    box-shadow: 0 6px 18px oklch(25% 0.06 210 / 0.12);
}

.project-card__link { display: block; text-decoration: none; color: inherit; }

.project-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--bg-2);
    overflow: hidden;
}

.project-card__media img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    border: 0; border-radius: 0;
}

.project-card__media--placeholder {
    display: flex; align-items: center; justify-content: center;
}
.project-card__media--placeholder > span:first-child {
    color: var(--ink-3);
    font-size: 2rem; font-weight: 800; opacity: 0.5;
}

.project-card__tag {
    position: absolute; top: 0.5rem; left: 0.5rem;
    background: oklch(97% 0.005 210 / 0.92);
    color: var(--ink);
    font-size: 0.65rem; font-weight: 800;
    letter-spacing: 0.04em; text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.project-card__body { padding: 0.9rem 1rem 1.1rem; }
.project-card__title { font-size: 1.05rem; margin: 0 0 0.4rem; }
.project-card__blurb { color: var(--ink-2); font-size: 0.85rem; line-height: 1.5; margin: 0 0 0.7rem; }
.project-card__cta { color: var(--acc); font-weight: 700; font-size: 0.8rem; }
.project-card:hover .project-card__cta { color: var(--acc-dk); }

/* =============================================
   FORMS (contact form, search, comments)
   ============================================= */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.75rem;
    font: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
}

input:focus, textarea:focus {
    outline: 2px solid var(--acc);
    outline-offset: 1px;
    border-color: var(--acc);
}

label { font-weight: 700; font-size: 0.9rem; }

button,
input[type="submit"] {
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: var(--acc);
    border: 0;
    border-radius: 4px;
    padding: 0.6rem 1.4rem;
    cursor: pointer;
}

button:hover,
input[type="submit"]:hover { background: var(--acc-dk); }

/* =============================================
   NAV SUBMENUS - CSS-only dropdown, no JS
   ============================================= */
.site-nav li { position: relative; }

/* summary styled like a nav link, with a caret that flips when open */
.site-nav summary {
    cursor: pointer;
    list-style: none;
    color: var(--ink-2);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.site-nav summary::-webkit-details-marker { display: none; }

.site-nav summary::after {
    content: " \25BE";
    font-size: 0.75em;
    color: var(--ink-3);
}

.site-nav details[open] > summary::after { content: " \25B4"; }

.site-nav summary:hover,
.site-nav details[open] > summary {
    color: var(--acc);
    border-bottom-color: var(--acc);
}

.site-nav ul ul {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    min-width: 14rem;
    margin: 0;
    padding: 0.25rem 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: 2px solid var(--acc);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 16px oklch(25% 0.06 210 / 0.12);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.site-nav ul ul li { width: 100%; }

.site-nav ul ul a {
    display: block;
    padding: 0.5rem 1rem;
    border-bottom: 0;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.9rem;
    font-weight: 600;
}

.site-nav ul ul a:hover { color: var(--acc); }

/* On small screens: no floating panel; opened children indent inline.
   Closed by default, so the nav stays compact until Links is tapped. */
@media (max-width: 640px) {
    .site-nav ul ul {
        position: static;
        min-width: 0;
        border: 0;
        box-shadow: none;
        padding: 0.25rem 0 0.25rem 1rem;
        background: transparent;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
    }
    .site-nav details[open] { width: 100%; }
}

/* =============================================
   ARCHIVE PAGE + SEARCH
   ============================================= */
.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.archive-search {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0 2rem;
}

.archive-search input { flex: 1; }

.archive-year {
    font-size: 1.2rem;
    margin: 2.25rem 0 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--ink);
}

.archive-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.archive-list li {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: 1px dotted var(--border);
}

.archive-list time {
    flex: 0 0 4.5rem;
    color: var(--ink-3);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.archive-list--search time { flex-basis: 7rem; }

.archive-list a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

.archive-list a:hover { color: var(--acc); }

.archive-cta { margin-top: 3rem; font-weight: 700; }
