:root {
    --parchment: #e8d4a8;
    --paper: #f4e7c9;
    --brown: #59341f;
    --espresso: #35261b;
    --rust: #96351c;
    --bright-rust: #c34a1b;
    --blue: #547f87;
    --gold: #e5a33a;
    --border: #b79a72;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--parchment);
    color: var(--espresso);
    font-family: Arial, Helvetica, sans-serif;
}

button, input, textarea, select {
    font: inherit;
}

button {
    cursor: pointer;
    border: 0;
    border-radius: 5px;
    padding: 12px 18px;
    font-weight: 800;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.site-header {
    background: var(--brown);
    color: var(--paper);
    padding: 16px 24px;
    border-bottom: 5px solid var(--rust);
}

.branding {
    max-width: 1400px;
    margin: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.branding img {
    width: 110px;
    max-height: 95px;
    object-fit: contain;
}

.branding h1 {
    margin: 0;
    font-size: clamp(22px, 3vw, 36px);
    letter-spacing: 2px;
}

.branding p {
    margin: 5px 0 0;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.app {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 18px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.view-switch {
    display: flex;
    gap: 6px;
}

.view-switch button {
    background: var(--brown);
    color: white;
}

.view-switch button.active {
    background: var(--bright-rust);
}

.primary {
    background: var(--bright-rust);
    color: white;
}

.primary:hover,
.view-switch button.active:hover {
    background: var(--rust);
}

.month-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.month-navigation h2 {
    flex: 1;
    margin: 0;
    text-align: center;
    font-size: clamp(22px, 3vw, 34px);
    text-transform: uppercase;
}

.month-navigation button {
    background: var(--brown);
    color: white;
}

.calendar-weekdays,
#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    background: var(--brown);
    color: white;
    text-align: center;
    font-weight: 800;
}

.calendar-weekdays div {
    padding: 14px 4px;
}

#calendar-grid {
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.calendar-day {
    min-width: 0;
    min-height: 135px;
    background: var(--paper);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px;
}

.calendar-day.outside {
    background: #dbc9a5;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 4px var(--gold);
}

.day-number {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.gig-block {
    width: 100%;
    display: block;
    text-align: left;
    padding: 10px;
    margin: 5px 0;
    background: var(--bright-rust);
    color: white;
    border-radius: 4px;
    overflow-wrap: anywhere;
}

.gig-block strong {
    display: block;
    font-size: 15px;
    margin-bottom: 5px;
}

.gig-block span {
    display: block;
    font-size: 14px;
}

.gig-block.tentative {
    background: var(--blue);
}

.gig-block.cancelled {
    background: #77716b;
    text-decoration: line-through;
}

.gig-block.past {
    filter: saturate(.45);
    opacity: .75;
}

.gig-block:hover {
    filter: brightness(1.12);
}

.list-month-heading {
    background: var(--brown);
    color: white;
    padding: 14px 18px;
    margin: 25px 0 10px;
    font-size: 22px;
    text-transform: uppercase;
}

.gig-row {
    display: grid;
    grid-template-columns: 135px 115px minmax(150px, 1fr) minmax(200px, 2fr);
    background: var(--paper);
    margin-bottom: 8px;
    border-left: 8px solid var(--bright-rust);
    box-shadow: 0 2px 4px #35261b20;
    cursor: pointer;
}

.gig-row.tentative {
    border-left-color: var(--blue);
}

.gig-row.cancelled {
    border-left-color: #77716b;
}

.gig-row > div {
    padding: 16px;
    overflow-wrap: anywhere;
}

.gig-row .date {
    background: var(--rust);
    color: white;
    font-weight: 800;
}

.gig-row .venue {
    font-weight: 800;
    font-size: 18px;
}

.gig-row .memo {
    white-space: pre-wrap;
}

.empty-message {
    padding: 30px;
    text-align: center;
    background: var(--paper);
}

dialog {
    width: min(95vw, 540px);
    border: 4px solid var(--brown);
    border-radius: 8px;
    background: var(--paper);
    color: var(--espresso);
    padding: 24px;
}

dialog::backdrop {
    background: #0009;
}

dialog h2 {
    margin-top: 0;
}

dialog label {
    display: block;
    font-weight: 800;
    margin: 15px 0 6px;
}

dialog input,
dialog select,
dialog textarea {
    display: block;
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--espresso);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.dialog-actions button {
    background: var(--brown);
    color: white;
}

.dialog-actions .primary {
    background: var(--bright-rust);
}

.dialog-actions .danger {
    background: #822c20;
    margin-right: auto;
}

footer {
    text-align: center;
    padding: 30px;
    color: var(--brown);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
}

@media (max-width: 700px) {
    .site-header {
        padding: 14px;
    }

    .branding img {
        width: 75px;
    }

    .app {
        padding: 0 8px;
    }

    .toolbar button {
        padding: 12px;
    }

    .month-navigation {
        gap: 5px;
    }

    .month-navigation button {
        padding: 10px;
    }

    .calendar-day {
        min-height: 85px;
        padding: 3px;
    }

    .day-number {
        font-size: 14px;
    }

    .calendar-weekdays div {
        font-size: 11px;
        padding: 10px 0;
    }

    .gig-block {
        padding: 5px 3px;
        font-size: 11px;
    }

    .gig-block strong,
    .gig-block span {
        font-size: 11px;
    }

    .gig-row {
        grid-template-columns: 100px 1fr;
    }

    .gig-row .date {
        grid-row: span 3;
    }

    .gig-row > div {
        padding: 12px;
    }
}

@media (max-width: 420px) {
    .branding h1 {
        font-size: 20px;
    }

    .branding p {
        font-size: 12px;
    }

    .month-navigation h2 {
        font-size: 17px;
    }

    .gig-block strong {
        font-size: 10px;
    }

    .gig-block span {
        font-size: 10px;
    }
}

/* RDR banner branding */
.branding img {
    width: min(100%, 520px);
    max-height: 180px;
    height: auto;
    object-fit: contain;
}

@media (max-width: 700px) {
    .branding img {
        width: 100%;
        max-height: 130px;
    }
}

/* ==================================================
   RDR Banner Header
   ================================================== */

.site-header {
    padding: 18px 20px 14px;
}

.branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.branding img {
    display: block;
    width: min(100%, 650px);
    height: auto;
    max-height: none;
    object-fit: contain;
}

.calendar-subtitle {
    color: var(--paper);
    font-size: clamp(15px, 2vw, 22px);
    font-weight: 800;
    letter-spacing: 5px;
    text-transform: uppercase;
    padding: 5px 0 10px;
}

@media (max-width: 700px) {
    .site-header {
        padding: 12px 10px;
    }

    .branding img {
        width: 100%;
        max-height: none;
    }

    .calendar-subtitle {
        font-size: 14px;
        letter-spacing: 3px;
    }
}

/* ==================================================
   RDR Compact Horizontal Header
   ================================================== */

.site-header {
    padding: 8px 20px;
    border-bottom: 5px solid var(--rust);
}

.branding {
    max-width: 1400px;
    margin: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    text-align: right;
}

.branding img {
    display: block;
    width: 20%;
    max-width: none;
    max-height: none;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.calendar-subtitle {
    margin-left: auto;
    padding: 0;
    color: var(--paper);
    font-size: clamp(24px, 3.5vw, 48px);
    font-weight: 800;
    letter-spacing: 5px;
    line-height: 1.1;
    text-align: right;
}

/* Mobile layout */

@media (max-width: 700px) {
    .site-header {
        padding: 8px 12px;
    }

    .branding {
        flex-direction: row;
        gap: 10px;
    }

    .branding img {
        width: 25%;
        max-height: none;
    }

    .calendar-subtitle {
        font-size: clamp(16px, 4vw, 26px);
        letter-spacing: 2px;
    }
}

/* ==================================================
   RDR Analog Clock Time Picker
   ================================================== */

.time-display {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 18px;
    background: white;
    color: var(--espresso);
    border: 2px solid var(--border);
    border-radius: 5px;
    font-size: 22px;
    font-weight: 700;
}

.time-display:hover {
    border-color: var(--bright-rust);
}

.clock-picker[hidden] {
    display: none;
}

.clock-picker {
    margin-top: 10px;
    padding: 18px;
    background: #ead5a9;
    border: 3px solid var(--brown);
    border-radius: 10px;
    text-align: center;
}

.clock-heading {
    font-size: 30px;
    font-weight: 800;
    color: var(--rust);
    margin-bottom: 14px;
}

.clock-face {
    position: relative;
    width: min(100%, 290px);
    aspect-ratio: 1;
    margin: 0 auto 18px;
    background: var(--paper);
    border: 5px solid var(--brown);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px var(--border);
}

.clock-face::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--brown);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.clock-number {
    position: absolute;
    width: 43px;
    height: 43px;
    padding: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    color: var(--espresso);
    font-size: 17px;
    font-weight: 800;
}

.clock-number:hover {
    background: var(--gold);
}

.clock-number.selected {
    background: var(--bright-rust);
    color: white;
}

.clock-period {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
}

.clock-period button {
    min-width: 90px;
    background: var(--brown);
    color: white;
}

.clock-period button.selected {
    background: var(--bright-rust);
}

.clock-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.clock-actions button {
    background: var(--brown);
    color: white;
}

#clock-set {
    background: var(--bright-rust);
}

/* Continuous gig list */

.gig-row.past {
    opacity: 0.65;
}

.gig-row.upcoming {
    opacity: 1;
}

.gig-row:hover {
    filter: brightness(1.04);
}

.list-month-heading {
    scroll-margin-top: 15px;
}

/* Clickable month headings in List View */

button.list-month-heading {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

button.list-month-heading:hover {
    background: var(--rust);
}

button.list-month-heading:active {
    background: var(--bright-rust);
}

button.list-month-heading::after {
    content: "  →";
    float: right;
    font-size: 24px;
}


/* Discreet administrator access */
.site-header {
    position: relative;
}

#admin-access {
    position: absolute;
    top: 12px;
    right: 16px;
    padding: 5px 8px;
    background: transparent;
    color: var(--paper);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

#admin-access:hover {
    background: var(--rust);
    border-color: var(--paper);
}
