/* ==========================================================================
   mArtin's Tagebuch – Desktop Stylesheet (stil/index.css)
   ========================================================================== */

:root {
    --bg-page: #f5f4ef;
    --bg-card: #ffffff;
    --bg-subtle: #eeece4;
    --text-main: #1c1c1e;
    --text-muted: #636366;
    --accent: #b83b2b;
    --accent-hover: #922b1e;
    --border: #dad7cd;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: Georgia, "Times New Roman", serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.65;
}

/* --- Kopfbereich (Masthead) --- */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    padding: 20px 0 18px 0;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header-inner {
    max-width: 1300px;
    width: 94%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.site-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}

.site-title span {
    color: var(--accent);
}

.site-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-tagline {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.header-icon-links {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 8px;
}

.impressum-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.impressum-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.header-icon-links a {
    display: block;
    line-height: 0;
    border: 1px solid var(--border);
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.header-icon-links a:hover {
    border-color: var(--text-main);
    transform: translateY(-2px);
}

.header-icon-links img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    display: block;
}

/* --- Haupt-Layout: Inhalt links, Sidebar rechts --- */
.blog-layout {
    max-width: 1300px;
    width: 94%;
    margin: 32px auto 60px; /* Neu: 32px Abstand oben statt 0 */
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 32px;
    align-items: start;
}

/* --- Hinweise / Systemmeldungen --- */
.diary-notice {
    background-color: var(--bg-card);
    border-left: 4px solid var(--accent);
    padding: 14px 18px;
    margin-bottom: 24px;
    font-weight: 600;
}

/* --- Tagebuch-Einträge --- */
.diary-entry {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    padding: 32px 36px;
    margin-bottom: 28px;
}

.diary-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--bg-subtle);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.diary-entry-header time {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Beitragsinhalt: Basis-Lesbarkeit, ohne inline-Schriften zu überschreiben */
.diary-entry-body {
    font-family: var(--font-body);
    font-size: 1.06rem;
    line-height: 1.75;
    overflow-wrap: break-word;
}

.diary-entry-body p {
    margin-top: 0;
    margin-bottom: 1em;
}

.diary-entry-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.diary-entry-body a:hover {
    color: var(--accent-hover);
}

/* Inline-GIFs (Smileys, Rad-Icon) bleiben inline; große Bilder passen sich an */
.diary-entry-body img {
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
    height: auto;
}

.diary-entry-body table {
    max-width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

/* --- Kommentare --- */
.diary-comments {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    font-family: var(--font-ui);
}

.diary-comments summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    user-select: none;
}

.diary-comments summary:hover {
    color: var(--accent);
}

.no-comments {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.comment-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background-color: var(--bg-page);
    border-left: 3px solid var(--border);
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 0.93rem;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background-color: var(--bg-card);
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.comment-meta strong {
    color: var(--text-main);
}

.comment-delete-form {
    display: inline;
    margin-left: auto;
}

.comment-delete-btn {
    background-color: #fdf2f0;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 2px 8px;
    cursor: pointer;
}

.comment-delete-btn:hover {
    background-color: var(--accent);
    color: #ffffff;
}

.comment-item p {
    margin: 0;
}

.comment-emoji {
    display: inline-block;
    font-size: 1.15em;
    line-height: 1;
    vertical-align: -0.1em;
}

/* --- Kommentar-Formular --- */
.comment-form {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--bg-subtle);
}

.comment-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.comment-form label {
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    gap: 2px;
}

.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-page);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--text-main);
}

.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--bg-card);
}

.comment-form button {
    justify-self: start;
    padding: 6px 14px;
    background-color: var(--text-main);
    color: #ffffff;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.comment-form button:hover {
    background-color: var(--accent);
}

/* --- Sidebar (Suche, Kalender, Archiv, Links) --- */
.blog-sidebar {
    display: grid;
    gap: 18px;
}

.sidebar-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    padding: 15px 16px;
}

.sidebar-widget h2 {
    margin: 0 0 10px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--text-main);
    padding-bottom: 5px;
}

/* Suche */
.search-form {
    display: flex;
    gap: 6px;
}

.search-scope {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-scope label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.search-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-weight: 400;
}

.search-reset-link,
.search-context-link {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.search-reset-link:hover,
.search-context-link:hover {
    text-decoration: underline;
}

.search-form input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-page);
    font-size: 0.84rem;
}

.search-form button {
    padding: 5px 10px;
    background-color: var(--text-main);
    color: #ffffff;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    cursor: pointer;
}

.search-form button:hover {
    background-color: var(--accent);
}

/* Kalender */
.calendar-nav-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
}

.calendar-nav-form select {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid var(--border);
    background-color: var(--bg-page);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
}

.calendar-nav-form select:focus {
    outline: none;
    border-color: var(--accent);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.74rem;
}

.calendar-head {
    font-weight: 700;
    color: var(--text-muted);
    padding-bottom: 2px;
}

.calendar-day {
    padding: 3px 0;
    color: var(--text-muted);
    background-color: var(--bg-page);
}

.calendar-day.has-entry {
    background-color: var(--text-main);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.calendar-day.has-entry:hover {
    background-color: var(--accent);
}

/* Archiv & Links */
.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.sidebar-links li {
    border-bottom: 1px solid var(--bg-subtle);
}

.sidebar-links li:last-child {
    border-bottom: none;
}

.sidebar-links a {
    display: block;
    padding: 6px 0;
    color: var(--text-main);
    text-decoration: none;
}

.sidebar-links a:hover {
    color: var(--accent);
    padding-left: 4px;
}

/* --- Eigener Bestätigungs-Dialog --- */
.diary-dialog {
    border: 2px solid var(--text-main);
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 24px 28px;
    max-width: 400px;
    width: 90%;
    font-family: var(--font-ui);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.diary-dialog::backdrop {
    background-color: rgba(28, 28, 30, 0.55);
}

.diary-dialog-title {
    margin: 0 0 8px;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
}

.diary-dialog-text {
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.diary-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-btn-cancel,
.dialog-btn-confirm {
    padding: 7px 14px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.dialog-btn-cancel {
    background-color: var(--bg-page);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.dialog-btn-cancel:hover {
    border-color: var(--text-main);
}

.dialog-btn-confirm {
    background-color: var(--accent);
    border: 1px solid var(--accent);
    color: #ffffff;
}

.dialog-btn-confirm:hover {
    background-color: var(--accent-hover);
}

/* --- Auto-Scroll Monatstrenner & Status --- */
.month-divider {
    margin: 40px 0 24px;
    padding: 8px 14px;
    background-color: var(--bg-subtle);
    border-left: 4px solid var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.scroll-status {
    text-align: center;
    padding: 20px;
    margin: 24px 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    background-color: var(--bg-card);
}

.scroll-status.is-loading {
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Wienerisch-Lexikon (Stabilo-Boss & Tooltip) --- */
mark.wiener-mark {
    background: linear-gradient(104deg, rgba(255, 240, 0, 0) 0.9%, rgba(255, 240, 0, 0.95) 2.4%, rgba(255, 240, 0, 0.65) 5.8%, rgba(255, 240, 0, 0.85) 93%, rgba(255, 240, 0, 0.5) 98%, rgba(255, 240, 0, 0) 100%);
    color: inherit;
    padding: 0 3px;
    margin: 0 -1px;
    border-radius: 2px;
    cursor: help;
    border-bottom: 1px dashed rgba(28, 28, 30, 0.4);
}

mark.wiener-mark:hover,
mark.wiener-mark:focus {
    background: #fff000;
    outline: none;
}

.wiener-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 380px;
    width: max-content;
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--text-main);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    padding: 14px 16px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    line-height: 1.5;
    pointer-events: auto;
}

.wiener-tooltip[hidden] {
    display: none;
}

.wiener-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.wiener-tooltip-title {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    padding-top: 2px;
}

.wiener-tooltip-icon {
    width: 50px;
    height: 51px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    display: block;
}

.wiener-tooltip-body {
    max-height: 280px;
    overflow-y: auto;
}

/* --- Gipfelbild-Link & Lightbox --- */
.diary-entry-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gipfel-link {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--accent);
    background-color: #fdf2f0;
    padding: 2px 8px;
}

.gipfel-link:hover {
    background-color: var(--accent);
    color: #ffffff;
}

.gipfel-dialog {
    max-width: 860px;
    width: 94%;
    padding: 18px 20px;
}

.gipfel-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.gipfel-dialog-header .diary-dialog-title {
    margin: 0;
}

.gipfel-dialog-img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    margin: 0 auto;
    border: 1px solid var(--border);
}

.impressum-dialog {
    max-width: 1240px;
    width: 96%;
    padding: 24px 32px;
}

.impressum-dialog-body {
    max-height: 82vh;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.65;
    padding-right: 8px;
}

.impressum-layout {
    display: grid;
    grid-template-columns: 145px 1fr;
    gap: 24px;
    align-items: start;
}

.impressum-cover {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    display: block;
}

.impressum-text h3 {
    margin: 0 0 12px;
    font-family: var(--font-body);
    font-size: 1.25rem;
}

.impressum-text p {
    margin: 0 0 12px;
    text-align: justify;
    hyphens: auto;
}

.impressum-signature {
    margin-top: 16px;
    font-size: 0.9rem;
}

.impressum-badge {
    margin-top: 16px;
}

.impressum-badge img {
    max-width: 100%;
    height: auto;
}

.impressum-divider {
    border: 0;
    border-top: 1px dashed var(--border);
    margin: 24px 0;
}

.impressum-contact h4 {
    margin: 0 0 12px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--accent);
}

.impressum-contact input[type="email"] {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-page);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--text-main);
}

.impressum-contact input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--bg-card);
}

/* --- Kategorien (Badges & Sidebar) --- */
.diary-entry-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.cat-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background-color: var(--bg-page);
    border: 1px solid var(--border);
    padding: 2px 8px;
    text-decoration: none;
}

.cat-badge:hover {
    border-color: var(--text-main);
    color: var(--text-main);
}

.category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-list a.is-active-cat {
    color: var(--accent);
    font-weight: 700;
}

.cat-count {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--text-muted);
    background-color: var(--bg-page);
    padding: 1px 6px;
    border: 1px solid var(--border);
}
