/* Custom fonts */
@import url('fonts.css');

/* base.html */
html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

.new {
    height:1em;
    background-image: url('../icons/new_icon.svg');
    width:2em;
    background-repeat: no-repeat;
    background-size: cover;
    background-position-y: center;
    margin: 0 5px;
}

body {
    font-family:    'Helvetica Rounded';
    font-weight:    bold;
    font-style:     normal;
    font-size:      1rem;
    background-color: var(--bg);
    color: var(--fg);
}

#wrap {
    min-width: 80vw;
    max-width: min(100vw, 840px);
    width: 100vw;
    overflow:visible;
    margin:                 0.3em auto 0;
    display:                grid;
    grid-template-columns:  1fr       3fr          1fr;
    grid-template-rows:     auto      auto         3em;
    gap:                    0px         0px;
    grid-template-areas:
      "nav-left     logo        nav-right"
      "main         main        main"
      "footer       footer      footer";
}

nav {
    display:            flex;
    flex-direction:     column;
    justify-content:    center;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-style: solid;
}

a:hover {
    color: red;
    text-decoration-style: wavy;
}

nav#left {
    margin-left: 0;
    padding-right: 0;
    justify-self:   end;
    align-self:     center;
    grid-area:      nav-left;
    height:         100%;
    align-items:    flex-end;
}

nav#right {
    margin-right: 0;
    padding-left: 0;
    justify-self:   start;
    align-self:     center;
    grid-area:      nav-right;
    height:         100%;
    align-items:    flex-start;
}

.nav_item {
    display:            flex;
    flex-wrap:          wrap;
    width:100%;
    flex-direction:     column;
    justify-content:    flex-end;
}

nav#left .nav_item {
    align-items:        end;
}

nav#right .nav_item {
    align-items:        start;
}

.nav_text {
    size:           2em;
    align-content:  center;
    width:          fit-content;
    margin:         auto            0;
}

.nav_item.active .nav_text {
    color: red;
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 2px;
}

.nav_img_badgeable {
    position: relative;
}

.nav_badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 45% !important;
    height: auto !important;
    margin: 0 !important;
}

.nav_img img {
    /* height:     clamp(3vmax,6vmin,6vmin); */
    height:3em;
    width:auto;
    margin:     0 5px;
}

#logo {
    padding: 0;
    display:            flex;
    width:              auto;
    flex-wrap:          wrap;
    flex-direction:     row;
    grid-area:          logo;
    height:             100%;
    justify-content:    center;
    align-content:      center;
    font-size:          clamp(5vw,6vh,10vw);
}

#logo-inner {
    position: relative;
    width: min(100%, 500px);
}

#logo-badge-outer {
    position: absolute;
    bottom: -0.2em;
    left: 40%;
    background: var(--icon-darkest);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
    transform: rotate(-10deg);
    transform-origin: left center;
    pointer-events: none;
    padding: 1px;
}

#logo-badge {
    display: block;
    font-size: 0.55rem;
    font-family: monospace;
    letter-spacing: 0.03em;
    padding: 0.15em 0.8em 0.15em 0.4em;
    background: var(--badge-yellow);
    color: var(--icon-darkest);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%);
    white-space: nowrap;
}

.logo_text {
    height: auto;
    line-height: 1;
}

#logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

main {
    position:           relative;
    grid-area:          main;
    padding:            1.5em 1em 1em 1em;
    min-height:         50vh;
    max-width:100%;
}

main img {
    max-width: 100%;
}

main video {
    max-width:100%;
}

.flashes {
    width:fit-content;
    margin: 0 auto 1em;
}

.flashes > ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.flashes li {
    margin: 0;
    padding: 0;
    text-decoration: underline;
    color: red;
}

footer {
    border-top: 1px dotted var(--border);
    padding: 1em 0;
    display:            flex;
    gap:                1em;
    justify-content:    center;
    align-items:        center;
    font-size:          1em;
    grid-area:          footer;
}

footer > a {
    margin: auto 0;
}

footer > a[href*="subscribe"] {
    position: relative;
}

footer > a[href*="subscribe"]::after {
    content: '';
    position: absolute;
    inset: -6px -12px;
    pointer-events: none;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'><path d='M 9,23 C 7,9 21,2 50,3 C 79,2 95,9 93,20 C 95,31 79,38 50,37 C 21,38 5,32 8,22' fill='none' stroke='red' stroke-width='2.5' stroke-linecap='round'/></svg>");
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* latest.html */
.post {
    width:100%;
    margin: 0 0;
    padding: 0 0 0.5em 0.5em;
    border-left: 4px transparent solid;
    margin-bottom: 0.5em;
}

.post_content {
    width: 100%;
    max-width:1200px;
    grid-auto-rows: fit-content 3em;
    grid-template-columns: 1fr 1fr;
    gap: 1em 1em;
    grid-auto-flow: row;
}

.post_content_cell {
    grid-row: span 2;
    display: grid;
    grid-template-rows: subgrid;
    border: 2px solid var(--border);
    padding:0.25em;
    -webkit-box-shadow: 0px 2px 18px -11px #000000;
    box-shadow: 0px 2px 18px -11px #000000;
    background: var(--post-cell-bg);
}

.post_image img {
    object-fit:cover;
    height: auto;
    border: 1px inset var(--border);
    width:100%;
}

.post_video video {
    object-fit:cover;
    height: auto;
    border: 1px inset var(--border);
    width:100%;
}

.post_caption {
    text-align:center;
}

.post_id {
    display: inline-block;
    width: fit-content;
    font-family: 'Courier New', Courier, monospace;
    font-style: bold;
}

.title_text.open {
    color: var(--fg);
}

.post.open {
    border-left: 4px var(--muted) solid;
}

.post.closed {
    background-color: var(--post-bg);
}

.full_size_image_overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('../images/black_dither-2x2.png');
    background-repeat:repeat;
    z-index: 999;
    justify-content: center;
    align-items: center;
}

.full_size_image {
    max-width:100%;
    width: auto;
    height:auto;
    max-height:100%;
}

.pages {
    width:          100%;
    text-align: center;
    position:       absolute;
    bottom:         0;
    margin: 0 auto;
}

/* ── latest.html ─────────────────────────────────────────── */

.latest_month_header {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--bg);
    display: block;
    width: fit-content;
    margin: 1.8em auto 0.6em;
    padding: 0.25em 1em;
    border-radius: 4px;
    text-align: center;
}

.latest_pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.6em;
    margin: 2em 0 1em;
    font-size: 0.9rem;
}

.latest_page_btn {
    text-decoration: none;
    border: 1.5px solid var(--fg);
    border-radius: 4px;
    padding: 0.25em 0.8em;
    color: var(--fg);
    box-shadow: 2px 2px 0 var(--fg);
}

.latest_page_btn:hover {
    background: var(--fg);
    color: var(--bg);
    box-shadow: none;
}

.latest_page_btn_dim {
    border-color: var(--muted);
    color: var(--muted);
    box-shadow: none;
    cursor: default;
}

.latest_page_pos {
    color: var(--muted);
    font-size: 0.8rem;
}

/* post.html */
.post_date {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-style: bold;
    color: var(--muted);
}

/* guestbook.html */
#guestbook_container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 1em 1em;
    flex-flow: row wrap;
    justify-content:center;
}

.guestbook_post {
    padding: 0.25em;
    width: 300px;
    display: grid;
    border: none;
    min-height:25vh;
    background-color: var(--note-bg);
    grid-template-columns:  min-content         1fr          min-content;
    grid-template-rows:     min-content         1fr;
    gap:                    0.25em         0.25em;
    grid-template-areas:
        "guestbook_post_id        guestbook_name          guestbook_date"
        "guestbook_post_content   guestbook_post_content  guestbook_post_content";
    position: relative;
    &::after {
        background-image: radial-gradient(
            ellipse 110% 110% at 50% 100%,
            transparent 0%,
            transparent 50%,
            rgba(0,0,0,.5) 100%);
        border-radius: -3px;
        content: '';
        display: block;
        position: absolute;
        height: 2em;
        left: 0;
        bottom: -1.25em;
        transform: perspective(30em) rotateX(45deg);
        width: 100%;
        z-index: -1;
    }
}

.guestbook_new_post {
    padding: 0.25em;
    display: grid;
    width: 300px;
    height:100%;
    background-color: var(--note-bg);
    position: relative;
    &::after {
        background-image: radial-gradient(
            ellipse 110% 110% at 50% 100%,
            transparent 0%,
            transparent 50%,
            rgba(0,0,0,.5) 100%);
        border-radius: -3px;
        content: '';
        display: block;
        position: absolute;
        height: 2em;
        left: 0;
        bottom: -1.25em;
        transform: perspective(30em) rotateX(45deg);
        width: 100%;
        z-index: -1;
    }
    grid-template-rows:         min-content         1fr          min-content;
    grid-template-columns:      1fr         min-content;
    gap:                        0.25em         0.25em;
    grid-template-areas:
        "name_field         date"
        "content_field      content_field"
        "password_field        submit";
}

.guestbook_name {
    width: min-content;
    grid-area: guestbook_name;
}

.guestbook_date {
    font-family: 'Courier New', Courier, monospace;
    font-style: bold;
    color: var(--muted);
    width: min-content;
    grid-area: guestbook_date;
}

.password_field {
    width: 1fr;
    grid-area: password_field;
    background-color: transparent;
    border: none;
}

.guestbook_delete_button {
    font-family: 'Courier New', Courier, monospace;
    font-style: bold;
    color: var(--muted);
    width: min-content;
    display: inline-block;
    grid-area: guestbook_post_id;
}

.guestbook_post_content {
    grid-area: guestbook_post_content;
    margin-top: 0;
    height:fit-content;
    width: 100%;
}

.guestbook_new_name {
    grid-area: name_field;
}

.guestbook_new_name input {
    grid-area: name_field;
    border: none;
    background-color: transparent;
    width: 100%;
}

.guestbook_new_post textarea {
    border: none;
    background-color: transparent;
    resize:none;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0.25em;
}

.guestbook_new_date {
    grid-area: date;
    font-family: 'Courier New', Courier, monospace;
    font-style: bold;
    color: var(--muted);
    width: min-content;
}

.guestbook_new_post_content {
    grid-area: content_field;
}

.guestbook_submit {
    margin: auto 0;
    grid-area: submit;
    height:min-content;
    background-color: transparent;
    color: var(--link);
    border: none;
}

.guestbook_submit:hover {
    color: red;
    text-decoration: underline;
    text-decoration-style: wavy;
}

/* index.html */

.index_collage {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 5px 5px;
    width:100%;
}

.index_collage img {
    max-height: 60vh;
}

#password_container {
    text-align: center;
    width:fit-content;
    margin: 0 auto;
}

.link_button {
    background: none;
    border: none;
    color: var(--link);
    text-decoration-line: underline;
}

.link_button:disabled {
    color: var(--muted) !important;
    text-decoration: underline var(--muted);
    text-decoration-style: wavy;
    margin: 0 auto;
}

.link_button:hover {
    color:red;
    text-decoration-style: wavy;
}

#password_form input {
    border: 2px inset;
    margin-bottom:1em;
}

/* edit_post.html */

.image_preview img {
    width:50%;
}

/* Dropzone image upload */

.caption-input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 5px;
    color: var(--fg);
}

.dz-preview {
    position: relative;
    width: auto;
    border: none;
    max-width:500px;
}

.dropzone .dz-preview:hover .dz-image img {
    filter:none;
    transform: none;
}

.dropzone {
    display: grid;
    margin: 1em auto;
    width: 100%;
    grid-auto-rows: fit-content 2em 3em;
    grid-template-columns: 1fr 1fr;
    gap: 1em 1em;
    grid-auto-flow: row;
    border: 1px dotted var(--border);
}

.dropzone .dz-message {
    grid-column: 1 / -1;
    text-align: center;
}

.dropzone .dz-preview {
    grid-row: span 2;
    display: grid;
    grid-template-rows: subgrid;
    border: 2px solid var(--border);
    padding:0.25em;
    -webkit-box-shadow: 0px 2px 18px -11px #000000;
    box-shadow: 0px 2px 18px -11px #000000;
    background: var(--post-cell-bg) !important;
}

.dz-caption input {
    background: none;
    border: none;
    text-align: center;
    color: var(--fg);
}

.dropzone .dz-preview .dz-image {
    border-radius: 0px;
    overflow:auto;
    width: 100%;
    height: auto;
    position: relative;
    display: block;
}

.dz-image img {
    object-fit:cover;
    height: auto;
    border: 1px inset;
    width:100%;
}

.dz-remove {
    display:inline-block !important;
    width:1.2em;
    height:1.2em;

    position:absolute;
    top:5px;
    right:5px;
    z-index:1000;

    font-size:1.2em !important;
    line-height:1em;

    text-align:center;
    font-weight:bold;
    border:1px solid var(--border) !important;
    border-radius:1.2em;
    color:gray;
    background-color: var(--dz-remove-bg);
    opacity:.5;
}

.dz-remove:hover {
    text-decoration:none !important;
    opacity:1;
}

.title_input {
    width:100%;
    border: none;
    background-color: transparent;
    color: var(--fg);
}

.tags_input {
    width:100%;
    border: none;
    background-color: transparent;
    color: var(--fg);
}

#post_data_input {
    display: grid;
    width: 100%;
    grid-template-columns: min-content 1fr;
    grid-template-rows: fit-content fit-content;
    gap: 0.5em 0.5em;
    grid-auto-flow: row;
    grid-template-areas:
    "title_label title_edit"
    "tags_label tags_edit"
    ;
}

#title_edit_label {
    grid-area: title_label;
}

#title_edit {
    grid-area: title_edit;
    border-bottom: 1px solid var(--muted);
}

#tags_edit_label {
    grid-area: tags_label;
}

#tags_edit {
    grid-area: tags_edit;
    border-bottom: 1px solid var(--muted);
}

#content_edit {
    margin-top: 0.8em;
}

#content_edit textarea {
    width: 100%;
    background-color: transparent;
    color: var(--fg);
    border: 1px solid var(--muted);
    font-family: monospace;
    resize: vertical;
    padding: 0.4em;
}

/* login.html */

#username {
    background-color: transparent;
    color: var(--fg);
    border: 1px solid var(--fg);
}

#password {
    background-color: transparent;
    color: var(--fg);
    border: 1px solid var(--fg);
}

/* settings.html */

.settings_container {
    width: 80%;
    margin: 0 auto;
    display: grid;
    grid-auto-rows: 1fr 1fr;
    grid-template-columns: 2fr 1fr;
    gap: 1em 2em;
}

/* ── settings.html ───────────────────────────────────────── */

.settings_page {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5em;
}

.settings_section {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.settings_heading {
    font-size: 1rem;
    margin: 0 0 0.4em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--fg);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings_section_admin .settings_heading {
    border-bottom-color: var(--muted);
    color: var(--muted);
}

.settings_group_label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-top: 0.8em;
    margin-bottom: 0.1em;
}

.settings_row {
    display: flex;
    align-items: baseline;
    gap: 1.5em;
}

.settings_label {
    flex: 1;
    font-size: 0.9rem;
}

.settings_warning {
    font-size: 0.8em;
    color: var(--muted);
    font-weight: normal;
}

.settings_control {
    white-space: nowrap;
}

.settings_radio {
    margin-right: 1em;
    font-weight: normal;
    cursor: pointer;
}

.settings_submit {
    margin-top: 0.8em;
    text-align: right;
}

@media screen and (max-width: 900px) {
    .post_content {
        grid-template-columns: 1fr;
    }
    .dropzone {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 600px) {
    #wrap {
        grid-template-columns:  1fr 1fr;
        grid-template-rows:     auto auto auto auto;
        grid-template-areas:
            "logo       logo"
            "nav-left   nav-right"
            "main       main"
            "footer     footer";
    }
    nav {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        justify-content: space-around;
        align-items: center;
    }
    nav#left {
        margin-left: 0;
        margin-top: 0.5em;
        padding-right: 0;
        height: auto;
        justify-self: stretch;
        align-self: start;
        justify-content: space-around;
        align-items: center;
    }
    nav#right {
        margin-right: 0;
        margin-top: 0.5em;
        padding-left: 0;
        height: auto;
        justify-self: stretch;
        align-self: start;
        justify-content: space-around;
        align-items: center;
    }

    #logo {
        height: auto;
        min-height: 15vw;
    }
    #logo img {
        width: 80%;
        max-width: 80%;
        height: auto;
        margin: 0 auto;
    }
}

/* ── admin tabs ─────────────────────────────────────────── */

.admin-tabs-wrap {
    max-width: 900px;
}

.admin-tabs {
    display: flex;
    gap: 0;
    position: relative;
    z-index: 1;
}

.admin-tab {
    padding: 0.4em 1.4em;
    border: 2px solid var(--muted);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    text-decoration: none;
    color: var(--muted);
    background: transparent;
    margin-right: 4px;
    position: relative;
    bottom: -2px;
}

.admin-tab-active {
    color: var(--fg);
    border-color: var(--fg);
    background: var(--bg);
    bottom: 0;
    padding-bottom: calc(0.4em + 2px);
}

.admin-tab-body {
    border: 2px solid var(--fg);
    border-radius: 0 6px 6px 6px;
    padding: 1.4em;
}

.admin-hint {
    color: var(--muted);
    font-size: 0.85em;
    margin-bottom: 1em;
}

/* ── error pages ────────────────────────────────────────── */

.error_page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    min-height: 40vh;
    text-align: center;
}

.error_code {
    font-size: 5rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ec, var(--fg));
    text-shadow: 5px 5px 0 color-mix(in srgb, var(--ec, var(--fg)) 35%, transparent);
}

.error_msg {
    font-size: 1rem;
    color: var(--muted);
}

.error_back {
    margin-top: 0.8em;
    font-size: 0.85rem;
}

/* ── heard.html ─────────────────────────────────────────── */

.heard_container {
    max-width: min(100%, 840px);
    margin: 0 auto;
}

.heard_post {
    margin: 2em 0;
    margin-bottom: 2.8em;
    padding: 1em 1.4em;
    border-radius: 10px;
}

/* Quote: chunky framed card with offset shadow */
.heard_post_quote {
    border: 3px solid var(--heard-c1);
    box-shadow: 5px 5px 0 var(--heard-c1);
}

/* Dialogue: same treatment, different color */
.heard_post_dialogue {
    border: 3px solid var(--heard-c2);
    box-shadow: 5px 5px 0 var(--heard-c2);
}

/* Plain: thick left bar, no box */
.heard_post_plain {
    border-left: 5px solid var(--heard-c3);
    border-radius: 0;
    padding-top: 0.3em;
    padding-bottom: 0.3em;
}

.heard_post_meta {
    margin-top: 0.5em;
    font-size: 0.7rem;
    color: var(--muted);
    display: flex;
    gap: 1em;
    align-items: baseline;
}

a.heard_post_date {
    color: var(--muted);
    text-decoration: none;
}
a.heard_post_date:hover {
    text-decoration: underline;
}

.heard_post_admin a {
    color: var(--muted);
    text-decoration: none;
}
.heard_post_admin a:hover {
    color: var(--fg);
}

/* Quote */
.heard_quote {
    font-style: italic;
    text-align: center;
    line-height: 1.5;
}
.heard_quote_attr {
    display: block;
    font-style: normal;
    font-size: 0.85em;
    color: var(--muted);
    margin-top: 0.3em;
}

/* Dialogue */
.heard_dialogue {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2em 0.8em;
    line-height: 1.5;
}
.heard_speaker {
    font-size: 0.8em;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
    padding-top: 0.1em;
}
.heard_text {
    font-style: italic;
}

/* Plain / lexicon */
.heard_plain p {
    margin: 0.3em 0;
}
