/* Main styles for PHP Microblog */

/* Base styles */
body {
    font-family: apple-system-ui-serif, ui-serif, Charter, Georgia, Verdana;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
    font-size: 1.1em;
    background: whitesmoke;
    color: #222;
}

h1.site-title {
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: center;
}

article.microblog-feed {
    display: flex;
    flex-direction: column;
}

section.post {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    position: relative;
}

section[class*="draft"] {
    border-left: 4px solid #ff9800;
    background: #fffdf7;
    padding-left: 1rem;
}

section.post::before {
    display: block;
    font-size: 2em;
    margin-bottom: 0.25em;
    opacity: 0.8;
    content: "✍️ ";
}

section.post.note::before { content: "📝 "; }
section.post.link::before { content: "🔗 "; }
section.post.picture::before { content: "📷 "; }
section.post.audio::before { content: "🎙️ "; }

.audio-journal {
    background: #fefefe;
    border-left: 4px solid #3b2c1d;
    padding: 1rem;
    margin: 0;
}

.audio-journal blockquote {
    margin: 0 0 0.5rem 0;
    font-style: italic;
    color: #444;
}

.audio-journal audio {
    width: 100%;
}

.draft-label {
    font-size: 0.7em;
    color: #b95e00;
    background: #fff4e6;
    border: 1px solid #f0c089;
    padding: 2px 6px;
    margin-left: 10px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Post header and buttons */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5em;
}

.post-actions {
    display: flex;
    gap: 6px;
    margin-top: 5px;
}

.post-actions form {
    display: inline;
}

.inline-form {
  display: inline;
}

.edit-btn,
.delete-btn {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
}

.edit-btn {
    background: #6c757d;
    color: white;
}

.edit-btn:hover {
    background: #5a6268;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
}

/* Post body and content */
.post-body {
    margin-top: 0.5rem;
}

.post-content {
    padding-top: 0.5em;
}

section.picture img,
section.post img {
    display: block;
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    margin: 0.5em 0;
}

section.picture figcaption {
    font-size: 0.9em;
    color: #666;
}

section.link a {
    color: #003366;
    text-decoration: underline dotted;
    display: inline-block;         /* Allows max-width and ellipsis */
	max-width: 100%;               /* Prevents overrunning container */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: bottom;
	background: rgba(25,118,210,0.05); /* Light blue highlight */
	border-radius: 4px;
	padding: 1px 4px;
	text-decoration: none;         /* Remove underline for subtlety */
	transition: 
		background 0.18s,
		color 0.18s,
		box-shadow 0.2s;
	font-weight: 500;
	box-shadow: 0 1px 2px rgba(25,118,210,0.05);
	word-break: break-all;         /* Fallback for super long URLs */
}

section.link a:hover {
    color: #000;
    text-decoration: underline;
}

section.post.note .post-content {
    font-style: italic;
    color: #444;
}

/* Typographic defaults */
h2.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

time {
    font-size: 0.9em;
    color: #666;
}

/* Divider */
.divider {
    text-align: center;
    color: #999;
    font-size: 1.2em;
    letter-spacing: 0.2em;
    margin: 2em 0;
}

/* Footer and Nav */
footer {
    text-align: center;
    font-size: 0.95em;
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid #eee;
}

footer a {
    color: #007bff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

nav {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    border-top: 1px solid #ddd;
    justify-content: center;
}

nav a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    button {
        width: 100%;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1e1a17;
        color: #e8e5db;
    }

    h1.site-title {
        color: #ffe8c1;
    }

    section[class*="draft"] {
        border-left-color: #ffa94d;
        background: #2b1e00;
    }

    .draft-label {
        background: #4b2e00;
        color: #ffe4b3;
        border-color: #885d1a;
    }

    section.post.note .post-content,
    section.post.picture .post-content {
        color: #d4c4a8;
    }
    
    .audio-journal {
        background: #222;
        border-left-color: #666;
    }

    .audio-journal blockquote {
        color: #ccc;
    }

    .post-header time {
        color: #b9a893;
    }

    a, nav a, footer a {
        color: #e3b27f;
    }

    a:hover,
    nav a:hover,
    footer a:hover {
        color: #fff0d5;
    }

    .delete-btn {
        background: #cc6b5a;
    }

    .delete-btn:hover {
        background: #e27e6b;
    }

    .edit-btn {
        background: #777;
    }

    .edit-btn:hover {
        background: #999;
    }

    .divider {
        color: #6e5f50;
    }

    footer {
        border-top-color: #3a2f28;
        color: #b9a893;
    }
}
