/* =========================================================
   Perelman Research Library — Classic Academic (Responsive)
   Serif stacks + mobile-friendly tree actions
   ========================================================= */

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

html,
body {
    height: 100%;
    margin-bottom: 20px;
}


body {
    background: #fff;
    color: #000;
    /* was: max-width:960px; margin:0 auto; padding:24px 20px; */
    max-width: none;
    /* body should be full width */
    min-height: 100svh;
    /* full viewport height (mobile-safe unit) */
    display: grid;
    /* make body a grid container */
    place-items: center;
    /* centers .shell horizontally + vertically */
    padding: 24px 20px;
    /* keep your page padding */
    font: 400 14px/1.5 Baskerville, "Libre Baskerville", Garamond, "EB Garamond",
        Georgia, "Times New Roman", Times, "Nimbus Roman No9 L", "Liberation Serif", serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}


/* Links */
a {
    color: #0040cc;
    text-decoration: underline
}

a:visited {
    color: #551a8b
}

a:hover {
    color: #b00000
}

/* ------------------ LOGIN ------------------ */
.shell {
    width: 100%;
    max-width: 30%;
}

@media (min-width:980px) {
    .shell {
        /* display: grid; */
        /* gap: 24px; */
        grid-template-columns: 1.15fr .85fr;
        align-items: start
    }
}

.panel {
    padding: 0 0 20px;
    margin: 0 0 26px;
    border-bottom: 1px solid #d9d9d9;
    background: #fff
}

.hero h1 {
    font-family: "Book Antiqua", "Palatino Linotype", Palatino, Baskerville, Garamond, Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1.25;
    margin: 0 0 10px;
}

.fancy-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #222;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    margin: 0 0 12px;
    text-align: justify;
    max-width: 68ch
}

.molecule {
    display: none
}

.disclaimer {
    background: #fffbe6;
    border: 1px solid #e8dd99;
    padding: 12px;
    margin: 12px 0;
    font-size: 13px;
    color: #222
}

.disclaimer strong {
    display: block;
    margin-bottom: 6px
}

.badges {
    margin: 12px 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.badge {
    flex: 1 1 0;
    text-align: center;
    padding: 2px 6px;
    display: inline-block;
    font-size: 12px;
    background: #f3f3f3;
    border: 1px solid #bdbdbd;
    border-radius: 0;
    color: #111;
    min-width: 30%;
}

/* red emphasis */
.hl-warn {
    color: #b00000;
    font-weight: 600
}

/* features list (replaces badges) */
.features {
    margin: 12px 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.feature {
    flex: 1 1 30%;
    min-width: 150px;
    text-align: center;
    padding: 2px 6px;
    font-size: 12px;
    background: #f3f3f3;
    border: 1px solid #bdbdbd;
    border-radius: 0;
    color: #111;
}

.small {
    font-size: 12px;
    color: #444;
}

.security-note {
    margin-top: 8px;
    font-size: 12px;
    color: #333;
}


/* small print under hero */
.security-note {
    margin-top: 8px;
    font-size: 12px;
    color: #333;
}


form {
    display: grid;
    gap: 12px;
    max-width: 520px
}


.field {
    margin: 0
}

label {
    display: block;
    margin-bottom: 4px;
    font: 700 13px/1.25 "Book Antiqua", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
}

.input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #9a9a9a;
    border-radius: 0;
    background: #fff;
    color: #000;
    font: 400 13px/1.35 "Courier New", Courier, "Liberation Mono", monospace;
}

.input:focus {
    outline: 1px solid #000
}

input[type="checkbox"] {
    margin-right: 6px;
    transform: translateY(1px)
}

.btn,
.link-button,
.logout,
.admin-check {
    display: inline-block;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    font: 600 13px/1 "Book Antiqua", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
    padding: 8px 12px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    text-align: center;
}


/* Below adds badge-to-button */
/* scope to just this exact link-button variant */
.btn.link-button.has-badge {
    position: relative;
    display: inline-block;
    text-align: center;
}

/* the badge is created with ::after so no extra markup */
.btn.link-button.has-badge::after {
    content: attr(data-badge);
    position: absolute;
    top: -6px;
    right: -6px;
    padding: 1px 5px;
    font: 700 10px/1 "Courier New", ui-monospace, monospace;
    /* oldish */
    letter-spacing: .2px;
    color: #111;
    background: #fffbe6;
    /* manila note color */
    border: 1px solid #9a9a9a;
    /* thin, utilitarian */
    box-shadow: 1px 1px 0 #00000022;
    /* hard-ish shadow, vintage */
    pointer-events: none;
    /* clicks go to the link */
}

.btn[type="submit"] {
    background: #000;
    color: #fff
}

form .btn,
form .link-button {
    width: 100%
}

form .link-button {
    background: #f0f0f0
}

@media (min-width: 1200px) {
    .fancy-title {
        font-size: 3rem;
        letter-spacing: 0.6px;
    }
}


@media (max-width: 1024px) {
    .shell {
        max-width: 60%;
    }

    .container {
        max-width: 80%;
    }
}

@media (min-width:980px) {
    form {
        max-width: 100%
    }
}

@media (max-width: 768px) {
    .shell {
        max-width: 90%;
    }

    .container {
        max-width: 95;
        margin-top: 12px;
        margin-bottom: 12px;
        padding: 14px;
    }
}


@media (min-width: 481px) and (max-width: 768px) {
    .fancy-title {
        font-size: 2rem;
    }
}

@media (min-width:600px) {

    form .btn,
    form .link-button {
        width: auto
    }

    form .btn+.link-button {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .fancy-title {
        font-size: 1.6rem;
        letter-spacing: 0.3px;
    }

    .shell {
        max-width: 100%;
        padding: 0 10px;
    }

    .container {
        max-width: 100%;
        margin: 8px 0;
        border-radius: 0;
    }

    .nested {
        margin-left: .6rem;
        padding-left: .5rem
    }

    .feature {
        flex: 1 1 100%;
    }
}

.errors {
    background: #fff0f0;
    border: 1px solid #cc0000;
    padding: 8px 12px;
    margin: 12px 0;
    font-size: 13px
}

.footer {
    font-size: 12px;
    color: #666;
    line-height: 1.35;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #d9d9d9;
    text-align: center
}

/* ------------------ ADMIN / BROWSER ------------------ */
.container {
    width: 100%;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 0;
    padding: 16px;
    margin-top: 16px;
    margin-bottom: 16px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d9d9d9;
    padding-bottom: 12px;
    margin-bottom: 14px
}

header h1 {
    margin: 0;
    font: 700 20px/1.2 "Book Antiqua", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
}

.actions {
    display: flex;
    gap: 8px
}

.logout:hover,
.admin-check:hover,
.container .btn:hover {
    background: #f0f0f0
}

/* Tree */
.tree {
    margin: 12px 0;
    min-height: 380px;
    overflow: auto
}

ul {
    list-style: none;
    margin: 0;
    padding-left: 1rem
}

li {
    margin: .2rem 0;
    font: 400 13px/1.35 "Courier New", Courier, "Liberation Mono", monospace
}

.folder>.name {
    cursor: pointer;
    font-weight: 700;
    margin-left: .2rem
}

.toggle {
    display: inline-block;
    width: 1.2rem;
    text-align: center;
    cursor: pointer;
    color: #666;
    font-family: Arial, sans-serif
}

.nested {
    display: none;
    margin-left: 1.2rem;
    border-left: 1px dashed #bdbdbd;
    padding-left: .5rem
}

.nested.open {
    display: block
}

.file a {
    text-decoration: none;
    color: #0040cc
}

.file a:hover {
    text-decoration: underline
}

.folder {
    margin-bottom: 6px;
}


.folder.open>.nested {
    margin-top: 4px;
    margin-bottom: 8px;
}

/* Folder controls (desktop default) */
.folder button {
    background: #fff;
    border: 1px solid #666;
    padding: 2px 6px;
    margin-left: 8px;
    font: 400 11px/1 "Book Antiqua", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
    cursor: pointer
}

.folder button:hover {
    background: #f5f5f5
}

.fileinput {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}


/* ----- Mobile UX: keep buttons out of the way ----- */
/* Hide buttons until the folder is opened; show them below the row */
@media (max-width:768px) {
    .folder>button {
        display: none
    }

    .folder.open>button {
        display: block;
        width: 100%;
        margin: 6px 0 0 1.2rem;
        /* indent under folder */
    }

    .folder>.toggle,
    .folder>.name {
        padding: 2px 0
    }

    /* easier hit target */
}

/* Upload tray */
.uploads {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 320px;
    z-index: 1000
}

.upload-btn {
    display: inline-block;
    background: #fff;
    border: 1px solid #666;
    padding: 2px 6px;
    margin-left: 8px;
    cursor: pointer;
    font: 400 11px/1 "Book Antiqua", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
}

.uitem {
    background: #fff;
    border: 1px solid #d9d9d9;
    padding: 8px;
    margin-bottom: 6px;
    font-size: 12px
}

.uitem .name {
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.uitem .bar {
    background: #e6e6e6;
    height: 4px;
    margin: 4px 0
}

.uitem .bar span {
    display: block;
    height: 100%;
    width: 0%;
    background: #000;
    transition: width .3s
}

.uitem .status {
    font-size: 11px;
    color: #666
}

.uitem.ok {
    border-color: #0a7a46
}

.uitem.err {
    border-color: #cc0000
}

/* ------------------ Responsive ------------------ */
@media (max-width:900px) {
    body {
        padding: 18px
    }

    .container {
        padding: 16px
    }
}

@media (max-width:768px) {
    body {
        padding: 14px;
        font-size: 13px
    }

    .hero h1 {
        font-size: 24px
    }

    .badge {
        display: block;
        margin-right: 0
    }

    header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start
    }

    .actions {
        flex-wrap: wrap
    }

    .folder>.mkfolder,
    .folder>.upload-btn {
        display: none;
    }

    .folder.open>.mkfolder,
    .folder.open>.upload-btn {
        display: block;
        width: 30%;
        margin: 6px 0 0 1.2rem;
        text-align: center;
    }

    .uploads {
        position: static;
        width: 100%;
        margin-top: 12px
    }
}

/* Extra small (used by your JS) */
body.extra-small .panel {
    padding-bottom: 12px
}

body.extra-small .input {
    padding: 4px 6px
}

body.extra-small .btn {
    padding: 6px 8px
}
