@font-face {
    font-family: 'League Mono';
    src: url('/static/LeagueMono-VF.woff2') format('woff2');
    font-weight: 100 900;
}

@font-face {
    font-family: 'Goudy Bookletter';
    src: url('/static/goudy_bookletter_1911.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

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

body {
    font-family: 'League Mono', monospace;
    background: #1e1e2e;
    color: #cdd6f4;
    line-height: 1.6;
    padding: 20px;
    position: relative;
}

.top-actions {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.action-btn {
    background: #313244;
    border: 1px solid #45475a;
    border-radius: 24px;
    padding: 16px;
    cursor: pointer;
    color: #89b4fa;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: #45475a;
    border-color: #89b4fa;
}

.action-btn.active {
    border-color: #cba6f7;
    color: #cba6f7;
}

.action-btn svg,
.action-btn img,
.action-btn object {
    width: 36px;
    height: 36px;
    pointer-events: none;
}

.action-btn .icon-mask {
    display: block;
    width: 36px;
    height: 36px;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.hidden {
    display: none;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner-icon {
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-top: 30vh;
    margin-bottom: 60px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    color: #89b4fa;
    margin-bottom: 8px;
}

.tagline {
    color: #a6adc8;
    font-size: 1rem;
}

form {
    margin-top: 60px;
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

textarea {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.2rem;
    font-family: 'Goudy Bookletter', serif;
    border: 1px solid #45475a;
    border-radius: 20px;
    background: #313244;
    color: #cdd6f4;
    resize: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    overflow-y: hidden;
    max-height: 200px;
    line-height: normal;
    letter-spacing: normal;
    caret-color: #89b4fa;
}

textarea:focus {
    outline: none;
    border-color: #89b4fa;
    box-shadow: 0 2px 8px rgba(137, 180, 250, 0.3);
}

form > textarea {
    min-height: 80px;
    font-size: 1.1rem;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
    align-items: start;
}

.note-card {
    background: #313244;
    border: 1px solid #45475a;
    border-radius: 20px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.note-card:hover:not(.focused) {
    border-color: #cba6f7;
}

.note-card.focused {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border-color: #45475a;
}

.note-card.archiving {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.5);
}

/* HTMX loading states */
.archive-btn.htmx-request {
    opacity: 0.5;
    pointer-events: none;
}

/* Grey out entire note card when archiving/unarchiving */
.note-card:has(.archive-btn.htmx-request) {
    opacity: 0.5 !important;
    filter: grayscale(0.5);
    pointer-events: none;
    transition: opacity 0.2s, filter 0.2s;
}

/* Backdrop using CSS */
#lightbox-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
}

body:has(.note-card.focused) #lightbox-backdrop {
    display: block;
}

.note-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.icon-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #a6adc8;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-card.focused .icon-btn {
    width: 32px;
    height: 32px;
}

.icon-btn svg,
.icon-btn img,
.icon-btn object {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.icon-btn .icon-mask {
    display: block;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.icon-btn:hover {
    color: #cdd6f4;
}

.archive-btn:hover {
    color: #89b4fa;
}

.delete-btn:hover {
    color: #f38ba8;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.note-card textarea {
    border: none;
    padding: 0;
    min-height: 100px;
    max-height: 500px;
    font-size: 1.2rem;
    box-shadow: none;
    background: transparent;
}

.note-card textarea:focus {
    background: #45475a;
    padding: 8px;
    border-radius: 4px;
    box-shadow: none;
    border: 1px solid #89b4fa;
}

.note-card.focused textarea {
    max-height: 70vh;
    overflow-y: auto;
    min-height: 300px;
}

.note-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #45475a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'League Mono', monospace;
}

.note-meta small {
    color: #a6adc8;
    font-size: 0.75rem;
}

.note-card.focused .note-meta small {
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .notes-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Custom scrollbar styling for textareas */
textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background: #45475a;
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #585b70;
}

/* For focused textareas with darker background */
textarea:focus::-webkit-scrollbar-thumb {
    background: #585b70;
}

textarea:focus::-webkit-scrollbar-thumb:hover {
    background: #6c7086;
}
