/* Fury Events & Calendar.
 *
 * Palette and controls come from /assets/theme.css and /styles.css. This is the
 * grid, the chips and the three dialogs, and nothing else -- a button here
 * should look like a button anywhere on the site.
 *
 * The bracketed view switch and the emoji-per-day grid are the two things that
 * make this page look like the calendar it was drawn as. */

.cal-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(8px, 2vw, 24px) 24px 96px;
}

/* ----- Hero --------------------------------------------------------------- */

.cal-hero {
    display: flex;
    justify-content: center;
    margin-bottom: clamp(18px, 3vw, 30px);
}

.cal-wordmark {
    width: min(560px, 82vw);
    height: auto;
}

/* ----- Week / month / year ------------------------------------------------
   Real buttons; the brackets are decoration, so nothing is lost to a reader
   that does not draw them. */

.cal-views {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 3vw, 34px);
    flex-wrap: wrap;
}

.cal-view {
    background: none;
    border: 0;
    padding: 6px 4px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.cal-view::before { content: '[ '; color: var(--accent-dark); }
.cal-view::after  { content: ' ]'; color: var(--accent-dark); }
.cal-view:hover { color: var(--text); }

/* The one you are on stays lit, not just while the pointer is over it. */
.cal-view.is-here {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.cal-range { text-align: center; margin: 12px 0 20px; }
.cal-range b { display: block; font-size: 1.05rem; }
.cal-range span { color: var(--muted); font-size: 0.85rem; }

/* Under the grid: two wide buttons that say where they go, not just which
   way. On a narrow screen they stack rather than shrink to nothing. */
.cal-steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.cal-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--text);
}
.cal-step:hover { border-color: var(--accent); }

#prev { justify-content: flex-start; text-align: left; }
#next { justify-content: flex-end; text-align: right; }

.cal-step-text b {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.cal-step-text span { color: var(--muted); font-size: 0.82rem; font-weight: 400; }

.cal-step-arrow { color: var(--accent); font-size: 1.15rem; line-height: 1; }

/* ----- The grid ----------------------------------------------------------- */

.cal-grid { margin-top: 4px; }

.cal-week-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.cal-dayhead {
    padding: 10px 8px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(34, 39, 50, 0.92);
    text-align: center;
    line-height: 1.35;
}
.cal-dayhead b { display: block; font-size: 0.82rem; letter-spacing: 0.02em; }
.cal-dayhead span { color: var(--muted); font-size: 0.76rem; }

.cal-dayhead.is-today { border-color: var(--accent); }
.cal-dayhead.is-today b { color: var(--accent); }

/* ----- A week: the bars across it, then its days -------------------------
   Anything lasting more than a day is one bar spanning the columns it covers.
   Both halves are seven-column grids with the same gap, so a bar lines up
   exactly with the days underneath it. */

.cal-strip { display: grid; gap: 8px; }

.cal-bars {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px 8px;
}

.cal-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    overflow: hidden;
    padding: 7px 14px;
    border: 1px solid var(--accent-dark);
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(217, 164, 65, 0.22), rgba(217, 164, 65, 0.07));
    color: var(--text);
    text-align: left;
}
.cal-bar:hover { border-color: var(--accent); }

.cal-bar.is-botw {
    border-color: #3c6b7a;
    background: linear-gradient(90deg, rgba(86, 167, 191, 0.22), rgba(86, 167, 191, 0.07));
}
.cal-bar.is-botw:hover { border-color: #56a7bf; }

.cal-bar-title {
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.cal-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 190px;
    padding: 8px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-2);
}
.cal-cell.is-today { border-color: var(--accent-dark); }

/* The column headings say which day this is on a wide screen. On a narrow one
   they are gone, so each cell has to name itself. */
.cal-cell-day { display: none; color: var(--muted); font-size: 0.78rem; }
.cal-cell-day b { color: var(--text); }

/* ----- A chip ------------------------------------------------------------- */

.cal-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(34, 39, 50, 0.92);
    color: var(--text);
    text-align: left;
    font-weight: 500;
}
.cal-chip:hover { border-color: var(--accent); }

.cal-chip.is-trial { border-left: 3px solid var(--accent); }
.cal-chip.is-botw  { border-left: 3px solid #56a7bf; }

.cal-chip-text { min-width: 0; }
.cal-chip-when {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}
.cal-chip-title {
    display: block;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The emoji is the point of the whole grid, so it is drawn big enough to read
   at a glance. Custom Discord emoji arrive as images from the renderer. */
.cal-emoji {
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1;
}
.cal-emoji .emoji {
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: -0.2em;
}

.cal-empty { flex: 1; }

/* ----- Month --------------------------------------------------------------
   Six of the same strips, so a run of days spans across a month exactly as it
   does across a week -- one bar, cut at the end of each row. */

.cal-month-body { display: grid; gap: 6px; }
.cal-month-body .cal-strip { gap: 5px; }
.cal-month-body .cal-days { gap: 6px; }
.cal-month-body .cal-bars { gap: 4px 6px; }

.cal-month-body .cal-bar { padding: 4px 10px; }
.cal-month-body .cal-bar-title { font-size: 0.76rem; }

.cal-cell.is-compact {
    min-height: 74px;
    padding: 6px;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
}
.cal-cell.is-outside { opacity: 0.42; }

/* On a month grid there is no room for a title, so the chip is the emoji. */
.cal-cell.is-compact .cal-chip { width: auto; padding: 3px 5px; }
.cal-cell.is-compact .cal-cell-day {
    display: block;
    width: 100%;
    color: var(--muted);
    font-size: 0.74rem;
}
.cal-cell.is-compact.is-today .cal-cell-day { color: var(--accent); font-weight: 700; }

/* ----- Year --------------------------------------------------------------- */

.cal-grid.is-year {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.cal-monthcard {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 16px 18px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(34, 39, 50, 0.92);
    color: var(--text);
    text-align: left;
}
.cal-monthcard:hover { border-color: var(--accent); }

.cal-monthname { font-size: 0.98rem; font-weight: 600; }
.cal-monthcount { color: var(--accent); font-weight: 700; }
.cal-monthchips {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 1.4rem;
}
.cal-empty-note { color: var(--muted); font-size: 0.78rem; }
.cal-more { color: var(--muted); font-size: 0.78rem; align-self: center; }

/* ----- Underneath --------------------------------------------------------- */

.cal-legend {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

.cal-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 26px;
}
/* One of these is a link, and the button rule in /styles.css is an element
   selector -- so an anchor with .ghost on it would arrive with the border and
   none of the shape. */
.cal-actions a.ghost {
    padding: 8px 15px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

/* ----- The dialogs -------------------------------------------------------- */

.cal-dialog {
    width: min(620px, 94vw);
    padding: 26px 28px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
}
.cal-dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.cal-dialog h2 { margin: 6px 0 12px; font-size: 1.2rem; }

.cal-close {
    float: right;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
}
.cal-close:hover { color: var(--danger); }

.cal-kind {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.cal-kind.is-botw { color: #56a7bf; }

.cal-detail-image {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 14px;
}

.cal-detail-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0 0 14px;
    font-size: 0.88rem;
}
.cal-detail-facts dt { color: var(--muted); }
.cal-detail-facts dd { margin: 0; }

.cal-gametime { color: var(--muted); }

.cal-detail-body {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
}
.cal-detail-body:empty { display: none; }

/* ----- The add form ------------------------------------------------------- */

.cal-form { display: grid; gap: 14px; margin-top: 16px; }
.cal-form label { display: grid; gap: 5px; font-size: 0.85rem; font-weight: 600; }

.cal-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.cal-upload { display: flex; gap: 8px; }
.cal-upload .ghost { flex-shrink: 0; }

/* ----- My suggestions ----------------------------------------------------- */

.cal-mine { display: grid; gap: 12px; margin-top: 14px; }

.cal-suggestion {
    padding: 14px 16px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel-2);
}
.cal-suggestion header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.cal-suggestion p { margin: 4px 0 0; }

.cal-status {
    flex-shrink: 0;
    padding: 2px 9px;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.cal-status.is-accepted { border-color: var(--success); color: var(--success); }
.cal-status.is-denied { border-color: var(--danger); color: var(--danger); }
.cal-status.is-changes { border-color: var(--accent); color: var(--accent); }

/* What the reviewer wrote back. */
.cal-note {
    padding: 8px 12px;
    border-left: 2px solid var(--accent);
    background: rgba(217, 164, 65, 0.08);
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.55;
}

.cal-suggestion-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ----- Narrow ------------------------------------------------------------- */

@media (max-width: 860px) {
    /* Seven columns of anything useful will not fit, so the week becomes a
       list of days and the month keeps its grid with smaller cells. */
    /* The week becomes a list of days -- seven columns of readable titles will
       not fit -- so each cell names its own day and a bar has nothing to span.
       The month keeps its seven columns: narrow columns of emoji are still a
       month, where seven stacked lists of them would be a very long page. */
    .cal-grid.is-week .cal-week-head { display: none; }
    .cal-grid.is-week .cal-days { grid-template-columns: 1fr; }
    .cal-grid.is-week .cal-bars { grid-template-columns: 1fr; }
    .cal-grid.is-week .cal-bar { grid-column: 1 / -1 !important; }

    .cal-cell { min-height: 0; }
    .cal-cell-day { display: block; }
    /* A week of empty days would be seven empty boxes to scroll past. */
    .cal-cell.is-empty:not(.is-compact) { display: none; }

    .cal-month-body .cal-days { gap: 4px; }
    .cal-cell.is-compact { min-height: 52px; }

    .cal-steps { grid-template-columns: 1fr; }
    #next { justify-content: flex-start; text-align: left; flex-direction: row-reverse; }
    .cal-mcell { min-height: 64px; }
    .cal-detail-facts { grid-template-columns: 1fr; gap: 2px; }
    .cal-detail-facts dd { margin-bottom: 8px; }
}
