@font-face {
  font-family: "Barlow Condensed";
  src: url("./barlow-condensed-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #211a29;
  background: #fff;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --violet: #422073;
  --dark-violet: #301452;
  --muted: #61596b;
  --line: #d9d3df;
  --wash: #f5f2f8;
  --danger: #8a254b;
}

* { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid #7946b0; outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { width: min(calc(100% - 4rem), 70rem); margin-inline: auto; }

.masthead {
  background: var(--violet);
  color: white;
  overflow: hidden;
}
.masthead-inner {
  position: relative;
  isolation: isolate;
  min-height: 11.25rem;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding-block: 1.35rem 1.5rem;
}
.masthead-inner::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -25%;
  right: 1.5rem;
  width: 2.4rem;
  height: 150%;
  background: #ffffff14;
  box-shadow: -3.1rem 0 #ffffff14, -6.2rem 0 #ffffff14;
  transform: skewX(-20deg);
}
.crest {
  display: block;
  width: clamp(4rem, 11vw, 7.7rem);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  flex: none;
}
.masthead h1 {
  font: 700 clamp(2.4rem, 7vw, 5.4rem)/.92 var(--display);
  text-transform: uppercase;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.masthead-subtitle { margin-top: .55rem; font-size: .95rem; color: #f1e8fa; }

.season-overview { border-bottom: 1px solid var(--line); }
.stats-strip {
  display: grid;
  grid-template-columns: .75fr .9fr 1.35fr 1.35fr;
  padding-block: 1.2rem;
}
.stats-strip > div { min-width: 0; padding: 0 1.1rem; border-inline-start: 1px solid var(--line); }
.stats-strip > div:first-child { padding-inline-start: 0; border-inline-start: 0; }
.stats-strip dt {
  margin-bottom: .3rem;
  font-size: .875rem;
  font-weight: 700;
  color: var(--muted);
}
.stat dd, #keeper-counter {
  font: 700 2.7rem/1 var(--display);
  font-variant-numeric: tabular-nums;
  color: var(--violet);
}
.leader strong {
  display: block;
  color: var(--violet);
  font: 700 1.75rem/1.06 var(--display);
  overflow-wrap: anywhere;
}
.leader span { color: var(--muted); display: block; margin-top: .25rem; font-size: .875rem; }
.leader span:empty { display: none; }

main.wrap { padding-bottom: 2.8rem; }
.section-nav, .tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(.75rem, 3.5vw, 2.1rem);
}
.section-nav {
  border-bottom: 1px solid var(--line);
}
[role="tab"], .section-nav > a {
  min-height: 3.25rem;
  margin-bottom: -1px;
  padding: .65rem 0 .5rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font-size: .95rem;
  font-weight: 700;
}
.section-nav > a { display: flex; align-items: center; text-decoration: none; }
[role="tab"]:hover, .section-nav > a:hover { color: var(--violet); }
[role="tab"][aria-selected="true"], .section-nav > [aria-current="page"] { color: var(--violet); border-bottom-color: var(--violet); }

#log-panel { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.match-entry { padding: 1.5rem clamp(1.25rem, 3.5vw, 2.5rem) 1.7rem 0; }
.match-log {
  min-width: 0;
  padding: 1.5rem 0 1.7rem clamp(1.25rem, 3.5vw, 2.5rem);
  border-inline-start: 1px solid var(--line);
}
.board-heading, .match-log-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .45rem 1rem;
}
.board-heading { padding: 1.3rem 0 .8rem; }
h2 { font: 700 2rem/1 var(--display); color: var(--dark-violet); }
.board-heading p { color: var(--muted); font-size: .9rem; }
.match-entry h2:focus, .match-log h2:focus { outline: none; }

.score-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
  margin-block: .95rem 1rem;
}
.score-fields label, .goal-row label, #editor-form label {
  display: grid;
  align-content: end;
  gap: .35rem;
  font-size: .875rem;
  font-weight: 700;
}
input, select {
  width: 100%;
  min-height: 2.75rem;
  padding: .46rem .65rem;
  border: 1px solid #bfb5c9;
  border-radius: .15rem;
  color: #211a29;
  background: #fff;
  font-size: 1rem;
}
input::placeholder { color: #746b7e; }
select:disabled { color: var(--muted); background: var(--wash); }
.primary, .secondary, .danger {
  min-height: 2.75rem;
  padding: .48rem .85rem;
  border: 1px solid var(--violet);
  border-radius: .15rem;
  font-size: .9rem;
  font-weight: 700;
}
.primary { background: var(--violet); color: #fff; }
.primary:hover { background: var(--dark-violet); }
.secondary { color: var(--violet); background: #fff; border-color: #c9bed3; }
.secondary:hover { background: var(--wash); }
.remove-match { color: var(--danger); border-color: #d9bdca; }
.remove-match:hover { background: #fff0f5; }
.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.danger:hover { background: #691a37; }
.form-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .9rem; }
.goal-fields { display: grid; gap: .65rem; margin-top: .75rem; }
.goal-fields:empty { display: none; }
.goal-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: .65rem;
  margin: 0;
  padding: .3rem .65rem .7rem;
  border: 1px solid var(--line);
}
.goal-row legend { padding-inline: .28rem; color: var(--violet); font-weight: 700; font-size: .875rem; }

.match-entry .match-score { margin: .45rem 0 .65rem; }
.match-score, .empty-log, .keeper-note, #no-goals {
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.match-score strong { color: var(--dark-violet); font-variant-numeric: tabular-nums; }
.match-feedback { margin-top: .75rem; color: var(--violet); font-weight: 700; }
.empty-log { margin-top: .65rem; }
.match-card { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.match-card:last-child { border-bottom: 0; padding-bottom: 0; }
.match-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; }
.match-card-top > div:first-child { min-width: 0; }
.match-card-actions { display: flex; gap: .4rem; }
.match-card h3 {
  margin-bottom: .2rem;
  color: var(--dark-violet);
  font: 700 1.25rem/1 var(--display);
}
.match-card details { margin-top: .55rem; }
.match-card summary, #local-history > summary { color: var(--violet); font-size: .875rem; font-weight: 700; cursor: pointer; }
#local-history { margin-top: 1rem; }
.match-card ol { margin: .5rem 0 .1rem; padding-left: 1.45rem; }
.match-card li + li { margin-top: .35rem; }
.match-card li span { margin-left: .55rem; color: var(--muted); font-size: .875rem; }

table { width: 100%; table-layout: fixed; border-collapse: collapse; }
thead { background: var(--wash); }
th, td { text-align: center; }
thead th { padding: .65rem .4rem; color: var(--violet); font-size: .875rem; }
thead th:first-child { width: 48%; text-align: left; padding-left: .75rem; }
tbody tr { border-bottom: 1px solid var(--line); }
tbody tr:last-child { border-bottom: 0; }
tbody th { text-align: left; padding: .72rem .75rem; }
td { padding: .72rem .25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.injuries-table th, .injuries-table td { text-align: left; padding-inline: .75rem; }
.injuries-table td { font-weight: 400; }
.player { display: flex; align-items: center; gap: .45rem; line-height: 1.2; }
.keeper-tag { color: var(--violet); font-size: .75rem; font-weight: 700; }
.keeper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-block: 1px solid var(--line);
  padding: .85rem .75rem;
  background: var(--wash);
  font-weight: 700;
}
.keeper-note { padding: .8rem 0; }
.keeper-matches { margin: 0; padding: 0 0 .85rem 1.2rem; }
.keeper-matches li + li { margin-top: .3rem; }
.save-note { padding: .75rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }

#editor-dialog, #delete-dialog {
  width: min(calc(100% - 2rem), 29rem);
  padding: 1.3rem;
  border: 1px solid var(--violet);
  border-radius: .15rem;
  color: inherit;
}
#editor-dialog::backdrop, #delete-dialog::backdrop { background: #1e142db3; }
#editor-form p, #editor-form label, #delete-dialog p { margin-top: .75rem; line-height: 1.45; }
#editor-form a { color: var(--violet); font-weight: 700; }

@media (max-width: 52rem) {
  #log-panel { grid-template-columns: 1fr; }
  .match-entry, .match-log { padding-inline: 0; }
  .match-log { border-inline-start: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 42rem) {
  .wrap { width: calc(100% - 2rem); }
  .masthead-inner { min-height: 7.5rem; }
  .masthead-inner::after { right: -.75rem; }
  .masthead-subtitle { font-size: .875rem; }
  .stats-strip { grid-template-columns: 1fr 1fr; padding-block: .7rem 0; }
  .stats-strip > div { padding: 0 .65rem .7rem; }
  .stats-strip > div:nth-child(odd) { padding-inline-start: 0; border-inline-start: 0; }
  .stats-strip .leader { padding-top: .65rem; border-top: 1px solid var(--line); }
  .stat dd { font-size: 2.2rem; }
  .leader strong { font-size: 1.55rem; }
  .match-entry, .match-log { padding-block: 1.1rem 1.3rem; }
}
