/* ==========================================================================
   Dan Schnau — Custom Site Styles (Light Mode, Serif)
   ========================================================================== */

/* 1. CSS Custom Properties
   ========================================================================== */
:root {
    --bg-body: #f0ece4;
    --bg-surface: #ffffff;
    --bg-card: #f7f5f0;
    --bg-input: #ffffff;
    --accent: #c05621;
    --accent-hover: #a84b1c;
    --accent-glow: rgba(192, 86, 33, 0.2);
    --text-primary: #2c2c2c;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-link: #1a6fb5;
    --text-link-hover: #124d80;
    --border-color: #d6d0c4;
    --border-subtle: #e8e4da;
    --danger: #c0392b;
    --success: #27864a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --font-serif: Georgia, "Times New Roman", Times, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    --container-max: 960px;
}

/* 2. Reset / Base
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-body);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-link-hover);
}

ol, ul {
    margin-left: 1rem;
    padding-left: 1rem;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-card);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--accent);
    border: 1px solid var(--border-subtle);
}

pre {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
}

/* 3. Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    font-family: var(--font-serif);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; color: var(--text-secondary); }
h3 { font-size: 1.25rem; }

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent { color: var(--accent); }
.text-small { font-size: 0.875rem; }
.text-center { text-align: center; }
.italic { font-style: italic; }
.bold { font-weight: 700; }

/* Inline SVG icons */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

/* 4. Layout
   ========================================================================== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease both;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-7-5 {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 2rem;
}

/* 5. Header + Nav
   ========================================================================== */
.site-header {
    background: linear-gradient(135deg, #3b2f1e 0%, #5a4632 50%, #4a3a28 100%);
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    border-bottom: 3px solid var(--accent);
    padding: 1rem 0;
}

.site-header .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.site-title:hover {
    color: #f0ece4;
}

.site-title h1 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

.site-nav li {
    display: flex;
}

.nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    transition: color var(--transition-fast), background var(--transition-fast);
    position: relative;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition-base), left var(--transition-base);
    border-radius: 1px;
}

.nav-link:hover::after {
    width: 60%;
    left: 20%;
}

/* 6. Blog listing (home page)
   ========================================================================== */
.blog-entry {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    animation: fadeInUp 0.4s ease both;
}

.blog-entry:last-child {
    border-bottom: none;
}

.blog-entry a {
    font-weight: 700;
    color: var(--text-link);
    transition: color var(--transition-fast);
}

.blog-entry a:hover {
    color: var(--accent);
}

.blog-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    margin-top: 0.15rem;
}

.blog-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.2rem 0 0;
}

.year-heading {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--accent-glow);
}

.year-heading:first-child {
    margin-top: 0.5rem;
}

/* Sidebar */
.sidebar {
    color: var(--text-secondary);
}

.sidebar img {
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.sidebar ul {
    padding-left: 1.25rem;
}

.sidebar li {
    margin-bottom: 0.4rem;
}

/* 7. Blog post (article)
   ========================================================================== */
.blog-post-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    margin-bottom: 1.5rem;
}

.page-card h2 {
    margin-top: 2rem;
}

.page-card img {
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.page-card blockquote {
    border-left: 3px solid var(--accent);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.page-card table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.page-card th,
.page-card td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.page-card th {
    background: var(--bg-card);
    font-weight: 700;
}

/* 8. Endorsements (HireMe)
   ========================================================================== */
.endorsements {
    list-style: none;
    padding: 0;
    margin: 0;
}

.endorsement {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    transition: border-left-width var(--transition-base), transform var(--transition-base);
}

.endorsement:hover {
    border-left-width: 5px;
    transform: translateX(2px);
}

.endorsement blockquote {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.endorsement p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.endorsement p:last-child {
    margin-bottom: 0;
}

.endorsement-source {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    margin-top: 0.75rem;
}

.endorsement-source a {
    color: var(--text-link);
}

/* 9. Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-sans);
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #a93226;
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.25);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-light {
    background: transparent;
    color: var(--text-link);
    border: none;
    padding: 0.4rem 0.6rem;
    text-align: left;
}

.btn-light:hover {
    color: var(--accent);
    transform: none;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* GUID button */
.guid-btn {
    padding: 0.75rem 1.25rem;
    font-size: 2.5rem;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.guid-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.guid-btn:active {
    transform: translateY(0);
    animation: pulse 0.3s ease;
}

.guid-btn code {
    background: none;
    color: inherit;
    font-size: inherit;
    padding: 0;
    border: none;
}

/* 10. Forms
   ========================================================================== */
.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    color: var(--text-secondary);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control {
    resize: vertical;
}

/* 11. Admin components
   ========================================================================== */

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeInUp 0.3s ease both;
}

.alert-success {
    background: rgba(39, 134, 74, 0.1);
    border: 1px solid rgba(39, 134, 74, 0.3);
    color: var(--success);
}

.alert-danger {
    background: rgba(192, 57, 43, 0.1);
    border: 1px solid rgba(192, 57, 43, 0.3);
    color: var(--danger);
}

.alert .btn-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.7;
    line-height: 1;
}

.alert .btn-close::after {
    content: '\00d7';
}

.alert .btn-close:hover {
    opacity: 1;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.2em 0.5em;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* List group */
.list-group {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-group-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.list-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Progress bar */
.progress {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    animation: progressPulse 1.5s ease-in-out infinite;
}

/* Admin nav */
.admin-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    font-family: var(--font-sans);
}

.admin-nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    text-decoration: none;
}

.admin-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.admin-nav a:hover {
    color: var(--text-primary);
}

/* Inline form helper */
.inline-form {
    display: inline;
}

/* 12. Toast / notification (CSS-only)
   ========================================================================== */
.toast-notification {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
    transform: translateY(120%);
    opacity: 0;
    transition: transform var(--transition-base), opacity var(--transition-base);
    z-index: 1000;
    pointer-events: none;
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}

/* 13. Footer
   ========================================================================== */
.page-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    gap: 0.5rem;
}

.page-footer a {
    color: var(--text-link);
}

/* 14. GUID page center area */
.guid-display {
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
}

/* 15. Preview panel */
.preview-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-height: 500px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg-card);
    color: var(--text-primary);
}

/* 16. Drop zone */
.drop-zone {
    position: relative;
}

.drop-zone.drag-over textarea,
.drop-zone.drag-over .cm-editor {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* CodeMirror editor wrapper */
.cm-wrapper .cm-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 500px;
    max-height: 80vh;
}

.cm-wrapper .cm-editor .cm-scroller {
    min-height: 500px;
}

/* 17. Utility classes
   ========================================================================== */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.my-3 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.p-3 { padding: 1.5rem; }
.gap-sm { gap: 0.5rem; }
.flex-row { display: flex; flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.d-inline { display: inline; }
.w-100 { width: 100%; }

/* 18. Animations
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.97); }
    100% { transform: scale(1); }
}

@keyframes toastIn {
    from {
        transform: translateY(120%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(120%);
        opacity: 0;
    }
}

@keyframes progressPulse {
    0% { opacity: 1; width: 30%; }
    50% { opacity: 0.7; width: 70%; }
    100% { opacity: 1; width: 30%; }
}

/* Staggered blog entry animations */
.blog-entry:nth-child(1) { animation-delay: 0s; }
.blog-entry:nth-child(2) { animation-delay: 0.05s; }
.blog-entry:nth-child(3) { animation-delay: 0.1s; }
.blog-entry:nth-child(4) { animation-delay: 0.15s; }
.blog-entry:nth-child(5) { animation-delay: 0.2s; }
.blog-entry:nth-child(6) { animation-delay: 0.25s; }
.blog-entry:nth-child(7) { animation-delay: 0.3s; }
.blog-entry:nth-child(8) { animation-delay: 0.35s; }
.blog-entry:nth-child(9) { animation-delay: 0.4s; }
.blog-entry:nth-child(10) { animation-delay: 0.45s; }

/* 19. Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .site-nav {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-link {
        padding: 0.5rem 0;
    }

    .nav-link::after {
        display: none;
    }

    .grid-2,
    .grid-7-5 {
        grid-template-columns: 1fr;
    }

    .page-card {
        padding: 1.25rem;
        margin-top: 1rem;
        border-radius: var(--radius-md);
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .guid-btn {
        font-size: 1.25rem;
        padding: 0.6rem 1rem;
    }

    .page-footer {
        flex-direction: column;
        text-align: center;
    }

    .list-item-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .guid-btn {
        font-size: 1rem;
        word-break: break-all;
    }
}

/* 20. Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* 21. Custom scrollbar
   ========================================================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-body);
}
