/* StratRoulette — site styles */

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    overflow-x: hidden;
    color-scheme: dark;
    background-color: #000000;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 18px;
    line-height: 1.45;
    background-color: #000000;
    color: #ffffff;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

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

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

ul, ol {
    list-style: none;
    padding: 0;
}

:root {
    --op-bg: #000000;
    --op-text: #ffffff;
    --op-muted: rgba(255, 255, 255, 0.65);
    --op-border: rgba(255, 255, 255, 0.12);
    --op-border-strong: rgba(255, 255, 255, 0.5);
    --op-accent: rgb(255, 103, 25);
    --op-error: #ff6b6b;
    --op-radius: 0;
}

/* Layout */

main.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem 1.5rem;
}

section {
    padding-top: 1.5rem;
}

section:first-of-type {
    padding-top: 0;
}

.grid + section {
    margin-top: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid article {
    margin-bottom: 0;
}

figure {
    margin: 0;
    overflow-x: auto;
}

/* Typography */

h1, h2, h3, h4, h5, h6,
article header strong,
.page-title {
    line-height: 1.1;
}

a {
    color: var(--op-text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

small {
    color: var(--op-muted);
    font-size: 0.85em;
}

.intro {
    font-size: 1.35rem;
    line-height: 1.2;
    max-width: 28rem;
}

/* Global header */

.global-header {
    position: relative;
    overflow: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #000000;
}

.global-brand {
    position: relative;
    top: -15px;
    left: -15px;
    display: block;
    font-size: 64px;
    font-weight: 700;
    line-height: 0.8;
    letter-spacing: -0.04em;
    white-space: nowrap;
    color: var(--op-text);
}

.global-brand:hover {
    text-decoration: none;
    opacity: 0.85;
}

/* Site nav */

.site-header {
    margin-bottom: 2rem;
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.site-header nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.site-header nav ul:first-child {
    flex: 1;
}

.site-header nav ul:last-child {
    gap: 1.5rem;
}

.site-header nav ul:last-child a {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.site-header .page-title {
    font-size: 1rem;
    margin: 0;
    letter-spacing: 0.02em;
}

.site-header .profile-link {
    color: var(--op-muted);
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: normal;
}

.site-header .profile-link:hover {
    color: var(--op-text);
}

.profile-incomplete {
    color: var(--op-error);
}

.profile-incomplete .profile-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.1em;
    margin-left: 0.25rem;
    border-radius: 50%;
    background: var(--op-error);
    color: var(--op-bg);
    font-size: 0.75em;
    font-weight: bold;
    line-height: 1;
    vertical-align: middle;
}

/* Footer */

.site-footer {
    margin-top: 3rem;
    color: var(--op-muted);
    font-size: 0.85rem;
    text-align: center;
}

.site-footer a {
    color: var(--op-muted);
}

/* Forms */

form {
    display: grid;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: -0.5rem;
    font-size: 0.85rem;
}

label.field-missing {
    color: var(--op-error);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.65rem 0.75rem;
    background-color: var(--op-bg);
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
    color: var(--op-text);
}

input::placeholder,
textarea::placeholder {
    color: var(--op-muted);
}

input[readonly] {
    color: var(--op-muted);
    cursor: default;
}

.field-locked {
    position: relative;
    display: grid;
    gap: 0.5rem;
}

.field-locked label {
    margin-bottom: 0;
}

.field-locked input[readonly] {
    cursor: not-allowed;
}

.field-locked-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    max-width: 16rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--op-text);
    background-color: #1a1a1a;
    border: 1px solid var(--op-border-strong);
    border-radius: var(--op-radius);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 100;
}

.field-locked-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: var(--op-error);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.65)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

textarea {
    resize: vertical;
    min-height: 6rem;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--op-border-strong);
}

/* Buttons */

button,
button[type="submit"],
[type="submit"],
a[role="button"],
span[role="button"],
details summary[role="button"] {
    display: inline-block;
    width: auto;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--op-radius);
    background-color: transparent;
    border: 1px solid var(--op-border-strong);
    color: var(--op-text);
    box-sizing: border-box;
    cursor: pointer;
    text-decoration: none;
}

button:hover,
[type="submit"]:hover,
a[role="button"]:hover,
details summary[role="button"]:hover {
    border-color: var(--op-text);
    background-color: transparent;
    text-decoration: none;
}

button:focus-visible,
a[role="button"]:focus-visible,
details summary[role="button"]:focus-visible {
    outline: 2px solid var(--op-accent);
    outline-offset: 2px;
}

/* Cards */

main,
article,
figure,
table,
thead,
tbody,
tr,
td,
th {
    background-color: #000000;
}

article {
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

article > header,
article > footer {
    margin: 0 0 0.75rem;
    padding: 0 0 0.75rem;
    border: none;
    border-bottom: 1px solid var(--op-border);
    border-radius: 0;
}

article > footer {
    margin: 0.75rem 0 0;
    padding: 0.75rem 0 0;
    border-bottom: none;
    border-top: 1px solid var(--op-border);
}

article header {
    margin-bottom: 0;
}

article header strong {
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--op-muted);
}

article p + p {
    margin-top: 0.75rem;
}

.panel {
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    text-align: left;
    vertical-align: middle;
}

thead th {
    padding-bottom: 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--op-muted);
    border-bottom: 1px solid var(--op-border);
}

tbody td {
    border-bottom: 1px solid var(--op-border);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Details */

details {
    margin-bottom: 1rem;
}

details[open] > summary {
    margin-bottom: 1rem;
}

details summary[role="button"] {
    list-style: none;
}

details summary[role="button"]::-webkit-details-marker {
    display: none;
}

/* Status messages */

[role="status"],
[role="alert"] {
    padding: 0;
    border: none;
    margin-bottom: 1.5rem;
}

[role="status"] {
    color: var(--op-muted);
}

[role="alert"] {
    color: var(--op-error);
}

/* Dashboard */

.status-box {
    max-width: 36rem;
    margin: 0 auto 2.5rem;
    padding: 2rem 2.5rem;
    text-align: center;
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
}

.status-box p {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.35;
}

.status-box p::first-line {
    font-weight: 700;
}

.status-box small a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rolls-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.rolls-table-wrap {
    overflow-x: visible;
    margin: 0 auto;
    max-width: 600px;
}

.rolls-table th,
.rolls-table td {
    padding: 0.75rem 0.5rem;
}

.rolls-table th:nth-child(1),
.rolls-table td:nth-child(1) {
    width: 22%;
    padding-left: 0;
}

.rolls-table th:nth-child(2),
.rolls-table td:nth-child(2) {
    width: 14%;
}

.rolls-table th:nth-child(4),
.rolls-table td:nth-child(4) {
    width: 26%;
    padding-right: 0;
    text-align: right;
}

.rolls-table td:nth-child(4) a[role="button"],
.rolls-table td:nth-child(4) [role="button"][aria-disabled="true"] {
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

[role="button"][aria-disabled="true"],
[role="button"][aria-disabled="true"]:hover {
    color: var(--op-muted);
    border-color: var(--op-border);
    cursor: not-allowed;
    opacity: 0.6;
    background-color: transparent;
    text-decoration: none;
}

/* Match page */

.match-month {
    margin: 0 0 2rem;
    font-size: 1.5rem;
    line-height: 1.2;
    text-align: center;
}

.match-callout {
    margin: 0 0 1.5rem;
    padding: 1.25rem 1.5rem;
    text-align: center;
    color: var(--op-muted);
    border: 1px solid var(--op-border);
    border-radius: var(--op-radius);
}

.reflections > header {
    border-bottom: 1px solid var(--op-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.reflections header strong {
    color: var(--op-text);
    font-size: 1rem;
    text-transform: none;
    letter-spacing: normal;
}

/* Responsive */

@media (max-width: 768px) {
    main.container {
        padding: 0.5rem 1rem 1.25rem;
    }

    .global-brand {
        font-size: clamp(1.75rem, 11vw, 4rem);
        top: -10px;
        left: -10px;
    }

    .site-header {
        margin-bottom: 1.5rem;
    }

    .site-header nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .site-header nav ul:first-child,
    .site-header nav ul:last-child {
        width: 100%;
    }

    .site-header nav ul:last-child {
        flex-wrap: wrap;
        gap: 0.75rem 1.25rem;
    }

    .site-header .profile-link {
        flex: 1 1 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .site-header .page-title {
        font-size: 0.95rem;
    }

    article {
        padding: 1rem;
    }

    .intro {
        font-size: 1.15rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .status-box {
        padding: 1.25rem 1rem;
    }

    .status-box p {
        font-size: 1.15rem;
    }

    .rolls-table-wrap {
        max-width: 100%;
    }

    .rolls-table thead {
        display: none;
    }

    .rolls-table tbody tr {
        display: block;
        padding: 1rem 0;
        border-bottom: 1px solid var(--op-border);
    }

    .rolls-table tbody tr:last-child {
        border-bottom: none;
    }

    .rolls-table td {
        display: block;
        width: 100% !important;
        padding: 0.2rem 0;
        text-align: left !important;
        border-bottom: none;
    }

    .rolls-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.2rem;
        font-size: 0.7rem;
        font-weight: 500;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--op-muted);
    }

    .rolls-table td:nth-child(4) {
        padding-top: 0.65rem;
    }

    .rolls-table td:nth-child(4)::before {
        display: none;
    }

    .match-month {
        font-size: 1.25rem;
    }

    .match-callout {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .reflections .grid {
        grid-template-columns: 1fr;
    }
}
