:root {
  --ink: #111;
  --paper: #fff;
  --muted: #5c5c5c;
  --rule: #111;
  --hairline: #d6d6d6;
  --display: 'DM Serif Display', Didot, 'Bodoni MT', Georgia, serif;
  --text: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  --gutter: 16px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

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

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 0;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4.25rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Masthead ---------- */

.masthead {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px var(--gutter) 0;
  text-align: center;
}

.ticker {
  display: flex;
  align-items: stretch;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow: hidden;
}

.ticker-live {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.ticker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  animation: blink 1.1s steps(1) infinite;
}

.ticker-window {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 38s linear infinite;
}

.ticker:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-group {
  display: flex;
}

.ticker-item {
  white-space: nowrap;
  padding: 0 22px;
}

.ticker-item::after {
  content: '◆';
  margin-left: 44px;
  font-size: 0.6rem;
  vertical-align: 1px;
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.masthead-title {
  display: block;
  padding: 18px 0 14px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.75rem, 10vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.masthead-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 32px;
  padding: 10px 0;
  border-top: 3px double var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 1.05rem;
  font-weight: 500;
}

.masthead-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 0;
}

/* ---------- Menu icons ---------- */

.ico {
  width: 30px;
  height: 30px;
  flex: none;
  overflow: visible;
}

.ico g {
  transform-box: fill-box;
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.ico-steam {
  opacity: 0;
}

.ico-lid {
  transform-origin: 0% 100%;
}

.ico-fork {
  transform-origin: 50% 100%;
}

.ico-knife {
  transform-origin: 50% 100%;
}

.masthead-nav a:hover .ico-lid,
.masthead-nav a:focus-visible .ico-lid,
.masthead-nav a[aria-current='page'] .ico-lid {
  transform: translate(2px, -4px) rotate(-22deg);
}

.masthead-nav a:hover .ico-fork,
.masthead-nav a:focus-visible .ico-fork,
.masthead-nav a[aria-current='page'] .ico-fork {
  transform: rotate(14deg);
}

.masthead-nav a:hover .ico-knife,
.masthead-nav a:focus-visible .ico-knife,
.masthead-nav a[aria-current='page'] .ico-knife {
  transform: rotate(-14deg);
}

.masthead-nav a:hover .ico-plate,
.masthead-nav a:focus-visible .ico-plate {
  animation: wobble 0.5s ease-in-out;
}

.masthead-nav a:hover .ico-cup,
.masthead-nav a:focus-visible .ico-cup {
  animation: wobble 0.5s ease-in-out;
}

.masthead-nav a:hover .ico-steam,
.masthead-nav a:focus-visible .ico-steam,
.masthead-nav a[aria-current='page'] .ico-steam {
  animation: steam 1.4s ease-in-out infinite;
}

@keyframes steam {
  0% {
    opacity: 0;
    transform: translateY(3px);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes wobble {
  25% {
    transform: rotate(-8deg);
  }
  75% {
    transform: rotate(8deg);
  }
}

/* ---------- Drooling face ---------- */

.with-face {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.drool {
  width: 1.4em;
  height: auto;
  flex: none;
  overflow: visible;
}

.drool-strand,
.drool-drop {
  transform-box: fill-box;
}

.drool-strand {
  transform-origin: 50% 0%;
  animation: drool-strand 2.4s ease-in infinite;
}

.drool-drop {
  transform-origin: 50% 0%;
  animation: drool-drop 2.4s ease-in infinite;
}

@keyframes drool-strand {
  0% {
    transform: scaleY(0.2);
  }
  70% {
    transform: scaleY(1.3);
  }
  71%,
  100% {
    transform: scaleY(0.2);
  }
}

@keyframes drool-drop {
  0% {
    transform: translateY(-7px) scale(0.6);
    opacity: 1;
  }
  70% {
    transform: translateY(3px) scale(1);
    opacity: 1;
  }
  95% {
    transform: translateY(16px) scale(1);
    opacity: 0;
  }
  100% {
    transform: translateY(-7px) scale(0.6);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track,
  .ticker-dot,
  .drool-strand,
  .drool-drop,
  .ico,
  .ico * {
    animation: none !important;
  }
  .ico-steam {
    opacity: 1;
  }
}

.masthead-nav a:hover,
.masthead-nav a[aria-current='page'] {
  text-decoration: underline;
}

/* ---------- Common blocks ---------- */

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section {
  padding: 56px 0 24px;
}

.section.narrow {
  max-width: 640px;
  margin: 0 auto;
}

.section-head {
  text-align: center;
  margin-bottom: 36px;
}

.section-sub {
  margin: 16px auto 0;
  max-width: 34em;
  color: var(--muted);
}

.section-more {
  margin-top: 40px;
  text-align: center;
  font-weight: 500;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
}

.nowrap {
  white-space: nowrap;
}

.small {
  font-size: 0.85rem;
}

/* ---------- Buttons & forms ---------- */

.btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 12px 28px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn:hover,
.btn[aria-pressed='true'],
.btn-solid {
  background: var(--ink);
  color: var(--paper);
}

.btn-solid:hover {
  background: #333;
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.75rem;
}

.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.exam .btn:disabled {
  cursor: default;
  opacity: 0.3;
}

.exam .btn:disabled:not([aria-pressed='true']) {
  background: var(--paper);
  color: var(--ink);
}

.exam .btn[aria-pressed='true']:disabled {
  opacity: 1;
}

.form {
  display: grid;
  gap: 22px;
}

.form label {
  display: grid;
  gap: 6px;
}

.form label > span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.form small {
  color: var(--muted);
  font-size: 0.85rem;
}

.form input,
.form textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 8px 0;
  width: 100%;
}

.form textarea {
  border: 1px solid var(--ink);
  padding: 10px 12px;
  resize: vertical;
}

.form input[type='file'] {
  border: 1px dashed var(--ink);
  padding: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.form .btn {
  justify-self: start;
}

.form progress {
  width: 100%;
  height: 6px;
  accent-color: var(--ink);
}

.hp {
  position: absolute;
  left: -9999px;
}

.notice {
  border: 1px solid var(--ink);
  padding: 12px 16px;
  margin: 0 0 22px;
}

.notice-ok {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Entrance exam ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-top: 56px;
}

.hero-figure {
  margin: 0;
}

.glutton {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  margin: 0 auto;
}

.hero-figure figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.exam {
  margin: 6px;
  padding: 40px 24px 36px;
  border: 1px solid var(--rule);
  outline: 1px solid var(--rule);
  outline-offset: 5px;
  text-align: center;
}

.exam-intro {
  margin: 0 auto 24px;
  max-width: 30em;
  color: var(--muted);
}

.exam-question {
  font-size: clamp(1.9rem, 5.5vw, 3rem);
}

.exam-options {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}

.exam-options .btn {
  min-width: 120px;
}

.exam-result {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}

.exam-mark {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.exam-reply {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* ---------- Dispatches ---------- */

.dispatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 48px 32px;
}

.dispatch-media {
  margin: 0 0 14px;
  aspect-ratio: 4 / 5;
  background: #f2f2f2;
  overflow: hidden;
}

.dispatch-media img,
.dispatch-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.dispatch-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dispatch-place {
  font-size: 1.85rem;
  margin: 10px 0 8px;
}

.dispatch-verdict {
  margin: 0 0 8px;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.3;
}

.label {
  font-family: var(--text);
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-right: 4px;
}

.dispatch-damage {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
}

.leader {
  flex: 1;
  border-bottom: 1px dotted var(--ink);
  transform: translateY(-4px);
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-weight: 500;
}

/* ---------- Admin ledger ---------- */

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledger li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}

.ledger-thumb {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: #f2f2f2;
  text-decoration: none;
  overflow: hidden;
}

.ledger-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ledger-text {
  display: grid;
  min-width: 0;
  font-size: 1rem;
}

.ledger-text span {
  color: var(--muted);
  font-size: 0.9rem;
}

.logout {
  margin-top: 32px;
  text-align: right;
}

/* ---------- Footer ---------- */

.colophon {
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(1120px - 2 * var(--gutter));
  margin: 72px auto 0;
  padding: 18px 0 40px;
  border-top: 3px double var(--rule);
  text-align: center;
  font-size: 0.9rem;
}

.colophon p {
  margin: 0 0 4px;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
  }
  .glutton {
    max-width: 380px;
  }
}

@media (max-width: 560px) {
  .masthead-nav {
    gap: 2px 18px;
    font-size: 0.95rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .exam {
    padding: 32px 16px 28px;
  }
}
