:root {
    --bg: #0b0b10;
    --yellow: #FFBF26;
    --blue: #6392EE;
    --orange: #FF9D5E;
    --red: #FF6464;
    --green: #3AC884;
    --purple: #BF67FF;
    --teal: #3AACC8;
    --black: #1B1B1B;
    --dark-gray: #666666;
    --light-gray: #A8A8A8;
    --separator-gray: #EFEFEF;
}

html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body {
    --dot-color: #D3D3D3;
    --dot-size: .8px;
    --dot-spacing: 16px;
    --off-black: #1b1b1b;

    font-family: "SF Pro Rounded", "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    background-image: radial-gradient(circle, var(--dot-color) var(--dot-size), transparent var(--dot-size));
    background-size: var(--dot-spacing) var(--dot-spacing);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 12px;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
}

.top-logo, .page-container {
    opacity: 1;
}

.top-logo {
    display: block;
    margin: 0 auto 8px;
    height: 36px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
}

@keyframes gelatineLogo {
    from, to { transform: scale(1, 1); }
    25% { transform: scale(0.9, 1.1); }
    50% { transform: scale(1.1, 0.9); }
    75% { transform: scale(0.95, 1.05); }
}

.top-logo:hover {
    animation: gelatineLogo 500ms ease-out;
}

.page-container {
    width: 100%;
    max-width: 500px;
    position: relative;
}

.left-side a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.above-card {
    position: relative;
    height: 45px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.left-side {
    display: flex;
    align-items: center;
    gap: 6px;
}

.avatar-placeholder {
    width: 41px;
    height: 41px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.avatar {
    width: 41px;
    height: 41px;
    border-radius: 50%;
    background-color: #ccc;
}

.metadata .display-name {
    font-weight: bold;
    font-size: 16px;
    color: var(--off-black);
    padding-bottom: 1px;
    transition: color 0.2s ease;
}

.metadata .display-name:hover {
    color: #000000;
}

.metadata .display-name:empty::after,
.metadata .subtitle:empty::after {
    content: '\00a0';
}

.metadata .subtitle {
    font-size: 12.6px;
    color: var(--light-gray);
}

@media (min-width: 1024px) {
    .metadata .subtitle {
        font-size: 14px;
    }
}

/* Loading state styling - make placeholder text lighter */
.metadata .display-name.loading,
.metadata .subtitle.loading,
.post-time.loading {
    color: #d0d0d0;
}

.subtitle-highlight,
.metadata .subtitle .subtitle-highlight {
    color: var(--dark-gray) !important;
    font-weight: 500;
    transition: color 0.2s ease;
}

.subtitle-highlight:hover,
.metadata .subtitle .subtitle-highlight:hover {
    color: #000000 !important;
}

.main-card {
    background-color: white;
    border-radius: 39px;
    border: 1px solid var(--separator-gray);
    box-shadow: 0px 2px 19px 0px rgba(0,0,0,0.1);
    padding: 10px;
    animation: fadeInScale 0.5s ease-out forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.photo-container {
    position: relative;
    border-radius: 29px;
    overflow: hidden;
}

.photo-container:has(.before-button:hover) {
    overflow: visible;
}

.before-button {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    width: 54px;
    height: 54px;
    padding: 10px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    aspect-ratio: 1/1;
    border-radius: 40px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.30);
    border: none;
    cursor: pointer;
    color: white;
    font-size: 24px;
    transition: transform 0.1s ease, background 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    z-index: 10;
}

.before-button:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.35);
}

.before-button-icon {
    pointer-events: none;
    height: 22px;
    opacity: 0.8;
    transition: opacity 0.1s ease;
    filter: brightness(0) invert(1);
}

.before-button:hover .before-button-icon {
    opacity: 1;
}

@media (max-width: 768px) {
    .before-button {
        width: 48px;
        height: 48px;
        bottom: 10px;
        right: 10px;
    }
    
    .before-button-icon {
        height: 18px;
    }
}

.before-button-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1000;
}

.before-button:hover .before-button-tooltip {
    opacity: 1;
}

.photo-placeholder {
    width: 100%;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 29px;
    min-height: 420px; /* Default height before animation */
    transition: padding-top 0.4s ease-out, min-height 0.4s ease-out, opacity 0.3s ease-out;
}

.photo-placeholder.loaded {
    background: transparent;
    animation: none;
}

.post-photo {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 29px;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease;
}

.post-photo-before {
    z-index: 1;
    opacity: 1;
}

.post-photo-after {
    z-index: 2;
    opacity: 1;
}

.post-photo-after.fade-out {
    opacity: 0;
}

/* Vertical handle for before/after sliding */
.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 8px rgba(0, 0, 0, 0.25);
    z-index: 5; /* above photos, below button */
    pointer-events: none;
    transform: translateX(-1px);
    display: none;
}

.recipe-filled {
    font-size: 17.5px;
    padding: 10px;
    text-align: left;
    color: var(--off-black);
    line-height: 1.8;
    font-weight: 500;
    letter-spacing: 0.02em;
}

@media (min-width: 1024px) {
    .recipe-filled {
        font-size: 19px;
    }
}

.recipe-placeholder {
    width: 100%;
    height: 40px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.recipe-filled .highlight {
    font-family: 'Permanent Marker', cursive;
    font-size: 20px;
}

@media (min-width: 1024px) {
    .recipe-filled .highlight {
        font-size: 22px;
    }
}

.highlight.chip-list {
    box-shadow: inset 0 -3px 0 var(--red);
}

.highlight.chip-text {
    box-shadow: inset 0 -3px 0 var(--green);
}

.highlight.chip-sketch {
    box-shadow: inset 0 -3px 0 var(--yellow);
}

.highlight.chip-number {
    box-shadow: inset 0 -3px 0 var(--teal);
}

.inline-chip-photo-container {
    display: inline-block;
    vertical-align: middle;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 2px solid var(--blue);
    margin: 0 4px;
    position: relative;
    top: -3px;
}

.inline-chip-photo-container.chip-photo {
    border-color: var(--blue);
}

.inline-chip-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.inline-chip-photo:hover {
    transform: scale(1.1);
}

.inline-chip-photo.no-enlarge {
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto; /* Keep pointer events for the preventDefault to work */
}

.inline-chip-photo.no-enlarge:hover {
    transform: none;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 14px 8px;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 23px;
    color: var(--dark-gray);
}

@media (min-width: 1024px) {
    .actions {
        font-size: 25px;
    }
}

.like-lockup, .comment-lockup, .share-lockup {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.like-lockup:hover, .comment-lockup:hover, .share-lockup:hover {
    transform: scale(1.1);
}

.like-count, .comment-count {
    font-size: 13.6px;
    font-weight: 500;
}

@media (min-width: 1024px) {
    .like-count, .comment-count {
        font-size: 15px;
    }
}

.mixup-button {
    background-color: var(--off-black);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mixup-button:hover {
    transform: scale(1.1);
}

@media (min-width: 1024px) {
    .mixup-button {
        font-size: 17px;
    }
}


.tag-row {
    display: none;
}

.tag-row b {
    color: var(--off-black);
}

.post-time {
    padding: 0 15px;
    font-size: 12.6px;
    color: var(--light-gray);
}

@media (min-width: 1024px) {
    .post-time {
        font-size: 14px;
    }
}

.toast {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 10px 15px;
    position: fixed;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 90vw;
    box-sizing: border-box;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

.not-found-container {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Modal styles */
.modal {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: block;
    opacity: 1;
}

.modal-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 80%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.random-post-button {
    display: inline-block;
    margin-top: 20px;
    background-color: var(--off-black);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
}
