/* ============================================================
   Family Archive — "filed record" identity
   Aged manila paper, postmark red, typewriter metadata.
   ============================================================ */

:root {
    --paper:       #EDE3CB;  /* page background — aged manila */
    --card:        #FBF6E9;  /* card/content surface — lighter card stock */
    --ink:         #29241C;  /* primary text — warm near-black ink */
    --ink-soft:    #6E6252;  /* secondary text — faded pencil */
    --line:        #D6C6A0;  /* rule lines — aged */
    --accent:      #9C3428;  /* postmark red / wax seal */
    --accent-deep: #7A2820;  /* accent hover */
    --ledger:      #34503E;  /* ledger green — sparing secondary use */
    --shadow: 0 2px 10px rgba(41, 36, 28, .08);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Lora", Georgia, "Times New Roman", serif;
    color: var(--ink);
    background: var(--paper);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(41,36,28,.05) 1px, transparent 0);
    background-size: 22px 22px;
    line-height: 1.65;
    font-size: 17px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

a { color: var(--accent); }
a:hover { color: var(--accent-deep); }

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

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

.mono {
    font-family: "Space Mono", ui-monospace, Menlo, Consolas, monospace;
}

.eyebrow {
    display: block;
    margin-bottom: 10px;
    font-family: "Space Mono", ui-monospace, monospace;
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

h1, h2, h3 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.01em;
}

h1 { font-size: 40px; line-height: 1.1; margin: 0 0 10px; font-weight: 620; }
h2 {
    font-family: "Space Mono", ui-monospace, monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 44px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
h3 {
    font-size: 19px;
    line-height: 1.35;
    margin: 0 0 6px;
    font-weight: 600;
}

.lede { color: var(--ink-soft); font-size: 18px; font-style: italic; }
.intro { font-size: 18px; color: var(--ink-soft); font-style: italic; margin: 10px 0 4px; }
.muted { color: var(--ink-soft); font-size: 14px; }
.breadcrumb { font-family: "Space Mono", monospace; font-size: 12px; margin-bottom: 10px; letter-spacing: .03em; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

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

.site-header {
    background: var(--card);
    border-bottom: 3px double var(--line);
    padding: 20px 0;
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; }
.site-title {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--ink);
}
.site-title .postmark { flex: none; }
.site-title svg { flex: none; color: var(--accent); }
.site-title .wordmark {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 650;
    font-size: 23px;
    letter-spacing: -.01em;
    line-height: 1.15;
}

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

.site-nav {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.site-nav .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    padding: 9px 22px;
}
.site-nav a, .nav-dropdown-trigger {
    font-family: "Space Mono", monospace;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 12.5px;
    letter-spacing: .03em;
    text-decoration: none;
    color: var(--ink);
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
}
.site-nav a:hover, .nav-dropdown-trigger:hover, .nav-dropdown.open .nav-dropdown-trigger {
    background: rgba(41,36,28,.06);
}
.site-nav a.active, .nav-dropdown-trigger.active {
    background: var(--accent);
    color: var(--card);
}
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-trigger .caret { font-size: 10px; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 190px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px;
    box-shadow: var(--shadow);
    z-index: 30;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: 8px 11px;
    border-radius: 3px;
}
.nav-dropdown-menu a.active { background: var(--accent); color: var(--card); }

.nav-search {
    display: flex;
    align-items: center;
    margin-left: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 3px 4px 3px 12px;
}
.nav-search input[type="search"] {
    border: none;
    background: none;
    font-family: "Space Mono", monospace;
    font-size: 12.5px;
    color: var(--ink);
    width: 148px;
    outline: none;
}
.nav-search input[type="search"]::placeholder { color: var(--ink-soft); }
.nav-search button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--ink-soft);
    cursor: pointer;
}
.nav-search button:hover { background: rgba(41,36,28,.08); color: var(--accent); }
.nav-search:focus-within {
    border-color: var(--accent);
}

/* ---------- hero (home page) ---------- */

.hero {
    position: relative;
    overflow: hidden;
    padding: 54px 0 40px;
    border-bottom: 1px solid var(--line);
}
.hero .postmark-watermark {
    position: absolute;
    top: 50%;
    right: -60px;
    transform: translateY(-50%) rotate(-8deg);
    opacity: .09;
    width: 280px;
    height: 280px;
    color: var(--ink);
    pointer-events: none;
}
.hero .eyebrow { display: block; margin-bottom: 14px; }
.hero h1 { font-size: 46px; margin-bottom: 12px; }
.hero .tagline { font-size: 18px; color: var(--ink-soft); font-style: italic; max-width: 520px; }

main.wrap { padding: 40px 22px 90px; position: relative; }

/* ---------- record cards ---------- */

.card-list { display: flex; flex-direction: column; gap: 18px; }
.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 20px 22px 18px;
    box-shadow: var(--shadow);
}
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .intro {
    font-size: 15.5px;
    color: #3d372c;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
}
.card .intro p:first-child { margin-top: 0; }
.card .intro p { margin: .5em 0; }
.card .intro iframe,
.card .intro video,
.card .intro embed,
.card .intro object { display: none; }

.card-category {
    display: inline-block;
    font-family: "Space Mono", monospace;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--card);
    background: var(--ledger);
    text-decoration: none;
    border-radius: 2px;
    padding: 3px 8px;
    margin-bottom: 10px;
}
.card-category:hover { background: #263c2f; color: var(--card); }

/* ---------- category tiles (browse grid) ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}
.cat-card {
    position: relative;
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 3px solid var(--accent);
    border-radius: 0 0 3px 3px;
    padding: 16px 16px 14px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
}
.cat-card:hover { border-top-color: var(--accent-deep); }
.cat-card h3 { font-size: 16px; margin-bottom: 4px; }
.cat-card .muted { font-family: "Space Mono", monospace; font-size: 11px; letter-spacing: .02em; }

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

.fulltext { margin-top: 22px; font-size: 17px; }
.fulltext img { max-width: 100%; height: auto; border-radius: 3px; }
.fulltext p { margin: 1em 0; }

.attachments { margin-top: 8px; }
.attachment-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 4px 0 16px;
}
.attachment-image {
    display: block;
    aspect-ratio: 1;
    border: 6px solid var(--card);
    outline: 1px solid var(--line);
    border-radius: 2px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.attachment-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment-video {
    margin: 4px 0 16px;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 10px;
    background: var(--card);
    box-shadow: var(--shadow);
}
.attachment-video video { width: 100%; max-width: 520px; display: block; border-radius: 2px; }
.attachment-files { list-style: none; margin: 4px 0; padding: 0; }
.attachment-files li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}
.attachment-files li:first-child { border-top: 1px solid var(--line); }
.attachment-files .file-tag {
    font-family: "Space Mono", monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--card);
    background: var(--accent);
    border-radius: 2px;
    padding: 3px 7px;
    flex: none;
}
.attachment-files a { text-decoration: none; }
.attachment-files a:hover { text-decoration: underline; }

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

.about-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
}
.about-layout .about-image { flex: 1 1 280px; }
.about-layout .about-image img {
    width: 100%;
    height: auto;
    display: block;
    border: 6px solid var(--card);
    outline: 1px solid var(--line);
    border-radius: 2px;
    box-shadow: var(--shadow);
}
.about-layout .about-text { flex: 2 1 400px; }

/* ---------- pager ---------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 8px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
}
.pager-link {
    font-family: "Space Mono", monospace;
    font-size: 12.5px;
    text-decoration: none;
    letter-spacing: .02em;
}
.pager-link.disabled { color: var(--ink-soft); opacity: .5; pointer-events: none; }
.pager-status { font-family: "Space Mono", monospace; font-size: 11px; color: var(--ink-soft); letter-spacing: .04em; }

.back-link { margin-top: 28px; }
.back-link a {
    font-family: "Space Mono", monospace;
    font-size: 13px;
    text-decoration: none;
}
.back-link a:hover { text-decoration: underline; }

/* ---------- footer ---------- */

.site-footer {
    border-top: 3px double var(--line);
    padding: 24px 0;
    color: var(--ink-soft);
    font-family: "Space Mono", monospace;
    font-size: 11.5px;
    letter-spacing: .03em;
}

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

@media (max-width: 640px) {
    body { font-size: 16px; }
    h1 { font-size: 30px; }
    .hero { padding: 40px 0 30px; }
    .hero h1 { font-size: 32px; }
    .hero .postmark-watermark { width: 180px; height: 180px; right: -40px; }
    main.wrap { padding: 28px 18px 70px; }
    .site-title .wordmark { font-size: 19px; }
    .about-layout { gap: 20px; }
    .nav-search { margin-left: 0; margin-top: 4px; width: 100%; }
    .nav-search input[type="search"] { width: 100%; }
}
