/* Justin Benner: Ink Links, the putting game at /play/
   Shares the main site's fonts and palette; everything else is local to this page. */

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../assets/fonts/playfair-display-900.woff2) format('woff2');
}

@font-face {
  font-family: 'Rock Salt';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/rock-salt.woff2) format('woff2');
}

@font-face {
  font-family: 'Special Elite';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/special-elite.woff2) format('woff2');
}

:root {
  --ink: #17130F;
  --cream: #F2EDE3;
  --paper: #FBF8F2;
  --red: #C4161C;
  --orange: #F0592A;
  --green: #6FAF86;
  --grey-dark: #4A433B;

  --font-body: 'Special Elite', 'Courier New', monospace;
  --font-hand: 'Rock Salt', cursive;
  --font-display: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 8%, rgba(240, 89, 42, 0.35), transparent 45%),
    radial-gradient(circle at 4% 96%, rgba(43, 176, 214, 0.25), transparent 40%),
    var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--ink); }
a:hover { color: var(--red); }

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: 0;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-120%);
}
.skip-link:focus { transform: none; color: var(--cream); }

/* ----- Header ----- */

.lk-head {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 8px;
  text-align: center;
}

.lk-back {
  display: block;
  width: max-content;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 14px;
  font-size: 14px;
  letter-spacing: 0.06em;
}

.lk-kicker {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 10px;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--red);
  transform: rotate(-1.5deg);
}

.lk-title {
  margin: 6px 0 0;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(40px, 11vw, 64px);
  line-height: 1.15;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-2deg);
}

.lk-sub {
  margin: 4px 0 0;
  font-size: 15px;
}

/* ----- Game card ----- */

.lk-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.lk-card {
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  padding: 12px;
}

.lk-score {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 2px solid var(--ink);
  margin-bottom: 12px;
}

.lk-score__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 4px;
  border-left: 2px solid var(--ink);
}
.lk-score__cell:first-child { border-left: 0; }

.lk-score__label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lk-score__value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
  line-height: 1.1;
  color: var(--red);
}

.lk-stage {
  position: relative;
}

.lk-canvas {
  display: block;
  width: 100%;
  height: auto;
  /* keep the whole green on screen: the header and scorecard take about 360px */
  max-width: max(260px, calc((100vh - 360px) / 1.5));
  max-width: max(260px, calc((100dvh - 360px) / 1.5));
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  border: 2px solid var(--ink);
  background: var(--cream);
  touch-action: none;           /* drags aim the putt instead of scrolling */
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
}

/* ----- Result card (laid over the green) ----- */

.lk-result {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(90%, 340px);
  padding: 18px 18px 20px;
  background: #F1E2A8;
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  text-align: center;
  transform: translate(-50%, -50%) rotate(-2deg);
}
.lk-result[hidden] { display: none; }

.lk-result__stamp {
  display: inline-block;
  margin: 0;
  padding: 2px 12px;
  border: 3px solid var(--red);
  color: var(--red);
  font-family: var(--font-hand);
  font-size: 20px;
  transform: rotate(-6deg);
}

.lk-result__title {
  margin: 10px 0 4px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 30px;
  line-height: 1.1;
}

.lk-result__text {
  margin: 0 0 10px;
}

/* One square per stroke, like the share text */
.lk-result__card {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: 2px;
  line-height: 1.3;
  word-break: break-all;
}

.lk-result__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.lk-result__note {
  margin: 14px 0 0;
  font-size: 13px;
}

.lk-today {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--grey-dark);
}

.lk-btn {
  appearance: none;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
  box-shadow: 4px 4px 0 var(--red);
  cursor: pointer;
}
.lk-btn:hover { background: var(--red); box-shadow: 4px 4px 0 var(--ink); }

.lk-btn--paper {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.lk-btn--paper:hover { background: var(--cream); color: var(--red); }

.lk-help {
  margin: 12px 2px 0;
  font-size: 14px;
  line-height: 1.6;
}

.lk-foot {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  font-size: 13px;
  text-align: center;
}
