/* ============================================================
   Family Heritage — Phase 9: Advanced Features Styles
   Timeline, Traits, Time Machine, Explorer, Recipes,
   Gazette, Documents, Handwriting, Memorials
   ============================================================ */

/* ============================================================
   9.1 — Living Timeline
   ============================================================ */

.tl-page {
    max-width: 100%;
    overflow-x: hidden;
}

/* Hero */
.tl-hero {
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    position: relative;
}

.tl-hero-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.tl-hero-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
}

.tl-hero-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 2rem;
    font-family: var(--font-heading);
}

.tl-hero-info h1 {
    font-size: 2rem;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.tl-hero-dates {
    font-size: 1.2rem;
    color: var(--primary-light);
    font-family: var(--font-heading);
}

.tl-hero-subtitle {
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.25rem;
}

.tl-hero-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* Timeline Container */
.tl-container {
    position: relative;
    padding: 1rem 0 1rem 2rem;
    max-width: 800px;
    margin: 0 auto 100px auto;
}

.tl-line {
    position: absolute;
    left: 28px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent-light), var(--accent), var(--primary-light));
    border-radius: 2px;
}

/* Event Cards */
.tl-event-card {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    position: relative;
}

.tl-event-card.tl-visible {
    opacity: 1;
    transform: translateX(0);
}

.tl-event-date-marker {
    flex: 0 0 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.tl-event-year {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.tl-event-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--bg);
    margin-top: 4px;
    box-shadow: 0 0 0 2px currentColor;
}

.tl-event-content {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    transition: box-shadow 0.2s ease;
}

.tl-event-content:hover {
    box-shadow: var(--shadow-hover);
}

.tl-event-icon {
    margin-bottom: 0.35rem;
}

.tl-event-title {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.tl-event-desc {
    color: var(--text);
    line-height: 1.5;
    font-size: 0.95rem;
}

.tl-event-photo {
    margin-top: 0.75rem;
}

.tl-event-photo img {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.tl-event-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent);
    font-size: 0.85rem;
    text-decoration: none;
}

.tl-event-link:hover {
    text-decoration: underline;
}

/* Controls Bar */
.tl-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    flex-wrap: wrap;
}

.tl-control-btn {
    font-size: 0.85rem;
}

.tl-speed-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.tl-speed-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

.tl-speed-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tl-speed-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Person Selector */
.tl-person-selector {
    max-width: 600px;
    margin: 0 auto;
}

.tl-person-selector h3 {
    margin-bottom: 1rem;
}

.tl-person-results {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.tl-person-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.tl-person-item:last-child {
    border-bottom: none;
}

.tl-person-item:hover {
    background: var(--bg);
}

.tl-person-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tl-person-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.tl-person-item-name {
    font-weight: 600;
    color: var(--primary);
}

.tl-person-item-dates {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tl-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}


/* ============================================================
   9.3 — Family Traits
   ============================================================ */

.traits-add-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.traits-add-form h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.traits-add-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.traits-add-row .form-input {
    flex: 1;
    min-width: 200px;
}

.traits-add-row .form-select {
    width: auto;
    min-width: 140px;
}

.trait-category-section {
    margin-bottom: 2rem;
}

.trait-category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.trait-category-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.trait-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trait-card {
    padding: 0.6rem 1rem;
    border-radius: 20px;
    border: 2px solid;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trait-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.trait-card-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.trait-card-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Trait chips (person profile) */
.trait-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform var(--transition);
    margin: 2px;
}

.trait-chip:hover {
    transform: scale(1.05);
}

.trait-chip-remove {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.5;
    padding: 0 0 0 4px;
    line-height: 1;
    color: inherit;
}

.trait-chip-remove:hover {
    opacity: 1;
}

.trait-chip-large {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
}

/* People panel */
.trait-people-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-lg);
}

.trait-people-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.trait-people-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.trait-people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.trait-person-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: background var(--transition);
}

.trait-person-item:hover {
    background: var(--border);
}

.trait-person-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.trait-person-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.trait-person-notes {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Person traits section */
.person-traits-section h3 {
    margin-bottom: 0.75rem;
}

.person-traits-chips {
    margin-bottom: 1rem;
}

.person-traits-add,
.person-traits-create {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}


/* ============================================================
   9.4 — Time Machine
   ============================================================ */

.tm-page {
    padding-bottom: 2rem;
}

.tm-controls {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.tm-year-display {
    text-align: center;
    margin-bottom: 1rem;
}

.tm-year-number {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    display: block;
    line-height: 1;
}

.tm-alive-count {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 500;
}

.tm-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tm-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, var(--accent-light), var(--accent));
    border-radius: 4px;
    outline: none;
}

.tm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow);
}

.tm-slider-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.tm-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tm-speed-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.tm-speed-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

.tm-speed-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tm-speed-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tm-step-buttons {
    display: flex;
    gap: 0.35rem;
}

/* Tree container */
.tm-tree-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    padding: 1rem 0;
}

.tm-no-people {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 3rem;
    width: 100%;
}

/* Tree nodes */
.tm-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.tm-node-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
    transition: all var(--transition);
    min-width: 80px;
    text-align: center;
}

.tm-node-inner:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

/* Age categories */
.tm-node-child .tm-node-inner {
    transform: scale(0.85);
    border-color: var(--info);
}

.tm-node-adult .tm-node-inner {
    border-color: var(--primary-light);
}

.tm-node-elderly .tm-node-inner {
    border-color: var(--accent);
    border-width: 3px;
    background: linear-gradient(135deg, var(--bg-card), #FFF8E7);
}

.tm-node-newborn .tm-node-inner {
    animation: tm-glow 2s ease infinite;
    border-color: var(--success);
}

.tm-node-dying .tm-node-inner {
    opacity: 0.5;
}

@keyframes tm-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(74, 124, 89, 0.3); }
    50% { box-shadow: 0 0 20px rgba(74, 124, 89, 0.5); }
}

.tm-node-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.35rem;
}

.tm-node-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.tm-node-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

.tm-node-surname {
    font-size: 0.7rem;
    color: var(--text-light);
}

.tm-node-age {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: 2px;
}

.tm-spouse {
    margin-top: 0.5rem;
    position: relative;
}

.tm-spouse::before {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--accent);
    margin: 0 auto 4px auto;
}

.tm-children {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--border);
    justify-content: center;
}


/* ============================================================
   9.5 — Relationship Explorer
   ============================================================ */

.expl-selectors {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.expl-selectors > div {
    flex: 1;
    min-width: 250px;
}

.expl-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2rem;
    flex: 0 0 auto;
}

.expl-selector-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.expl-selector-label {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.expl-selector-selected {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.expl-selected-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.expl-selected-name {
    font-weight: 600;
    color: var(--primary);
    flex: 1;
}

.expl-change-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-light);
    transition: all var(--transition);
}

.expl-change-btn:hover {
    background: var(--bg);
    border-color: var(--accent);
}

.expl-selector-results {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.expl-result-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.expl-result-item:hover {
    background: var(--bg);
}

.expl-result-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.expl-result-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
}

.expl-result-name {
    font-size: 0.9rem;
    color: var(--text);
}

.expl-action {
    text-align: center;
    margin-bottom: 2rem;
}

.expl-results-container {
    max-width: 700px;
    margin: 0 auto;
}

.expl-no-connection {
    text-align: center;
    padding: 3rem;
}

.expl-no-connection h3 {
    margin-top: 1rem;
    color: var(--text-muted);
}

/* Path cards */
.expl-path-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.expl-path-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.expl-path-label {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.expl-degrees-badge {
    background: var(--accent);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.expl-path-description {
    font-style: italic;
    color: var(--primary-light);
    font-size: 1.05rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

/* Chain visualization */
.expl-chain {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.expl-chain-node {
    text-align: center;
}

.expl-chain-node a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.expl-chain-node a:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.expl-chain-endpoint a {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card), #FFF8E7);
}

.expl-chain-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.expl-chain-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.expl-chain-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.expl-chain-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
}

.expl-chain-via {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 2px 8px;
    background: var(--bg);
    border-radius: 10px;
}


/* ============================================================
   9.6 — Family Recipes
   ============================================================ */

.recipe-search-bar {
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.recipe-card-photo {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.recipe-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FFF8E7, #F5E6D3);
}

.recipe-card-body {
    padding: 1rem;
}

.recipe-card-title {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.recipe-card-person {
    font-size: 0.85rem;
    color: var(--accent);
    font-style: italic;
}

.recipe-card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

.recipe-evolution-badge {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    padding: 2px 8px;
    background: var(--info-light);
    color: var(--info);
    border-radius: 10px;
}

/* Recipe Detail */
.recipe-back-row {
    margin-bottom: 1rem;
}

.recipe-detail {
    max-width: 800px;
}

.recipe-detail-hero {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.recipe-detail-photo {
    width: 240px;
    height: 240px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.recipe-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FFF8E7, #F5E6D3);
    border-radius: var(--radius-lg);
}

.recipe-detail-info h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.recipe-detail-person {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.recipe-detail-person a {
    color: var(--accent);
    text-decoration: none;
}

.recipe-detail-desc {
    color: var(--text);
    line-height: 1.6;
}

.recipe-content-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.recipe-ingredients h3,
.recipe-instructions h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.recipe-ingredients ul {
    list-style: disc;
    padding-left: 1.25rem;
}

.recipe-ingredients li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.recipe-instructions ol {
    padding-left: 1.25rem;
}

.recipe-instructions li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.recipe-story-section {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
    margin-bottom: 2rem;
}

.recipe-story-section h3 {
    margin-bottom: 0.75rem;
}

/* Evolution tree */
.recipe-evolution {
    margin-bottom: 2rem;
}

.recipe-evo-chain {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.recipe-evo-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
}

.recipe-evo-current {
    background: var(--accent-light);
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
}

.recipe-evo-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.recipe-evo-link:hover {
    color: var(--accent);
}

.recipe-evo-person {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.recipe-evo-arrow {
    font-size: 1.2rem;
    color: var(--accent);
}

.recipe-detail-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Recipe Form */
.recipe-form {
    max-width: 700px;
}

.recipe-parent-info {
    padding: 0.75rem 1rem;
    background: var(--info-light);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Cookbook Preview */
.cookbook-preview {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    max-width: 800px;
    margin: 0 auto;
}

.cookbook-cover {
    text-align: center;
    padding: 3rem;
    border-bottom: 3px double var(--primary);
    margin-bottom: 2rem;
}

.cookbook-cover h1 {
    font-size: 2.5rem;
    color: var(--primary);
}

.cookbook-cover p {
    color: var(--primary-light);
    font-style: italic;
    font-size: 1.1rem;
}

.cookbook-count {
    margin-top: 1rem;
    color: var(--accent);
}

.cookbook-toc {
    margin-bottom: 3rem;
}

.cookbook-toc h2 {
    margin-bottom: 1rem;
}

.cookbook-toc-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px dotted var(--border);
    align-items: baseline;
}

.cookbook-toc-num {
    color: var(--accent);
    font-weight: 600;
}

.cookbook-toc-title {
    flex: 1;
    color: var(--primary);
}

.cookbook-toc-person {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cookbook-recipe-page {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.cookbook-recipe-title {
    font-size: 1.5rem;
    color: var(--primary);
}

.cookbook-recipe-attribution {
    font-style: italic;
    color: var(--accent);
    margin-bottom: 1rem;
}

.cookbook-recipe-photo {
    max-width: 300px;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.cookbook-recipe-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    margin-top: 1rem;
}

.cookbook-recipe-col h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.cookbook-ingredients {
    list-style: disc;
    padding-left: 1.25rem;
}

.cookbook-instructions {
    padding-left: 1.25rem;
}

.cookbook-recipe-story {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}


/* ============================================================
   9.7 — Family Gazette / Newspaper
   ============================================================ */

.gazette-page {
    max-width: 900px;
    margin: 0 auto;
}

.gazette-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.gazette-month-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gazette {
    background: #FDF5E6;
    border: 2px solid #8B7355;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.gazette-masthead {
    text-align: center;
    margin-bottom: 2rem;
}

.gazette-masthead-rule {
    height: 3px;
    background: linear-gradient(to right, transparent, #5B4A3F, transparent);
    margin: 0.75rem 0;
}

.gazette-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 2.5rem;
    color: #3E3028;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.gazette-subtitle {
    font-family: 'Georgia', serif;
    font-size: 1rem;
    color: #8B7355;
    font-style: italic;
}

/* Multi-column newspaper layout */
.gazette-columns {
    column-count: 2;
    column-gap: 2rem;
    column-rule: 1px solid #D4C4A8;
}

.gazette-column {
    break-inside: avoid;
}

.gazette-article {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #D4C4A8;
}

.gazette-article:last-child {
    border-bottom: none;
}

.gazette-article-title {
    font-family: 'Georgia', serif;
    font-size: 1.15rem;
    color: #3E3028;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid #C19A6B;
}

/* Gazette items */
.gazette-member-item {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.gazette-member-item a {
    color: #5B4A3F;
    font-weight: 600;
    text-decoration: none;
}

.gazette-birthday-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: baseline;
}

.gazette-birthday-date {
    font-weight: 600;
    color: #C19A6B;
    font-size: 0.85rem;
    white-space: nowrap;
}

.gazette-birthday-item a {
    color: #5B4A3F;
    text-decoration: none;
    font-weight: 500;
}

.gazette-story-item {
    margin-bottom: 1rem;
}

.gazette-story-title {
    color: #5B4A3F;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
}

.gazette-story-person {
    font-size: 0.85rem;
    color: #8B7355;
    font-style: italic;
    margin-left: 0.5rem;
}

.gazette-story-excerpt {
    font-size: 0.9rem;
    color: #555;
    margin-top: 0.25rem;
    line-height: 1.5;
}

.gazette-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.gazette-photo-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid #D4C4A8;
}

.gazette-event-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.gazette-event-date {
    font-size: 0.85rem;
    color: #C19A6B;
    font-weight: 600;
    white-space: nowrap;
}

.gazette-event-title {
    color: #5B4A3F;
}

/* Leaderboard */
.gazette-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.gazette-leader-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}

.gazette-leader-rank {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.gazette-leader-name {
    flex: 1;
    font-weight: 500;
    color: #5B4A3F;
}

.gazette-leader-points {
    color: #C19A6B;
    font-weight: 600;
    font-size: 0.85rem;
}

.gazette-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #8B7355;
    font-style: italic;
}

.gazette-footer {
    text-align: center;
    margin-top: 1.5rem;
}


/* ============================================================
   9.10 — Documents
   ============================================================ */

.doc-filter-bar {
    margin-bottom: 1.5rem;
    max-width: 250px;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.doc-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}

.doc-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.doc-card-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: var(--bg);
}

.doc-card-file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 0.25rem;
}

.doc-file-ext {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.doc-card-no-file {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.doc-card-body {
    padding: 0.75rem;
}

.doc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.35rem;
}

.doc-card-title {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 0.15rem;
}

.doc-card-person {
    font-size: 0.8rem;
    color: var(--text-light);
}

.doc-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Document Detail */
.doc-back-row {
    margin-bottom: 1rem;
}

.doc-detail {
    max-width: 900px;
}

.doc-viewer {
    margin-bottom: 2rem;
}

.doc-viewer-img {
    max-width: 100%;
    max-height: 600px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: block;
    margin: 0 auto;
}

.doc-viewer-pdf {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.doc-no-file {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.doc-detail-meta {
    margin-bottom: 1.5rem;
}

.doc-detail-meta h1 {
    margin-bottom: 0.5rem;
}

.doc-detail-person,
.doc-detail-date,
.doc-detail-notes,
.doc-detail-checksum {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.doc-detail-person a {
    color: var(--accent);
    text-decoration: none;
}

.doc-detail-ocr {
    margin-top: 1.5rem;
}

.doc-ocr-text {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.doc-detail-checksum code {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

.doc-detail-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Upload Form */
.doc-form {
    max-width: 700px;
}

.doc-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 1.5rem;
    background: var(--bg);
}

.doc-dropzone:hover,
.doc-dropzone-active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.doc-dropzone p {
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.doc-file-input {
    display: none;
}

.doc-file-name {
    font-weight: 500;
    color: var(--primary);
    margin-top: 0.5rem;
}


/* ============================================================
   9.11 — Handwriting Preservation
   ============================================================ */

.hw-filter-bar {
    margin-bottom: 1.5rem;
    max-width: 250px;
}

.hw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.hw-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow var(--transition);
    border: 1px solid var(--border);
}

.hw-card:hover {
    transform: rotate(0deg) translateY(-4px) !important;
    box-shadow: var(--shadow-hover);
}

.hw-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    background: #F5EDE3;
}

.hw-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5EDE3;
    color: var(--text-muted);
}

.hw-card-body {
    padding: 0.75rem;
}

.hw-cat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.35rem;
}

.hw-card-writer {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

.hw-card-recipient {
    font-size: 0.8rem;
    color: var(--text-light);
}

.hw-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Handwriting Detail */
.hw-detail {
    max-width: 800px;
}

.hw-detail-viewer {
    margin-bottom: 1.5rem;
}

.hw-detail-img {
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: block;
    margin: 0 auto;
}

.hw-detail-meta {
    margin-bottom: 1.5rem;
}

.hw-detail-field {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.hw-detail-field a {
    color: var(--accent);
    text-decoration: none;
}

.hw-detail-transcription {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}

.hw-detail-transcription h3 {
    margin-bottom: 0.5rem;
}

.hw-detail-transcription p {
    line-height: 1.7;
    font-style: italic;
}

.hw-detail-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}


/* ============================================================
   9.12 — Memorial Pages
   ============================================================ */

.memorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.memorial-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    height: 200px;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow);
}

.memorial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.memorial-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
    z-index: 1;
}

.memorial-card-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memorial-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.4);
    font-size: 3rem;
    font-family: var(--font-heading);
}

.memorial-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    z-index: 2;
    color: white;
}

.memorial-card-name {
    font-size: 1.15rem;
    color: white;
    margin-bottom: 0.15rem;
}

.memorial-card-dates {
    font-size: 0.9rem;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.85);
}

/* Memorial Page */
.memorial-page {
    max-width: 100%;
}

.memorial-hero {
    position: relative;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    margin: 0 -1rem;
    overflow: hidden;
}

.memorial-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(30, 20, 15, 0.6), rgba(30, 20, 15, 0.85));
    z-index: 1;
}

.memorial-hero-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.memorial-hero-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.2);
    font-size: 6rem;
    font-family: var(--font-heading);
}

.memorial-hero-content {
    position: relative;
    z-index: 2;
    color: white;
}

.memorial-hero-name {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.memorial-hero-dates {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-heading);
}

.memorial-hero-epitaph {
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.75rem;
    font-size: 1.1rem;
}

.memorial-back-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
}

/* Body */
.memorial-body {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.memorial-visitor-badge {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 2rem;
}

.memorial-info-section {
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.memorial-info-item {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.memorial-bio {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-style: italic;
    color: var(--text-light);
}

/* Actions */
.memorial-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.memorial-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    color: var(--text);
}

.memorial-action-btn:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.memorial-action-count {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
}

/* Candles */
.memorial-candles-section,
.memorial-flowers-section {
    margin-bottom: 2rem;
}

.memorial-candles-section h3,
.memorial-flowers-section h3 {
    text-align: center;
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.memorial-candles-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    align-items: flex-end;
}

.memorial-candle-svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.memorial-candle-more,
.memorial-flower-more {
    font-size: 0.85rem;
    color: var(--text-muted);
    align-self: center;
}

/* Flowers */
.memorial-flowers-wall {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.memorial-flower {
    display: inline-flex;
    transition: transform 0.3s ease;
}

.memorial-flower:hover {
    transform: scale(1.3);
}

/* Memory Wall */
.memorial-memory-wall {
    margin-bottom: 2rem;
}

.memorial-memory-wall h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.memorial-add-memory {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.memorial-add-memory-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
}

.memorial-entry-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
    border-left: 3px solid var(--accent-light);
}

.memorial-entry-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.memorial-entry-author {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.memorial-entry-type {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--accent-light);
    color: var(--primary);
}

.memorial-entry-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.memorial-entry-content {
    line-height: 1.6;
    color: var(--text);
}

/* Links */
.memorial-links {
    margin-bottom: 2rem;
}

.memorial-links h3 {
    text-align: center;
    margin-bottom: 1rem;
}

.memorial-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.memorial-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--primary);
    font-size: 0.85rem;
    text-align: center;
    transition: all var(--transition);
}

.memorial-link-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}


/* ============================================================
   Responsive Breakpoints
   ============================================================ */

@media (max-width: 768px) {
    /* Timeline */
    .tl-hero-inner {
        flex-direction: column;
        text-align: center;
    }

    .tl-hero-photo {
        width: 80px;
        height: 80px;
    }

    .tl-hero-info h1 {
        font-size: 1.5rem;
    }

    .tl-container {
        padding-left: 1rem;
    }

    .tl-line {
        left: 12px;
    }

    .tl-controls {
        justify-content: center;
    }

    .tl-speed-controls {
        margin-left: 0;
    }

    /* Traits */
    .traits-add-row {
        flex-direction: column;
    }

    .traits-add-row .form-input {
        min-width: 100%;
    }

    /* Time Machine */
    .tm-year-number {
        font-size: 2.2rem;
    }

    .tm-buttons {
        justify-content: center;
    }

    .tm-speed-controls {
        margin-left: 0;
    }

    /* Explorer */
    .expl-selectors {
        flex-direction: column;
    }

    .expl-arrow {
        padding-top: 0;
        transform: rotate(90deg);
    }

    /* Recipes */
    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .recipe-detail-hero {
        flex-direction: column;
    }

    .recipe-detail-photo {
        width: 100%;
        height: 200px;
    }

    .recipe-content-grid {
        grid-template-columns: 1fr;
    }

    .cookbook-recipe-content {
        grid-template-columns: 1fr;
    }

    /* Gazette */
    .gazette-columns {
        column-count: 1;
    }

    .gazette-title {
        font-size: 1.8rem;
    }

    .gazette-nav {
        flex-direction: column;
        align-items: center;
    }

    /* Documents */
    .doc-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    /* Handwriting */
    .hw-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .hw-card {
        transform: rotate(0deg) !important;
    }

    /* Memorials */
    .memorial-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .memorial-hero {
        min-height: 250px;
        padding: 2rem 1rem;
    }

    .memorial-hero-name {
        font-size: 1.8rem;
    }

    .memorial-actions {
        flex-direction: column;
        align-items: center;
    }

    .memorial-action-btn {
        width: 100%;
        max-width: 250px;
        flex-direction: row;
        justify-content: center;
    }

    .memorial-links-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .tl-hero-actions {
        position: static;
        margin-top: 1rem;
        text-align: center;
    }

    .tl-event-card {
        flex-direction: column;
    }

    .tl-event-date-marker {
        flex-direction: row;
        gap: 0.5rem;
    }

    .recipe-detail-actions {
        flex-direction: column;
    }

    .gazette {
        padding: 1rem;
    }

    .gazette-title {
        font-size: 1.4rem;
    }

    .memorial-card {
        height: 160px;
    }

    .cookbook-preview {
        padding: 1.5rem;
    }
}


/* ============================================================
   Print Styles — Cookbook
   ============================================================ */

@media print {
    .cookbook-preview {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .page-header,
    .gazette-nav,
    .gazette-footer,
    .doc-back-row,
    .recipe-back-row,
    .recipe-detail-actions,
    .memorial-back-btn,
    .memorial-actions,
    .memorial-add-memory {
        display: none !important;
    }

    .cookbook-recipe-page {
        page-break-after: always;
    }
}
