/* painttwits - minimalist style inspired by artblog.net / franklin.art */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #111;
    --white: #fafafa;
    --gray: #444;
    --light-gray: #ddd;
    --accent: #222;
}

body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    line-height: 1.7;
    color: var(--black);
    background: var(--white);
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem;
}

/* typography */

h1 {
    font-size: 2rem;
    font-weight: normal;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

h2 {
    font-size: 1.1rem;
    font-weight: normal;
    text-transform: lowercase;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

.tagline {
    font-size: 0.9rem;
    color: var(--gray);
}

/* navigation */

nav {
    margin: 2rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--light-gray);
    border-bottom: 1px solid var(--light-gray);
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

nav a {
    color: var(--black);
    text-decoration: none;
}

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

/* sections */

.section {
    margin-bottom: 3rem;
    padding-top: 1rem;
}

/* dropzone for artwork upload */

.dropzone {
    border: 2px dashed var(--light-gray);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    margin: 1.5rem 0;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--gray);
}

.dropzone .hint {
    font-size: 0.85rem;
    color: var(--gray);
}

/* artwork grid */

.artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.artwork-grid img {
    width: 100%;
    height: auto;
    display: block;
}

/* forms */

form {
    margin-top: 1rem;
}

label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="url"],
textarea {
    width: 100%;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--light-gray);
    background: var(--white);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--gray);
}

button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    background: var(--black);
    color: var(--white);
    border: none;
    cursor: pointer;
}

button:hover {
    background: var(--accent);
}

/* location search */

.location-search {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.location-search input {
    flex: 1;
}

.location-search button {
    margin-top: 0;
}

/* footer */

footer {
    margin-top: 4rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
    font-size: 0.85rem;
    color: var(--gray);
}

/* Tab Navigation */

.tab-nav {
    display: flex;
    gap: 0;
    margin: 1rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    margin: 0;
    background: none;
    color: var(--gray);
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
}

.tab-btn:hover {
    color: var(--black);
    background: none;
}

.tab-btn.active {
    color: var(--black);
    border-bottom-color: var(--black);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Location Search */

#location-search {
    margin-bottom: 1rem;
    text-align: center;
}

#search-form {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#search-location {
    padding: 8px 12px;
    border: 1px solid var(--light-gray);
    font-family: inherit;
    font-size: 0.9rem;
    width: 200px;
}

#search-form button {
    padding: 8px 16px;
    background: var(--black);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

#search-form button:hover {
    background: var(--gray);
}

#search-status {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 8px;
}

/* No Artists Nearby */

#no-artists-nearby {
    text-align: center;
    padding: 2rem;
    background: #f8f8f8;
    border: 1px dashed var(--light-gray);
    margin: 1rem 0;
}

#no-artists-nearby p {
    margin-bottom: 0.5rem;
    color: var(--gray);
}

#share-invite-btn {
    margin-top: 1rem;
    padding: 12px 24px;
    background: #4a9eff;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

#share-invite-btn:hover {
    background: #3a8eef;
}

/* Swipe Card Stack */

#card-stack {
    position: relative;
    width: 100%;
    height: 400px;
    margin: 1rem 0;
}

#card-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    border: 1px solid var(--light-gray);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.card.swiping {
    transition: none;
}

.card.exit-left {
    transform: translateX(-150%) rotate(-20deg);
    opacity: 0;
}

.card.exit-right {
    transform: translateX(150%) rotate(20deg);
    opacity: 0;
}

.card.exit-up {
    transform: translateY(-150%);
    opacity: 0;
}

.card.exit-down {
    transform: translateY(150%);
    opacity: 0;
}

.card-image {
    flex: 1;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #f5f5f5;
}

.card-info {
    padding: 0.75rem;
    border-top: 1px solid var(--light-gray);
}

.card-info h3 {
    font-size: 1rem;
    font-weight: normal;
    margin-bottom: 0.25rem;
}

.card-info p {
    font-size: 0.85rem;
    color: var(--gray);
    margin: 0;
}

.card-info .bump-score {
    font-size: 0.8rem;
    color: var(--gray);
}

.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.card.empty-state {
    justify-content: center;
    align-items: center;
    color: var(--gray);
}

/* Swipe Buttons */

.swipe-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.swipe-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.swipe-btn:active {
    transform: scale(0.95);
}

.swipe-btn.left {
    background: var(--light-gray);
    color: var(--gray);
}

.swipe-btn.down {
    background: #ffcdd2;
    color: #b71c1c;
}

.swipe-btn.up {
    background: #c8e6c9;
    color: #1b5e20;
}

.swipe-btn.right {
    background: #bbdefb;
    color: #0d47a1;
}

.swipe-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray);
}

/* Join Toggle */

.join-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
}

.join-btn {
    flex: 1;
    padding: 0.5rem;
    margin: 0;
    background: var(--light-gray);
    color: var(--gray);
    border: 1px solid var(--light-gray);
}

.join-btn.active {
    background: var(--black);
    color: var(--white);
}

.join-form {
    display: none;
}

.join-form.active {
    display: block;
}

.artist-benefits {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.5rem 0;
}

.artist-benefits li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gray);
}

.artist-benefits li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--black);
}

.apply-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background: var(--black);
    color: var(--white);
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 1rem;
}

.apply-btn:hover {
    opacity: 0.9;
}

.apply-note {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--gray);
    text-align: center;
}

.form-switch {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 1rem;
}

.form-switch a {
    color: var(--black);
}

/* Saved List */

#saved-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.saved-item {
    border: 1px solid var(--light-gray);
    position: relative;
}

.unsave-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.saved-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.saved-item .saved-info {
    padding: 0.5rem;
    font-size: 0.8rem;
}

#saved-empty {
    grid-column: 1 / -1;
    color: var(--gray);
}

/* User Status */

#user-status {
    font-size: 0.85rem;
    color: var(--gray);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

/* Password input */

input[type="password"] {
    width: 100%;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--light-gray);
    background: var(--white);
}

/* Swipe visual feedback */

.card.tint-left {
    background: linear-gradient(to right, rgba(200,200,200,0.3), transparent);
}

.card.tint-right {
    background: linear-gradient(to left, rgba(187,222,251,0.5), transparent);
}

.card.tint-up {
    background: linear-gradient(to bottom, rgba(200,230,201,0.5), transparent);
}

.card.tint-down {
    background: linear-gradient(to top, rgba(255,205,210,0.5), transparent);
}

/* Responsive - Mobile first */

@media (max-width: 480px) {
    body {
        padding: 0.75rem;
        padding-top: 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    #card-stack {
        height: calc(100vh - 280px);
        min-height: 300px;
        max-height: 450px;
    }

    .card-image {
        background-size: contain;
    }

    .card-info {
        padding: 0.5rem;
    }

    .card-info h3 {
        font-size: 0.9rem;
    }

    .card-info p {
        font-size: 0.8rem;
    }

    .swipe-buttons {
        gap: 0.75rem;
    }

    .swipe-btn {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .swipe-hint {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }

    .tab-btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.25rem;
    }

    h2 {
        font-size: 1rem;
    }

    label {
        font-size: 0.85rem;
    }

    input, textarea, button {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    #card-stack {
        height: 450px;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Desktop */
@media (min-width: 769px) {
    #card-stack {
        height: 500px;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .card-image {
        background-size: contain;
    }
}

/* High DPI screens - sharper text */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Card info with artist link and share button */

.card-info .artist-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.card-info .artist-link {
    color: var(--black);
    text-decoration: none;
}

.card-info .artist-link:hover {
    text-decoration: underline;
}

.btn-card-share {
    background: none;
    border: 1px solid var(--light-gray);
    color: var(--gray);
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.btn-card-share:hover {
    color: var(--black);
    border-color: var(--black);
}

.btn-card-share svg {
    width: 16px;
    height: 16px;
}

/* Share modal */

.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.share-modal.active {
    display: flex;
}

.share-modal-content {
    background: var(--white);
    padding: 1.5rem;
    max-width: 320px;
    width: 90%;
    position: relative;
}

.share-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    margin: 0;
    width: auto;
    height: auto;
}

.share-modal h3 {
    font-weight: normal;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-transform: lowercase;
}

.share-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: none;
    border: 1px solid var(--light-gray);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
    margin: 0;
    color: var(--black);
}

.share-option:hover {
    border-color: var(--gray);
    background: #f5f5f5;
}

.share-option svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.share-artist-link {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
    font-size: 0.85rem;
    color: var(--gray);
}

.share-artist-link a {
    color: var(--black);
}

/* Mobile adjustments for share elements */
@media (max-width: 480px) {
    .btn-card-share {
        width: 32px;
        height: 32px;
    }

    .share-modal-content {
        padding: 1rem;
    }
}

/* Map Type Tabs */
.map-type-tabs .map-tab {
    background: var(--white);
    color: var(--gray);
}
.map-type-tabs .map-tab.active {
    background: var(--black);
    color: var(--white);
}
.map-type-tabs .map-tab:hover:not(.active) {
    background: var(--light-gray);
}

/* Map Popup Styles - Tiny fixed-size popup with 80x80 square thumbnail */
.map-popup-wrapper .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--white);
    color: var(--black);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.map-popup-wrapper .leaflet-popup-tip {
    background: var(--white);
}

.map-popup-wrapper .leaflet-popup-content {
    margin: 0;
    width: auto !important;
}

.map-popup {
    font-family: inherit;
    display: flex;
    align-items: stretch;
    background: var(--white);
}

.map-popup-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.map-popup-right {
    display: flex;
    flex-direction: column;
    min-width: 100px;
    max-width: 120px;
}

.map-popup-info {
    padding: 0.4rem;
    flex: 1;
}

.map-popup-info h4 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    color: var(--black);
}

.map-popup-artist {
    margin: 0.2rem 0 0 0;
    font-size: 0.65rem;
    color: var(--gray);
}

.map-popup-artist a {
    color: var(--black);
    text-decoration: underline;
}

.map-popup-artist a:hover {
    color: var(--gray);
}

.map-popup-actions {
    display: flex;
    border-top: 1px solid var(--light-gray);
}

.map-popup-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border: none;
    border-right: 1px solid var(--light-gray);
    background: transparent;
    background-color: transparent;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--black);
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.map-popup-btn:last-child {
    border-right: none;
}

.map-popup-btn:hover {
    background: var(--light-gray);
}

.map-popup-btn:focus,
.map-popup-btn:active {
    background: transparent;
    outline: none;
    box-shadow: none;
}

/* Mobile-responsive map popups */
@media (max-width: 480px) {
    .map-popup-img {
        width: 70px;
        height: 70px;
    }

    .map-popup-right {
        min-width: 90px;
        max-width: 110px;
    }

    .map-popup-info {
        padding: 0.3rem;
    }

    .map-popup-info h4 {
        font-size: 0.7rem;
        max-width: 90px;
    }

    .map-popup-artist {
        font-size: 0.6rem;
    }

    .map-popup-btn {
        padding: 0.35rem;
        font-size: 0.75rem;
    }
}

