/* Base / reset */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #1c1917; /* stone-900 */
    font-family: "Kanit", sans-serif;
    font-weight: 300;
}

body.overflow-x-hidden {
    overflow-x: hidden;
}

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

.link:hover {
    text-decoration: underline;
}

.hover-underline {
    position: relative;
    color: #e7e5e4; /* stone-200 */
}

.hover-underline:hover {
    color: #f5f5f4; /* stone-100 */
}

.hover-underline::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.5rem;
    height: 3px;
    width: 0;
    transform: translateX(-50%);
    border-radius: 9999px;
    background: #f5f5f4;
    opacity: 0;
    transition: all 0.2s;
}

.hover-underline:hover::before {
    width: 100%;
    opacity: 1;
}

.text-center {
    text-align: center;
}

.italic {
    font-style: italic;
}

/* Navbar */
.navbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: #0c0e0c;
    padding: 0.75rem 1.5rem;
}

@media (min-width: 640px) {
    .navbar {
        flex-direction: row;
        align-items: center;
        padding: 0.75rem 3rem;
    }
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-logo {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    color: #f5f5f4;
}

.navbar-logo svg {
    width: 100%;
    height: 100%;
    display: block;
}

.navbar-wordmark {
    font-size: 1.5rem;
    color: #e7e5e4;
}

.navbar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    font-size: 1.25rem;
    color: #fafaf9;
}

@media (min-width: 640px) {
    .navbar-nav {
        flex-direction: row;
    }
}

.leaving-site-icon {
    margin: 0 -0.25rem;
    display: inline-block;
    transform: scale(0.5);
    vertical-align: middle;
}

/* Brand wordmark text */
.brand-wordmark {
    font-family: "Times New Roman", Times, serif;
}

.brand-wordmark sup {
    font-size: 0.5em;
}

sup.tm {
    font-size: 0.5em;
}

/* Homepage: blueprint hero (left) + scrolling project rail (right) */
.home-main {
    min-height: 100vh;
    background-color: #020617;
    background-image:
        linear-gradient(#0ea5e912 1px, transparent 1px),
        linear-gradient(90deg, #0ea5e912 1px, transparent 1px);
    background-size: 48px 48px;
}

.home-layout {
    display: flex;
    flex-direction: column;
}

@media (min-width: 960px) {
    .home-layout {
        flex-direction: row;
        min-height: calc(100vh - 73px); /* viewport minus navbar */
    }
}

.home-hero {
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
    padding: 4rem 1.5rem;
}

@media (min-width: 960px) {
    .home-hero {
        padding: 5rem 4rem 4rem;
        width: 62%;
    }
}

.home-hero-decor {
    position: absolute;
    z-index: 0;
    right: -7rem;
    bottom: -8rem;
    width: 28rem;
    height: 28rem;
    border-radius: 50%;
    border: 1px solid #0369a155;
    pointer-events: none;
    display: none;
}

.home-hero-decor::before {
    content: "";
    position: absolute;
    inset: 3.25rem;
    border-radius: 50%;
    border: 1px dashed #0369a144;
}

.home-hero-decor::after {
    content: "";
    position: absolute;
    inset: 6.75rem;
    border-radius: 50%;
    border: 1px solid #0369a133;
}

@media (min-width: 960px) {
    .home-hero-decor {
        display: block;
    }
}

.home-hero-shell {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    text-align: center;
}

@media (min-width: 960px) {
    .home-hero-shell {
        align-items: flex-start;
        text-align: left;
        flex-direction: row;
        max-width: none;
        margin: 0;
    }
}

.home-logo-wrap {
    flex-shrink: 0;
    display: inline-block;
    width: 10rem;
    height: 10rem;
    color: #38bdf8;
    filter: drop-shadow(0 0 24px #0ea5e980);
}

@media (min-width: 960px) {
    .home-logo-wrap {
        width: 11rem;
        height: 11rem;
    }
}

.home-logo-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

.home-eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 0.8rem;
    color: #0ea5e9;
    border: 1px solid #0369a1;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

.home-wordmark {
    font-size: 2rem;
    color: #f0f9ff;
    display: block;
    margin-bottom: 1rem;
}

.home-hero-copy h1 {
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1.5;
    color: #cffafe;
    margin: 0 0 1.25rem;
}

.home-hero-copy p {
    font-size: 1rem;
    font-weight: 200;
    line-height: 1.7;
    color: #7dd3fc;
    margin: 0 0 1.75rem;
}

.home-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.home-tag {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7dd3fc;
    border: 1px solid #0369a1;
    background: #0369a11a;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
}

/* Project rail (right column) - Voynich Garden today, more cards stack below it later */
.home-project-rail {
    flex: 0 0 auto;
    border-top: 1px dashed #0369a1;
    background: #00030acc;
    padding: 2.5rem 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

@media (min-width: 960px) {
    .home-project-rail {
        width: 38%;
        max-width: 480px;
        border-top: none;
        border-left: 1px dashed #0369a1;
        padding: 3rem 2.25rem;
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        overflow-y: auto;
    }
}

.home-project-rail-header .home-project-rail-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #38bdf8;
    margin: 0 0 0.35rem;
    display: block;
}

.home-project-rail-header h2 {
    font-weight: 400;
    font-size: 1.4rem;
    color: #f0f9ff;
    margin: 0;
}

.home-project-cards {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.home-project-card {
    border: 1px dashed #0284c7;
    border-radius: 4px;
    padding: 1.5rem;
    background: #02040ab3;
}

.home-project-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid #0284c7;
    margin-bottom: 1.25rem;
}

.home-project-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.home-project-card .home-project-tag {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #38bdf8;
    margin: 0 0 0.6rem;
    display: block;
}

.home-project-card h3 {
    font-weight: 400;
    font-size: 1.4rem;
    color: #f0f9ff;
    margin: 0 0 0.75rem;
}

.home-project-card p {
    font-weight: 200;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #93c5fd;
    margin: 0 0 1.1rem;
}

.home-project-card a {
    color: #38bdf8;
    border-bottom: 1px solid #0369a1;
    padding-bottom: 2px;
    font-size: 0.95rem;
}

.home-project-card a:hover {
    color: #7dd3fc;
    border-color: #38bdf8;
}

/* Homepage footer */
.home-footer {
    display: flex;
    height: 8rem;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border-top: 4px solid #1c1917;
    background: #0c0e0c;
    padding: 0 1.5rem;
}

.home-footer p {
    color: #a8a29e; /* stone-400 */
}

/* Research index page */
.research-index-page {
    min-height: 100vh;
    background: #fafaf9; /* stone-50 */
    font-size: 1.125rem;
    color: #1c1917;
}

.research-index-header {
    max-width: 56rem;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.research-index-header h1 {
    font-size: 2.25rem;
    margin: 0;
}

.research-index-header p {
    margin-top: 1rem;
    max-width: 48rem;
    font-size: 1.25rem;
    line-height: 1.75;
}

.research-index-list {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0 1.5rem 3rem;
}

.research-card {
    position: relative;
    height: auto;
    transition: transform 0.5s ease-in-out;
}

.research-card:hover {
    transform: scale(1.02);
}

.research-card-body {
    position: relative;
    z-index: 20;
    height: fit-content;
    width: 100%;
    background: #fafaf9;
    padding: 1.5rem;
}

.research-card-corner {
    position: absolute;
    height: 2.5rem;
    width: 2.5rem;
    background: #e7e5e4; /* stone-200 */
    transition: all 0.2s ease-out;
    z-index: 10;
}

.research-card:hover .research-card-corner {
    background: #57534e; /* stone-600 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.research-card-corner-tl { left: -0.25rem; top: -0.25rem; }
.research-card-corner-tr { right: -0.25rem; top: -0.25rem; }
.research-card-corner-bl { left: -0.25rem; bottom: -0.25rem; }
.research-card-corner-br { right: -0.25rem; bottom: -0.25rem; }

.research-card-title {
    font-size: 1.875rem;
    font-weight: 400;
    color: #0284c7; /* sky-600 */
}

.research-card-status {
    margin-top: 1rem;
    line-height: 1.75;
}

.research-card-status-label {
    font-weight: 600;
}

/* Research article pages */
.research-article-page {
    min-height: 100vh;
    background: #fafaf9;
    font-size: 1.125rem;
    color: #1c1917;
}

.research-article-shell {
    max-width: 56rem;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.research-article-shell h1 {
    margin-top: 1.5rem;
    font-size: 2.25rem;
    line-height: 1.2;
}

.research-article-shell p {
    margin-top: 1rem;
    line-height: 1.75;
}

.research-article-footer {
    margin-top: 2rem;
    border-left: 4px solid #d6d3d1; /* stone-300 */
    padding-left: 1rem;
}

.research-article-footer > p {
    margin-top: 0.75rem;
}

.research-article-footer-label {
    font-weight: 600;
}

/* Comment-enabled article page */
.article-page {
    min-height: 100vh;
    background: #fafaf9;
    font-size: 1.125rem;
    color: #1c1917;
}

.article-shell {
    max-width: 56rem;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.article-title {
    margin-top: 1.5rem;
    font-size: 3rem;
    line-height: 1.2;
}

.article-body {
    margin-top: 2rem;
}

.article-body p {
    line-height: 2;
    margin-top: 1.5rem;
}

.comments-panel {
    margin-top: 3.5rem;
    background: #eff6ff; /* blue-50 */
    color: #0f172a;
    border-left: 6px solid #0369a1;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px -8px rgba(3, 105, 161, 0.35);
    padding: 2.5rem 1.5rem;
}

@media (min-width: 640px) {
    .comments-panel {
        padding: 2.5rem 3rem;
    }
}

.comments-title {
    font-size: 2.25rem;
    font-weight: 400;
    margin: 0;
}

.comments-response-count {
    margin-top: 2rem;
    font-size: 1.5rem;
}

.comments-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.comment-card {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 1rem;
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px -4px rgba(3, 105, 161, 0.3);
}

/* Mock-up only: replyToId isn't produced by the real API yet (no reply
   feature exists server-side/in the admin UI) - comments.js only sets
   this class when a comment has one, which never happens with real data
   today. Styled here so the look is ready if/when replies are built. */
.comment-card--reply {
    margin-left: 2rem;
    background: #f5f9ff;
    border-color: #93c5fd;
}

@media (min-width: 640px) {
    .comment-card--reply {
        margin-left: 3.5rem;
    }
}

.comment-reply-label {
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0369a1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comment-avatar {
    display: flex;
    height: 2.5rem;
    width: 2.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    /* background-color is set inline per comment (colored by author name) */
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.comment-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 1rem;
}

.comment-meta a {
    text-decoration: underline;
}

.comment-body {
    margin-top: 1.75rem;
    max-width: 48rem;
    line-height: 1.75;
    color: #1e293b;
}

.comment-reply {
    margin-top: 1.5rem;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.comment-form {
    margin-top: 7rem;
    display: flex;
    flex-direction: column;
}

.comment-form h3 {
    font-size: 1.875rem;
    font-weight: 400;
    margin: 0;
}

.comment-form p {
    margin-top: 1.5rem;
}

.comment-form label:not(.comment-remember) {
    margin-top: 2rem;
    font-size: 1rem;
}

.comment-form textarea,
.comment-form input:not([type="checkbox"]) {
    margin-top: 0.25rem;
    width: 100%;
    border-radius: 0.25rem;
    border: 1px solid #bfdbfe;
    background: #ffffff;
    padding: 0.75rem;
    color: #0f172a;
    outline: none;
}

.comment-form textarea:focus,
.comment-form input:not([type="checkbox"]):focus {
    box-shadow: 0 0 0 2px #0369a1;
}

.comment-form textarea {
    height: 16rem;
}

.comment-remember {
    margin-top: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 1rem;
}

.comment-remember input {
    margin-top: 0.25rem;
}

.comment-submit {
    margin-top: 1.5rem;
    width: fit-content;
    border-radius: 9999px;
    background: #0369a1;
    padding: 1.25rem 2.5rem;
    font-size: 1.25rem;
    color: #ffffff;
    border: none;
    cursor: pointer;
}

.comment-submit:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.comment-error {
    color: #b91c1c; /* red-700 */
}

.comment-success {
    color: #15803d; /* green-700 */
}

.comments-frozen-note {
    margin-top: 2rem;
    font-style: italic;
}

/* Honeypot field - off-screen rather than display:none, since some bots
   specifically skip display:none/visibility:hidden fields. */
.hp-field-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

/* Preview banner (admin preview of an article) */
.preview-banner {
    margin-top: 1.5rem;
    background: #fde047; /* yellow-300 */
    color: #1c1917;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

/* Admin pages */
.admin-page {
    min-height: 100vh;
    background: #fafaf9;
    font-size: 1.125rem;
    color: #1c1917;
}

.admin-shell {
    max-width: 64rem;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.admin-login-shell {
    max-width: 24rem;
}

.admin-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.admin-header-actions .comment-submit {
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
}

.admin-table {
    margin-top: 2rem;
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid #e7e5e4;
}

.admin-comment-body {
    max-width: 24rem;
}

.admin-comment-actions {
    display: flex;
    gap: 0.75rem;
    white-space: nowrap;
}

.admin-comment-actions form {
    display: inline;
}

.admin-comment-actions button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #0284c7;
    text-decoration: underline;
    cursor: pointer;
}

.admin-form {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
}

.admin-form label {
    margin-top: 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.admin-form input:not([type="checkbox"]):not([type="radio"]),
.admin-form select,
.admin-form textarea {
    margin-top: 0.25rem;
    width: 100%;
    border-radius: 0.25rem;
    border: 1px solid #e7e5e4;
    background: #ffffff;
    padding: 0.75rem;
    color: #0c0a09;
    font: inherit;
    outline: none;
}

.admin-form input:disabled,
.admin-form input[readonly] {
    background: #f5f5f4;
    color: #78716c;
}

.admin-field-note {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #57534e;
}

.admin-visibility-fieldset {
    margin-top: 1.5rem;
    border: 1px solid #e7e5e4;
    border-radius: 0.25rem;
    padding: 1rem;
}

.admin-radio-label {
    display: block;
    margin-top: 0.5rem;
    font-weight: 400;
}

.admin-markdown-textarea {
    height: 24rem;
    font-family: ui-monospace, monospace;
}

.admin-editor-toolbar {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-editor-toolbar button {
    border: 1px solid #e7e5e4;
    background: #ffffff;
    border-radius: 0.25rem;
    padding: 0.4rem 0.75rem;
    font: inherit;
    cursor: pointer;
}

.admin-form-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}
