/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #111;
    background: #fff;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header — minimal, no border, no sticky */
.header {
    padding: 2rem 0 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    font-weight: 600;
    font-size: 1rem;
    color: #111;
    text-decoration: none;
}

.logo a:hover {
    color: #666;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.nav a:hover {
    color: #111;
}

/* Main content */
.main {
    padding: 4rem 0;
}

/* Footer — barely there */
.footer {
    padding: 3rem 0;
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

/* ============================================
   Typography — Prose
   ============================================ */
.prose {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.75;
}

.prose h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.prose h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.prose p {
    margin-bottom: 1.5rem;
    font-size: 1.0625rem;
    color: #333;
}

/* Heading anchors: plain heading text, with a subtle link icon that
   appears on hover to the left. Clicking it puts the section's #slug in
   the URL. */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    position: relative;
}

.prose .heading-anchor {
    position: absolute;
    left: -1.5rem;
    top: 0;
    height: 100%;
    display: inline-flex;
    align-items: center;
    color: #bbb;
    opacity: 0;
    text-decoration: none;
    transition: opacity 0.15s, color 0.15s;
}

.prose h1:hover .heading-anchor,
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor,
.prose .heading-anchor:focus {
    opacity: 1;
}

.prose .heading-anchor:hover {
    color: #111;
}

.heading-anchor-icon {
    display: block;
}

/* On touch devices there is no hover, and the negative offset can clip on
   narrow screens — hide the icon there. */
@media (hover: none) {
    .prose .heading-anchor {
        display: none;
    }
}

.prose a {
    color: #111;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: #ccc;
    transition: text-decoration-color 0.15s;
}

.prose a:hover {
    text-decoration-color: #111;
}

.prose ul, .prose ol {
    margin: 1rem 0 1.5rem 1.25rem;
    color: #333;
}

/* When a list directly follows its lead-in paragraph, let it hug that
   line instead of leaving a full paragraph-sized gap (the paragraph's
   1.5rem bottom margin collapses with this -1rem to ~0.5rem). */
.prose p + ul,
.prose p + ol {
    margin-top: -1rem;
}

.prose li {
    margin-bottom: 0.5rem;
    font-size: 1.0625rem;
}

.prose blockquote {
    border-left: 3px solid #e5e5e5;
    padding-left: 1.25rem;
    margin: 2rem 0;
    color: #666;
    font-style: italic;
}

.prose code {
    background: #f5f5f5;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875em;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.prose pre {
    background: #1a1a1a;
    color: #e5e5e5;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.prose pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.prose hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 3rem 0;
}

.prose strong {
    font-weight: 600;
    color: #111;
}

.prose em {
    color: #555;
}

.prose img {
    max-width: 100%;
    border-radius: 8px;
    margin: 2rem 0;
}

/* ============================================
   Home page
   ============================================ */
.prose-home {
    max-width: 680px;
}

.prose-home h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   Writing (article) pages
   ============================================ */
.prose-writing {
    max-width: 680px;
}

/* ============================================
   Writing listing page
   ============================================ */
.post-list {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
}

.post-item {
    padding: 1.75rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.post-item:first-child {
    padding-top: 0;
}

.post-item:last-child {
    border-bottom: none;
}

.post-meta {
    color: #999;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.post-item h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.post-item h2 a {
    color: #111;
    text-decoration: none;
    transition: color 0.15s;
}

.post-item h2 a:hover {
    color: #666;
}

.post-description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.post-tags {
    display: none;
}

.tag {
    display: none;
}

/* Game-specific styles */
.chant {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    letter-spacing: 0.05em;
}

/* ============================================
   Mobile responsive
   ============================================ */
@media (max-width: 640px) {
    .container {
        padding: 0 1.25rem;
    }

    .header {
        padding: 1.5rem 0 0;
    }

    .main {
        padding: 3rem 0;
    }

    .prose h1 {
        font-size: 1.75rem;
    }

    .prose h2 {
        font-size: 1.25rem;
    }

    .prose p, .prose li {
        font-size: 1rem;
    }

    .nav {
        gap: 1rem;
    }
}

/* ============================================
   D&D CHARACTER SHEET — Lo-fi 5e Sheet
   Think: photocopied character sheet. Black ink
   on white paper. Thin ruled lines. The form
   fields ARE the design.
   ============================================ */

.prose-about {
    max-width: 100%;
    background: #f7f5f0;
    padding: 2rem 0;
}

.character-sheet-container {
    max-width: 860px;
}

.character-sheet {
    background: #fff;
    border: 2px solid #222;
    padding: 2rem 2.5rem;
    font-family: 'Charter', 'Bitstream Charter', 'Sitka Text', Cambria, serif;
    color: #111;
    position: relative;
}

/* == HEADER == */

.sheet-header {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 3px double #222;
    margin-bottom: 1.75rem;
}

.character-name-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid #222;
    padding-bottom: 0.5rem;
}

.character-name-box h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
    line-height: 1.2;
    color: #111;
}

.character-name-box .subtitle {
    font-size: 0.75rem;
    color: #555;
    margin-top: 0.35rem;
    font-style: normal;
    letter-spacing: 0.01em;
    line-height: 1.4;
}

.header-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem 0.5rem;
}

.detail-box {
    border-bottom: 1px solid #999;
    padding: 0.3rem 0.25rem 0.2rem;
    text-align: left;
}

.detail-box .label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #777;
    display: block;
    margin-bottom: 0.1rem;
    font-weight: 500;
}

.detail-box .value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #111;
}

/* == BODY LAYOUT == */

.sheet-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* == ABILITY SCORES == */

.ability-scores {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

/* (stats-and-personality removed — fully vertical flow now) */

.ability-score {
    border: 1.5px solid #222;
    padding: 0.35rem 0.25rem 0.6rem;
    text-align: center;
    background: #fff;
    position: relative;
}

.ability-score .ability-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #555;
    font-weight: 600;
}

.ability-score .ability-modifier {
    font-family: 'Charter', 'Bitstream Charter', Cambria, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}

.ability-score .ability-value {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.6rem;
    padding: 0.1rem 0.45rem;
    border-radius: 2px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* (center-column removed — sections stack directly in sheet-body) */

/* == SECTIONS (combat, skills, features) == */

.sheet-section {
    border: 1px solid #ccc;
    padding: 0.85rem 1rem;
    background: #fff;
}

.sheet-section h2 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #555;
    margin: 0 0 0.65rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

/* == COMBAT STATS == */

.combat-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.combat-stat {
    border: 1.5px solid #222;
    padding: 0.5rem 0.25rem;
    text-align: center;
    background: #fff;
}

.combat-stat .stat-value {
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.02em;
}

.combat-stat .stat-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #777;
    margin-top: 0.15rem;
    font-weight: 500;
}

/* == SKILLS LIST == */

.skills-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem 1.5rem;
    font-size: 0.82rem;
}

.skill-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0;
    border-bottom: 1px dotted #ddd;
}

.skill-item:last-child {
    border-bottom: none;
}

.skill-item .proficiency {
    width: 8px;
    height: 8px;
    border: 1.5px solid #333;
    border-radius: 50%;
    flex-shrink: 0;
}

.skill-item .proficiency.filled {
    background: #333;
}

.skill-item .proficiency.expertise {
    background: #333;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #333;
}


.skill-item .skill-name {
    color: #222;
}

.skill-item .skill-modifier {
    margin-left: auto;
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    color: #111;
}

/* == FEATURES SECTION (full width) == */

.features-section {
    margin-top: 0;
}

/* == FEATURES LIST == */

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

.features-list li {
    padding: 0.45rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.82rem;
    color: #222;
    line-height: 1.5;
}

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

.features-list li strong {
    color: #111;
    font-weight: 700;
}

/* == PERSONALITY GRID (2×2) == */

.personality-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.personality-box {
    border: 1px solid #ccc;
    padding: 0.75rem 0.85rem;
    background: #fff;
    /* Collapse borders between grid cells */
    margin-right: -1px;
    margin-bottom: -1px;
}

.personality-box h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #555;
    margin: 0 0 0.35rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

.personality-box p {
    font-size: 0.82rem;
    color: #333;
    margin: 0;
    line-height: 1.55;
    font-style: italic;
}

/* == BACKSTORY == */

.backstory-section {
    margin-top: 1.75rem;
    border-top: 3px double #222;
    padding-top: 1.5rem;
}

.backstory-section h2 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #555;
    margin: 0 0 1rem 0;
    font-weight: 600;
}

.backstory-content {
    column-count: 2;
    column-gap: 2rem;
    column-rule: 1px solid #e5e5e5;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #333;
}

.backstory-content p {
    margin: 0 0 0.85rem 0;
    text-align: justify;
    text-justify: inter-word;
}

/* == EQUIPMENT & LANGUAGES == */

.equipment-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 3px double #222;
}

.equipment-section h2 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    font-size: 0.6rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.18em !important;
    color: #555 !important;
    margin: 0 0 0.65rem 0 !important;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #ddd;
    font-weight: 600 !important;
}

.equipment-list,
.proficiencies-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.equipment-list li,
.proficiencies-list li {
    padding: 0.25rem 0;
    font-size: 0.82rem;
    color: #333;
    position: relative;
    padding-left: 0.85rem;
    border-bottom: 1px dotted #e5e5e5;
}

.equipment-list li:last-child,
.proficiencies-list li:last-child {
    border-bottom: none;
}

.equipment-list li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: #999;
    font-size: 0.7rem;
}

.proficiencies-list li::before {
    content: '\25C6';
    position: absolute;
    left: 0;
    color: #999;
    font-size: 0.45rem;
    top: 0.45rem;
}

/* == TOOLTIP == */

dnd-tooltip {
    position: relative;
    display: inline;
    border-bottom: 1px dotted #666;
    cursor: help;
    color: #111;
}

dnd-tooltip .tooltip-content {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #f5f5f5;
    padding: 0.65rem 0.85rem;
    font-size: 0.78rem;
    font-style: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    width: max-content;
    max-width: 260px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: opacity 0.15s;
}

dnd-tooltip .tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #222;
}

dnd-tooltip:hover .tooltip-content,
dnd-tooltip:focus .tooltip-content {
    opacity: 1;
    pointer-events: auto;
}

/* == LINKS == */

.character-sheet a {
    color: #111;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: #bbb;
    transition: text-decoration-color 0.15s;
}

.character-sheet a:hover {
    text-decoration-color: #111;
}

.level-badge {
    display: none;
}

/* == RESPONSIVE == */

@media (max-width: 900px) {
    .character-sheet {
        padding: 1.5rem;
    }

    .ability-score .ability-value {
        position: static;
        transform: none;
        display: block;
        margin-top: 0.25rem;
    }

    .backstory-content {
        column-count: 1;
    }

    .equipment-section {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

@media (max-width: 600px) {
    .character-sheet {
        padding: 1rem 1.25rem;
        border-width: 1.5px;
    }

    .sheet-header {
        grid-template-columns: 1fr;
    }

    .header-details {
        grid-template-columns: repeat(2, 1fr);
    }

    .ability-scores {
        grid-template-columns: repeat(3, 1fr);
    }

    .personality-grid {
        grid-template-columns: 1fr;
    }

    .skills-list {
        grid-template-columns: 1fr;
    }

    .combat-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .character-name-box h1 {
        font-size: 1.25rem;
    }

    dnd-tooltip .tooltip-content {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
    }

    dnd-tooltip .tooltip-content::after {
        display: none;
    }
}
