/*
 * Uppsala Mahjong - shared stylesheet (home page, tournaments, statistics, practice tools).
 *
 * The look of the original site, kept and tidied: green felt background, one centred white column,
 * the green navigation bar with spaced capitals, a banner picture under a white veil with a dark
 * Montserrat title, alternating white / light grey sections, grey Lato text and the purple accent.
 */

:root {
  --green: rgb(108, 175, 118);   /* navigation bar */
  --green-dark: #4e8f59;
  --purple: rgb(128, 128, 190);  /* accent (buttons, panels) */
  --purple-dark: #5f5fa6;        /* links, hover: enough contrast on white */
  --grey-bg: #f6f6f6;            /* alternate sections */
  --ink: #303030;                /* headings */
  --text: #5e5e5e;               /* body text */
  --muted: #8a8a8a;
  --line: #e4e4e4;
  --red: #c1272d;                /* only for errors / required marks */
  --column: 1024px;
  --pad-x: 50px;
  --pad-y: 44px;
  --nav-h: 52px;

  /* names used by the statistics and results stylesheets */
  --green-500: var(--green);
  --green-700: var(--green-dark);
  --green-900: #2f5d37;
  --green-100: #edf6ee;
  --gold: #d9a520;
  --gold-100: #fbf3dc;
  --paper: #fff;
  --ivory: var(--grey-bg);
  --ivory-dark: var(--line);
  --red-dark: #8f1a1f;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { background: #2f7d4b url("../mat.jpg"); scroll-behavior: smooth; }
body { margin: 0; font: 400 16px/1.75 Lato, "Helvetica Neue", Arial, sans-serif; color: var(--text); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--purple-dark); text-decoration: none; }
a:hover, a:focus { color: var(--ink); text-decoration: underline; }
p { margin: 0 0 1em; }
b, strong { color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
code { font-family: Menlo, Consolas, monospace; font-size: 90%; background: var(--grey-bg); padding: 1px 5px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted, .text-muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 18px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--red); }
.clearfix::after { content: ""; display: table; clear: both; }

/* ---- Headings ---- */
h1, h2, h3, h4 { color: var(--ink); line-height: 1.3; margin: 0 0 .6em; }
h1 { font: 400 46px/1.15 Montserrat, sans-serif; }
h2 { font: 600 24px/1.3 Lato, sans-serif; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 26px; }
h3 { font: 700 19px/1.35 Lato, sans-serif; margin-top: 1.4em; }
h4 { font: 400 19px/1.375 Lato, sans-serif; }
h2 + h3, .page-header + h3 { margin-top: 0; }
.page-header { border: 0; margin: 0; padding: 0; }

/* ---- Navigation bar (same column as the page, like the original) ---- */
.um-nav { position: sticky; top: 0; z-index: 50; max-width: var(--column); margin: 0 auto; background: var(--green); }
.um-nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--nav-h); padding: 0 30px; flex-wrap: wrap; }
.um-brand { display: inline-flex; align-items: center; gap: 10px; font: 400 12px/1 Montserrat, sans-serif; letter-spacing: 4px; text-transform: uppercase; color: #fff; }
.um-brand:hover, .um-brand:focus { color: #fff; text-decoration: none; }
.um-brand img { height: 28px; width: auto; }
.um-nav ul { list-style: none; margin: 0; padding: 0; display: flex; }
.um-nav ul a {
  display: block; padding: 0 14px; color: #fff;
  font: 400 12px/var(--nav-h) Montserrat, sans-serif; letter-spacing: 4px; text-transform: uppercase;
}
.um-nav ul a:hover, .um-nav ul a:focus, .um-nav ul a.active { background: #fff; color: var(--purple); text-decoration: none; }
.um-nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.um-nav-toggle span { display: block; width: 22px; height: 2px; margin: 4px 0; background: #fff; }

/* ---- The page column ---- */
.um-page { max-width: var(--column); margin: 0 auto; background: #fff; }
.um-notice { padding: 8px var(--pad-x); background: #fff6d6; color: #6b5300; font-size: 14px; text-align: center; }

/* ---- Banner: picture under a white veil, dark title (the original "jumbotron") ---- */
.um-hero { background: url("../images/bamboo.jpg") center / cover no-repeat; color: var(--ink); }
.um-hero-inner { background: rgba(255, 255, 255, .55); padding: 72px 34px 44px; text-align: center; font-family: Montserrat, sans-serif; }
.um-hero h1 { margin: 0; font: 400 48px/1.15 Montserrat, sans-serif; color: #111; }
.um-hero h1 a { color: inherit; }
.um-hero .lead, .um-hero p { margin: 14px auto 0; max-width: 720px; font: 400 17px/1.6 Montserrat, sans-serif; color: var(--ink); }
.um-hero a:not(.btn) { color: var(--ink); }
.um-hero.compact .um-hero-inner { padding: 40px 34px 30px; }
.um-hero.compact h1 { font-size: 34px; }
.um-sublinks { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; }
.um-sublinks a {
  display: inline-block; padding: 4px 12px; font: 400 12px/1.6 Montserrat, sans-serif; letter-spacing: 3px; text-transform: uppercase;
  color: var(--ink); border-bottom: 2px solid transparent;
}
.um-sublinks a:hover, .um-sublinks a:focus { border-bottom-color: var(--purple); text-decoration: none; color: #000; }

/* ---- Content sections ---- */
.container-fluid, .section { padding: var(--pad-y) var(--pad-x); background: #fff; }
.container-fluid.bg-grey, .bg-grey { background: var(--grey-bg); }
.container-fluid > :last-child { margin-bottom: 0; }

/* ---- Small Bootstrap-3-compatible grid (organisers' texts) ---- */
.row { display: flex; flex-wrap: wrap; margin-left: -16px; margin-right: -16px; }
.row > * { padding-left: 16px; padding-right: 16px; min-width: 0; }
[class*="col-"] { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 768px) {
  .col-sm-1 { flex-basis: 8.3333%; max-width: 8.3333%; }
  .col-sm-2 { flex-basis: 16.6667%; max-width: 16.6667%; }
  .col-sm-3 { flex-basis: 25%; max-width: 25%; }
  .col-sm-4 { flex-basis: 33.3333%; max-width: 33.3333%; }
  .col-sm-5 { flex-basis: 41.6667%; max-width: 41.6667%; }
  .col-sm-6 { flex-basis: 50%; max-width: 50%; }
  .col-sm-7 { flex-basis: 58.3333%; max-width: 58.3333%; }
  .col-sm-8 { flex-basis: 66.6667%; max-width: 66.6667%; }
  .col-sm-9 { flex-basis: 75%; max-width: 75%; }
  .col-sm-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
  .col-sm-12 { flex-basis: 100%; max-width: 100%; }
  .col-sm-offset-1 { margin-left: 8.3333%; }
}
@media (min-width: 992px) {
  .col-md-4 { flex-basis: 33.3333%; max-width: 33.3333%; }
  .col-md-6 { flex-basis: 50%; max-width: 50%; }
  .col-md-8 { flex-basis: 66.6667%; max-width: 66.6667%; }
  .col-md-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
  .col-md-offset-1 { margin-left: 8.3333%; }
}
.slideanim { visibility: visible; }

/* ---- Tables ---- */
.table-responsive, .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: collapse; border-spacing: 0; }
.table { width: 100%; max-width: 100%; margin-bottom: 20px; color: var(--text); font-size: 15px; }
.table th, .table td { padding: 8px 10px; line-height: 1.45; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; }
.table thead th, .table tr:first-child th { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--ink); vertical-align: bottom; }
.table-hover tbody tr:hover > td { background: var(--grey-bg); }
.table-sm th, .table-sm td { padding: 5px 8px; }
tr.info > td, tr.info > th, td.info { background: #eef0fa !important; }
tr.success > td, td.success { background: var(--green-100) !important; }
tr.warning > td, td.warning { background: var(--gold-100) !important; }
.page_table { width: 100%; color: var(--text); font-size: 15px; }
.page_table th, .page_table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.page_table th { color: var(--ink); }
.players th, .players td { white-space: nowrap; }
.players .flag { vertical-align: middle; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; margin-bottom: 20px; border-left: 4px solid var(--line); background: var(--grey-bg); }
.alert-success { color: #2e5e35; background: var(--green-100); border-left-color: var(--green); }
.alert-info { color: #3d3d6e; background: #eef0fa; border-left-color: var(--purple); }
.alert-warning { color: #6b5300; background: #fff6d6; border-left-color: #e0b000; }
.alert-danger { color: var(--red-dark); background: #fbecec; border-left-color: var(--red); }
.alert a { font-weight: 700; }
.alert form { display: inline; }
.alert p:last-child { margin-bottom: 0; }

/* ---- Buttons (the original purple panel buttons) ---- */
.btn {
  display: inline-block; padding: 9px 20px; font: 400 12px/1.5 Montserrat, sans-serif; letter-spacing: 2px; text-transform: uppercase;
  color: #fff; background: var(--purple); border: 1px solid var(--purple); border-radius: 0; cursor: pointer; text-decoration: none;
  vertical-align: middle; transition: background .15s, color .15s;
}
.btn:hover, .btn:focus { background: #fff; color: var(--purple-dark); text-decoration: none; }
.btn-lg { padding: 12px 28px; font-size: 13px; }
.btn-sm { padding: 4px 10px; font-size: 11px; letter-spacing: 1px; }
.btn-outline { background: #fff; color: var(--purple-dark); }
.btn-outline:hover, .btn-outline:focus { background: var(--purple); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover, .btn-danger:focus { background: #fff; color: var(--red); }
.btn-success { background: var(--green-dark); border-color: var(--green-dark); }
.btn-success:hover, .btn-success:focus { background: #fff; color: var(--green-dark); }
.badge { display: inline-block; padding: 1px 8px; font: 700 12px/1.5 Lato, sans-serif; color: #fff; background: var(--purple); vertical-align: middle; }
.badge-success { background: var(--green); }
.badge-gold { background: var(--gold); color: #fff; }

/* ---- Forms ---- */
label, .form-label { display: inline-block; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.form-group { margin-bottom: 16px; }
.form-control {
  display: block; width: 100%; padding: 8px 12px; font: 400 16px/1.5 Lato, sans-serif; color: var(--ink);
  background: #fff; border: 1px solid #cfcfcf; border-radius: 0; transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: #a6a6a6; }
.form-control:focus { border-color: var(--purple); outline: 0; box-shadow: 0 0 0 3px rgba(128, 128, 190, .2); }
textarea.form-control { resize: vertical; }
input[type="file"] { font: inherit; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.form-row > .form-group { flex: 1 1 240px; margin-bottom: 0; }
.required_legend { font-style: italic; }
.required_legend::before, .required::after { content: "* "; color: var(--red); }
.required::after { content: " *"; }
label.checkbox { font-weight: 400; color: var(--text); display: block; padding-top: 6px; }
label.checkbox input { margin-right: 8px; }
.reg-form { max-width: 560px; }

/* ---- Tournament lists ---- */
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 20px; padding: 10px 0; margin: 0; border-bottom: 1px solid var(--line); }
.event-list .when { color: var(--muted); font-size: 14px; white-space: nowrap; }
.event-cards { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 8px; }
/* the original "panel": purple frame, square corners, soft shadow on hover */
.event-card {
  flex: 1 1 300px; max-width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 22px 26px; color: var(--text);
  background: #fff; border: 1px solid var(--purple); transition: box-shadow .4s;
}
.event-card:hover, .event-card:focus { box-shadow: 5px 0 40px rgba(0, 0, 0, .15); color: var(--text); text-decoration: none; }
.event-card h3 { margin: 0 0 4px; font-size: 20px; }
.event-card .when { color: var(--ink); font-weight: 700; }
.event-card .btn { align-self: flex-start; margin-top: 14px; }

/* ---- Footer ---- */
.um-footer {
  padding: 18px var(--pad-x); background: var(--green); color: #fff; font-size: 13px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px;
}
.um-footer a { color: #fff; }
.um-footer a:hover { color: #fff; text-decoration: underline; }
.um-footer .sep { padding: 0 8px; opacity: .7; }
.um-credits { flex: 1 1 100%; font-size: 12px; opacity: .85; }

[id] { scroll-margin-top: calc(var(--nav-h) + 10px); }

/* ---- Admin pages (tournaments) ---- */
.um-page.wide { max-width: 1400px; }
.um-nav:has(+ .um-page.wide) { max-width: 1400px; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.admin-edit { background: var(--grey-bg); padding: 18px 22px 8px; margin-bottom: 22px; }
.admin-edit h3 { margin-top: 0; }
.admin-actions { margin: 16px 0 10px; }
.admin-table { font-size: 13px; }
.admin-table td.wrap { white-space: normal; min-width: 14em; max-width: 22em; }
.admin-table td, .admin-table th { white-space: nowrap; vertical-align: middle; }
.admin-table form { margin: 0; }
.nowrap { white-space: nowrap; }
.mono { font-family: Menlo, Consolas, monospace; font-size: 13px; }

/* ---- Home page ---- */
/* banner: the shield next to the club name, as on the original home page */
.um-hero-home .um-hero-inner { display: flex; align-items: center; justify-content: center; gap: 36px; padding: 56px 34px 40px; text-align: left; flex-wrap: wrap; }
.um-hero-logo { width: 140px; height: auto; flex: none; }
.um-hero-home h1 { font-size: 64px; line-height: 1.02; text-transform: uppercase; }
.um-hero-kicker { display: block; margin: 0 0 8px; font: 400 12px/1.4 Montserrat, sans-serif; letter-spacing: 4px; text-transform: uppercase; color: var(--ink); }
.um-hero-home .um-sublinks { justify-content: flex-start; margin-left: -12px; }
.um-hero-cta { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
/* next tournament: one quiet line under the banner */
.um-next { padding: 14px var(--pad-x); background: var(--grey-bg); border-bottom: 1px solid var(--line); }
.um-next-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.um-tag { font: 400 11px/1.6 Montserrat, sans-serif; letter-spacing: 3px; text-transform: uppercase; color: var(--purple-dark); }
.um-next-what { color: var(--ink); }
.um-actions { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.um-photo { display: block; width: 100%; }
.news-poster { display: block; width: 100%; max-width: 340px; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); }
.um-news-title { margin-top: 0; }
.um-links { list-style: none; margin: 0; padding: 0; columns: 2 300px; column-gap: 40px; }
.um-links li { break-inside: avoid; margin: 0 0 14px; }
.um-links li a { font-weight: 700; }
.um-intro { max-width: 760px; }
.practice-cards { display: flex; flex-wrap: wrap; gap: 24px; }
.practice-card { flex: 1 1 260px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--purple); transition: box-shadow .4s; }
.practice-card:hover { box-shadow: 5px 0 40px rgba(0, 0, 0, .15); }
.practice-card img { width: 100%; display: block; }
.practice-card .body { padding: 16px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.practice-card .body h3 { margin: 0 0 6px; }
.practice-card .body p { flex: 1; }
.practice-card .btn { align-self: flex-start; }

/* ---- Tablets and phones ---- */
@media (max-width: 1060px) {
  .um-nav, .um-page { max-width: none; }
}
@media (max-width: 860px) {
  .um-nav-toggle { display: block; }
  .um-nav ul { display: none; flex-basis: 100%; flex-direction: column; padding-bottom: 8px; }
  .um-nav-inner.open ul { display: flex; }
  .um-nav ul a { line-height: 44px; }
}
@media (max-width: 767px) {
  :root { --pad-x: 18px; --pad-y: 30px; }
  .um-nav-inner { padding: 0 12px; }
  h1, .um-hero h1 { font-size: 30px; }
  .um-hero.compact h1 { font-size: 24px; }
  h2 { font-size: 20px; margin-bottom: 18px; }
  .um-hero-inner { padding: 44px 18px 28px; }
  .um-hero-home .um-hero-inner { flex-direction: column; text-align: center; gap: 18px; }
  .um-hero-home h1 { font-size: 40px; }
  .um-hero-logo { width: 96px; }
  .um-hero-home .um-sublinks, .um-hero-cta { justify-content: center; margin-left: 0; }
  .um-footer { flex-direction: column; text-align: center; }
  .btn-lg { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .event-card, .practice-card { transition: none; }
}
.um-links li > span { display: block; color: var(--muted); font-size: 15px; }

/* Photo banners (tournament pages): the tiles photo is busy, so a stronger veil and heavier small text */
.um-hero-photo .um-hero-inner { background: rgba(255, 255, 255, .74); }
.um-hero-photo h1 { color: #000; }
.um-hero-photo .lead, .um-hero-photo p { font-weight: 500; color: #1a1a1a; }
.um-hero-photo .um-sublinks a { font-weight: 600; color: #1a1a1a; }
