/* ==========================================================================
   Third Places - Simplified Stylesheet
   ========================================================================== */

:root {
    /* primary light-mode colors, high contrast light background vs dark text */
    --color-text: #3d342f; /* Warm brown-gray - soft readability */
    --color-link: #5a4a42; /* Warm dark brown - default links */
    --color-link-hover: #b8736c; /* Darker brown - matches text, highlighted */
    --color-primary: #d4a59a; /* Light terracotta - warm, readable */
    --color-secondary: #c5d5c5; /* Light sage - natural, calming */
    --color-background: #e8e0d9; /* Warm stone - neutral but cozy */
    --color-accent: #c7826c; /* Terracotta - social warmth */
    --color-muted: #d5c4b8; /* Warm taupe - soft backgrounds */
    --color-card: #f5f0eb; /* Warm cream - cards, elevation */

    /* other colors in the same color palette, for inspiration. contrast is less important */
    --color-gold: #d9a96d; /* Muted gold - gentle highlights */
    --color-clay: #b8736c; /* Reddish clay - emphasis */
    --color-olive: #8a9a7e; /* Deeper olive - natural depth */
    --color-sand: #c9b59f; /* Warm sand - subtle warmth */

    /* Spacing */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-sans:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --line-height: 1.6;
}

/* Base
   ========================================================================== */
body {
    font-family: var(--font-sans);
    line-height: var(--line-height);
    color: var(--color-text);
    background: var(--color-background);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--color-link-hover);
}

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

.button {
    background-color: var(--color-secondary);
    margin: 1em;
    padding: 1em;
}

/* Header, Footer
   ========================================================================== */
header {
    background: var(--color-secondary);
    padding: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav {
    display: flex;
    flex-direction: column;
}

nav a {
    font-weight: 500;
}

footer {
    background: var(--color-secondary);
    padding: var(--space-2xl) 0;
    text-align: center;
}

/* Activity Cards
   ========================================================================== */
.activity-list-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
}

.activity-image {
    height: calc(25vh + 10vw);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.form-title {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: inherit;
    background: transparent;
    border: none;
    border-bottom: 2px solid #5c4a3d;
    width: 100%;
    padding: 0;
    margin: 0;
}

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

textarea {
    width: calc(100% - 10px);
    min-height: 10em;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--color-olive);
    font-family: inherit;
    resize: vertical;
}

.form-summary {
    min-height: 4em;
}

.form-details {
    min-height: 10em;
}

.form-image {
    background: white;
}

.activity-card {
    min-width: 20em;
    max-width: 25em;
    flex: 1;
    height: 17em;
    margin: 0.5em 0.25em;
    border: 1px solid var(--color-text);
    display: flex;
    flex-direction: column;

    .activity-image {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;

        .datetime {
            background-color: var(--color-card);
            padding: 0em 0.3em;
            border-bottom: 1px solid var(--color-text);
            border-right: 1px solid var(--color-text);
        }
    }
}

.tags {
    display: flex;
    flex-direction: column;
    align-items: flex-end;

    .tag {
        background-color: var(--color-card);
        border: 1px solid var(--color-text);
        padding: 0.2em 0.5em;
        border-radius: 1em;
        margin-top: 0.3em;
        margin-right: 0.3em;
    }
}

.activity-title {
    flex: 0 0 auto;
    background-color: var(--color-card);
    padding: 0.2em 0.5em;
    border-top: 1px solid var(--color-text);
    h3 {
        margin: 0;
    }
}

/* Activity Search
   ========================================================================== */
.activity-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.view-toggle-track {
    display: flex;
    position: relative;
    background: white;
    border-radius: 24px;
    width: 120px;
}

.toggle-label {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-weight: 500;
    z-index: 1;
    user-select: none;
}

.toggle-lever {
    position: absolute;
    width: calc(50%);
    height: calc(100%);
    background: var(--color-secondary);
    border-radius: 24px;
    transition: var(--transition);
}

.advanced-search {
    margin-bottom: 1em;
}

/* Mobile: single column */

/* Desktop: 2 columns */
@media (min-width: 769px) {
    .search-container {
        display: flex;
        flex-direction: row;
    }
    .advanced-search {
        flex: 1;
    }
    .search-results {
        flex: 4;
    }
}

/* Filter capsule styles */
.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
}

.active-filter {
    background: var(--color-card);
    border: 1px solid var(--color-muted);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 14px;
}
.active-filter:hover {
    background: var(--color-accent);
}

.all-active-filters {
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 14px;
}
.all-active-filters:hover {
    background: var(--color-accent);
}

/* Forms
   ========================================================================== */
form,
form div {
    margin-top: 1em;
}

/* Map
   ========================================================================== */
#map {
    aspect-ratio: 1 / 1;
    min-height: 500px;
    width: calc(100% - 4px); /* subtract border */
    border: solid 2px var(--color-accent);
}

/* Calendar Buttons
   ========================================================================== */
.calendar-buttons {
    display: flex;
    align-items: center;
}

.calendar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    margin-left: 10px;
    width: 40px;
    height: 40px;
}

.calendar-icon {
    width: 30px;
    height: 30px;
    filter: invert(1);
}

/* RSVP Section
   ========================================================================== */
.rsvp {
    margin: var(--space-md) 0;
}

.rsvp-current {
    display: flex;
    align-items: center;
    margin: 0 0 var(--space-sm) 0;
    font-style: italic;
    color: var(--color-link);
}

.rsvp-controls {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: 0;
    margin: 0;
}

.rsvp-btn {
    flex: 1;
    margin: 0.2em;
    padding: var(--space-sm);
    background: var(--color-muted);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.rsvp-btn:hover {
    background: var(--color-primary);
}

.rsvp-btn--active {
    background: var(--color-accent);
    color: var(--color-card);
    font-weight: bold;
}

/* Accessibility
   ========================================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* edit-activity required field indicators */
.edit-field:has(input[required]) .edit-field-label label::after {
  content: " *";
  color: #c0392b;
}

/* edit-activity fields */
.edit-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.edit-field:has(textarea) {
  flex-direction: column;
  align-items: stretch;
  justify-content: unset;
}

.edit-field:has(textarea) textarea {
  width: 100%;
  box-sizing: border-box;
}

/* edit-activity save state indicators */
.save-state {
  display: inline-block;
  margin-left: 0.5em;
  font-size: 0.85em;
  font-weight: bold;
  vertical-align: middle;
}

.save-state.saving {
  width: 0.9em;
  height: 0.9em;
  border: 2px solid #ccc;
  border-top-color: #555;
  border-radius: 50%;
  animation: save-state-spin 0.7s linear infinite;
}

.save-state.saved {
  color: #2a9d2a;
}

.save-state.error {
  color: #c0392b;
}

.save-state.validation-error {
  color: #e67e22;
}

@keyframes save-state-spin {
  to { transform: rotate(360deg); }
}
