/* =============================================================================
   Components - Buttons, forms, tags, categories, pills (front-porch retheme)
   ============================================================================= */

/* Category Pill */
.category {
    color: var(--ink);
    text-decoration: none;
    background: var(--color-category);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 700;
    border: 1px solid rgba(15, 15, 16, 0.10);
}

.category:hover {
    filter: brightness(0.96);
}

/* Tags */
.tags {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--ink);
    text-decoration: none;
    background: var(--color-tag);
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 15, 16, 0.10);
    font-weight: 700;
}

.tag:hover {
    filter: brightness(0.96);
    border-color: rgba(178, 58, 43, 0.5);
}

/* Buttons */
.btn {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.65rem 1.35rem;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.btn-primary {
    background: var(--rust);
    color: #fff7e8;
    border-color: var(--rust-dark);
    box-shadow: 0 6px 18px rgba(178, 58, 43, 0.30);
}

.btn-primary:hover {
    background: var(--rust-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 250, 239, 0.65);
    color: var(--ink);
    border-color: var(--line);
}

.btn-secondary:hover {
    background: rgba(255, 250, 239, 0.85);
    border-color: rgba(15, 15, 16, 0.30);
}

.btn-danger {
    background: var(--char);
    color: #fff7e8;
    border-color: var(--char);
}

.btn-danger:hover {
    background: #000;
}

.btn-delete {
    margin-left: auto;
}

.btn-small {
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    border-radius: 999px;
}

/* Forms */
.auth-form {
    max-width: 500px;
}

.post-form {
    width: 100%;
}

.post-form .form-textarea {
    min-height: 400px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    color: var(--ink);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-family: var(--font-serif);
    font-size: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 250, 239, 0.65);
    color: var(--ink);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--rust);
    background: rgba(255, 250, 239, 0.85);
    box-shadow: 0 0 0 3px rgba(178, 58, 43, 0.18);
}

.form-select.auto-detected {
    background-color: rgba(178, 58, 43, 0.10);
    border-color: var(--rust);
    transition: background-color 0.3s, border-color 0.3s;
}

.form-select:not(.auto-detected) {
    transition: background-color 0.5s, border-color 0.5s;
}

.form-textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.6;
}

.form-hint {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-error {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--rust-dark);
    background: rgba(178, 58, 43, 0.10);
    border: 1px solid rgba(178, 58, 43, 0.40);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.form-errors {
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-checkbox-group {
    margin-top: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--rust);
}

.summary-group {
    display: none;
}

.summary-group label {
    display: flex;
    align-items: center;
}

.confirm-delete {
    max-width: 500px;
}

.confirm-delete p {
    margin-bottom: 1rem;
}

.delete-preview {
    padding: 1rem;
    background: rgba(255, 250, 239, 0.55);
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 1.5rem;
}

.delete-preview .text-muted {
    color: var(--text-muted);
}

/* Post Type Toggle */
.post-type-toggle ul {
    list-style: none;
    display: flex;
    gap: 0;
    padding: 4px;
    margin: 0;
    background: rgba(15, 15, 16, 0.06);
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
    width: fit-content;
}

.post-type-toggle li {
    margin: 0;
    padding: 0;
}

.post-type-toggle li label {
    display: block;
    padding: 0.45rem 1.15rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    border-radius: 999px;
    margin: 0;
}

.post-type-toggle li input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.post-type-toggle li:has(input[type="radio"]:checked) label {
    background: var(--rust);
    color: #fff7e8;
    box-shadow: 0 4px 12px rgba(178, 58, 43, 0.30);
}

.post-type-toggle li label:hover {
    color: var(--ink);
}

.post-type-toggle li:has(input[type="radio"]:checked) label:hover {
    color: #fff7e8;
}

/* Pagination */
.pagination {
    font-family: var(--font-sans);
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.pagination a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
}

.pagination a:hover {
    text-decoration: underline;
    color: var(--rust);
}

@media (max-width: 500px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Tag Autocomplete */
.tag-autocomplete-wrapper {
    position: relative;
}

.tag-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 250, 239, 0.95);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(8px);
}

.tag-autocomplete-option {
    padding: 0.5rem 0.85rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.1s;
}

.tag-autocomplete-option:hover,
.tag-autocomplete-option.selected {
    background: rgba(178, 58, 43, 0.14);
    color: var(--rust-dark);
}

/* Error Pages */
.error-page {
    text-align: center;
    padding: 3rem 0;
}

.error-code {
    font-family: var(--font-serif);
    font-size: 6rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: rgba(178, 58, 43, 0.32);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-message {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.error-hint {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.error-action {
    margin-top: 2rem;
}

/* Reply/Quote/Thread notices in compose form */
.reply-notice,
.quote-notice,
.thread-notice {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    border-radius: 14px;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.25rem;
    color: var(--ink);
    border: 1px solid;
}

.reply-notice {
    background: rgba(178, 58, 43, 0.08);
    border-color: rgba(178, 58, 43, 0.40);
}

.quote-notice {
    background: rgba(244, 220, 130, 0.30);
    border-color: rgba(180, 140, 30, 0.45);
}

.thread-notice {
    background: rgba(15, 15, 16, 0.06);
    border-color: rgba(15, 15, 16, 0.25);
}

.reply-notice a,
.quote-notice a,
.thread-notice a {
    color: var(--link);
    word-break: break-all;
}

/* =============================================================================
   Gallery Grid - Used by camera, vision tag, and weather galleries
   ============================================================================= */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.gallery-grid-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255, 250, 239, 0.55);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.gallery-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(15, 15, 16, 0.16);
}

.gallery-grid-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    font-weight: 600;
}

.back-link:hover {
    color: var(--rust-dark);
}

.no-photos {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
