/* Common style of all years, after https://kms.sk (colours of .theme-kms, font Source Sans 3) */

/* Source Sans 3 (variable weight 200-900, SIL Open Font License), downloaded from Google Fonts: latin and latin-ext */
@font-face {
    font-family: "Source Sans 3";
    font-style: italic;
    font-weight: 200 900;
    font-display: swap;
    src: url(/static/fonts/SourceSans3-Italic-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: italic;
    font-weight: 200 900;
    font-display: swap;
    src: url(/static/fonts/SourceSans3-Italic-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url(/static/fonts/SourceSans3-Roman-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url(/static/fonts/SourceSans3-Roman-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


:root {
    --primary-dark: oklch(45.13% 0.2369 300.61);
    --primary: oklch(55.13% 0.2369 300.61);
    --primary-light: oklch(65.13% 0.2369 300.61);
    --primary-pale: oklch(95% 0.03 300.61);
    --primary-text: #fff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --background: #f9fafb;
    --success: #15803d;
    --error: #b91c1c;
    --gap: 1rem;
    --radius: 0.375rem;
    font-family: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
    font-size: 112.5%; /* 18 px instead of 16, everything in rem scales with it */
    line-height: 1.5;
    color: var(--text);
    background-color: var(--background);
}

body { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.875rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 600; }
.danger { color: var(--error); }

/* Header: purple bar with the logo and the menu, like kms.sk */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--primary);
    color: var(--primary-text);
}
header nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem var(--gap);
    padding: var(--gap);
}
header a { color: var(--primary-text); }
#title {
    display: flex;
    align-items: center;
    gap: var(--gap);
    font-weight: 700;
    font-size: 1.125rem;
}
#title img { height: 2.25rem; }
#menu {
    display: flex;
    flex-wrap: wrap;
    font-size: 0.875rem;
    font-weight: 600;
}
#menu a {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
}
#menu a:hover { background-color: var(--primary-dark); text-decoration: none; }

main {
    display: block;
    max-width: 64rem;
    margin: 0 auto;
    padding: var(--gap);
}

#message {
    max-width: 64rem;
    margin: var(--gap) auto 0;
    padding: 0.75rem var(--gap);
    border-radius: var(--radius);
    background-color: var(--primary-pale);
    color: var(--primary-dark);
    cursor: pointer;
}
#message.error { background-color: #fee2e2; color: var(--error); }
#message.success { background-color: #dcfce7; color: var(--success); }

/* Forms */
input[type=text], input[type=password], input[type=number], textarea {
    box-sizing: border-box;
    max-width: 100%;
    margin: 0.25rem 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font: inherit;
    background-color: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--primary-light); border-color: var(--primary); }
textarea { width: 100%; }
textarea.saved { border-color: var(--success); }
input[type=submit], input[type=button], .button {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    background-color: var(--primary);
    color: var(--primary-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
input[type=submit]:hover, input[type=button]:hover, .button:hover { background-color: var(--primary-dark); text-decoration: none; }
.button.pdf { margin-left: 0.6em; padding: 0.15em 0.6em; font-size: 0.65em; line-height: 1.5; vertical-align: middle; } /* at least as high as the heading text */

.twoColumn { display: flex; flex-wrap: wrap; gap: 0 calc(2 * var(--gap)); }
.half { flex: 1 1 20rem; }

/* Tables */
.tableWrapper { overflow-x: auto; }
table { border-collapse: collapse; background-color: #fff; }
th, td { padding: 0.375rem 0.625rem; border-bottom: 1px solid var(--border); text-align: center; }
th { font-weight: 600; background-color: var(--primary-pale); }
tbody tr:hover { background-color: var(--background); }

/* Problem texts (pandoc HTML with MathML) */
#problem {
    padding: var(--gap);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: #fff;
}
#problem + p, #problem + form { margin-top: var(--gap); }
#problem.solved { border-left: 4px solid var(--success); }
#problem img, #problem svg { max-width: 100%; }
math[display=block] { overflow-x: auto; }
details { margin: var(--gap) 0; }
summary h2 { display: inline; }
summary { cursor: pointer; }

.feedback { margin: var(--gap) 0; padding-left: var(--gap); border-left: 3px solid var(--primary-light); }
.feedback p { margin: 0; white-space: pre-wrap; }
.feedback .info { color: var(--muted); }

/* Advent calendar: 6 x 4 boxes fitting one screen on a PC, 4 x 6 and 3 x 8 on smaller screens, 2 x 12 on phones */
#calendar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: var(--gap);
    height: calc(100vh - 8rem);
    min-height: 26rem;
}
@media (max-width: 1100px) { #calendar { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(6, 1fr); } }
@media (max-width: 800px) { #calendar { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(8, 7rem); height: auto; } }
@media (max-width: 500px) { #calendar { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(12, 6rem); } }
.box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    text-align: center;
    border: 2px solid var(--primary);
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: #fff;
}
.box:hover { text-decoration: none; }
.box .number { font-size: 2.25rem; font-weight: 700; line-height: 1; }
.box .name { margin-top: 0.25rem; font-size: 0.875rem; }
.box.unpublished { border-color: var(--border); color: var(--muted); background-color: transparent; }
.box.published { background-color: var(--primary); color: var(--primary-text); }
.box.published:hover { background-color: var(--primary-dark); }
.box.opened { color: var(--primary-dark); }
.box.opened:hover { background-color: var(--primary-pale); }
.box.solved { border-color: var(--success); background-color: #dcfce7; color: var(--success); }
input[type=submit]:disabled { background-color: var(--muted); cursor: not-allowed; }
