/* crossframed: crosslink's newspaper puzzle page (light grey desk, Aqua controls, cartoon helper), with a
   press photo printed beside the grid. The photo starts out of focus and sharpens as answers go in. */
:root {
  --desk: #f3f3f3;
  --page: #ffffff;
  --ink: #0b0b0b;
  --ink-soft: #55585e;
  --rule: #111111;
  --hair: #c9ccd2;
  --word: #e8f1fd;
  --cross: #f4f8fe;
  --cursor: #d4f000;
  --link: #2961f6;
  /* solved-answer colours. Sky, gold and silver are a shade deeper than their swatches so the letters stay
     readable on white (3:1 or better for the bold grid letters) */
  --c-green: #2fa85d;
  --c-red: #ec1212;
  --c-blue: #2a78e4;
  --c-gold: #b48c1c;
  --c-forest: #217a1a;
  --c-orange: #df6c16;
  --c-sky: #3d9be0;
  --c-silver: #8996a6;
  --shimmer: linear-gradient(135deg, #0d47a1, #42a5f5, #90e0ef, #0077b6, #0d47a1);
  --f-sans: Arial, Helvetica, sans-serif;
  --f-heavy: "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mac: "Lucida Grande", "Lucida Sans Unicode", "Myriad Pro", Helvetica, Arial, sans-serif;
  --f-clue: Georgia, "Times New Roman", serif;
  --f-mono: Monaco, Menlo, ui-monospace, monospace;
  --f-dot: "Doto", Monaco, monospace;
  --f-comic: "Comic Neue", "Comic Sans MS", "Chalkboard SE", sans-serif;
  color-scheme: light;
}
[hidden] { display: none !important; }
body {
  background: var(--desk); color: var(--ink);
  font: 15px/1.45 var(--f-sans);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 22px 40px;
  margin: 0;
}
.wrap { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* ---------- masthead ---------- */
.mast { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.wm { display: flex; align-items: center; gap: 10px; margin-right: auto; font: 400 34px/1 var(--f-sans); letter-spacing: -.02em; }
.sq { width: 22px; height: 22px; background-image: var(--shimmer); background-size: 300% 300%; animation: sq-shimmer 8s ease-in-out infinite; }
.wm .cross { color: var(--ink); }
.wm .link {
  color: transparent; -webkit-text-stroke: 1.2px var(--ink);
  background-image: var(--shimmer); background-size: 300% 300%; -webkit-background-clip: text; background-clip: text;
  animation: sq-shimmer 11s ease-in-out infinite;
}
@keyframes sq-shimmer { 0%, 100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { font: 12px var(--f-mac); padding: 4px 11px; border: 1px solid var(--rule); background: var(--page); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill b { font-weight: normal; color: var(--ink-soft); margin-right: 5px; }
.dateline { width: 100%; margin: 0; padding-top: 8px; border-top: 3px double var(--rule); font: 12px var(--f-mono); color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 18px; }
.dateline span:last-child { margin-left: auto; font-family: var(--f-clue); font-style: italic; font-size: 13px; }

/* ---------- the printed page ---------- */
.page { background: var(--page); border: 1px solid var(--rule); position: relative; overflow: hidden; }
.phead { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px 12px; border-bottom: 1px solid var(--rule); }
.pnum { flex: none; min-width: 40px; height: 40px; padding: 0 6px; box-sizing: border-box; display: grid; place-items: center; background: var(--ink); color: #fff; font: 900 22px/1 var(--f-heavy); }
.ptitle { margin: 0; font: 900 22px/1.1 var(--f-heavy); letter-spacing: -.6px; text-transform: uppercase; color: #363534; -webkit-text-stroke: .4px #363534; filter: url(#ink-bleed); }
.ptitle small { font: 400 13px var(--f-sans); text-transform: none; letter-spacing: 0; color: var(--ink-soft); -webkit-text-stroke: 0; margin-left: 6px; }
.pnote { margin: 4px 0 0; font: italic 14px/1.4 var(--f-clue); color: #333; }

.pbody { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); border-bottom: 1px solid var(--rule); }
.play { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; border-right: 1px solid var(--rule); }
.cluebar { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; background: var(--word); border: 1px solid #a8c4ea; min-height: 44px; box-sizing: border-box; }
.cluebar .tag { font: 700 12px/20px var(--f-sans); color: #fff; background: var(--wc, var(--ink)); padding: 0 6px; white-space: nowrap; }
.cluebar .txt { font: 17px/1.3 var(--f-clue); }

/* ---------- freeform grid: only answer squares are printed, the rest is paper ---------- */
.gridwrap { position: relative; align-self: center; width: min(100%, 420px); }
.grid { display: grid; user-select: none; -webkit-user-select: none; filter: drop-shadow(4px 4px 0 rgba(11,11,11,.13)); }
.void { aspect-ratio: 1; }
.cell {
  position: relative; aspect-ratio: 1; background: var(--page); cursor: pointer; display: grid; place-items: center; overflow: hidden;
  /* a 2px outline centred on each edge, so neighbouring squares share one crisp rule */
  outline: 2px solid var(--ink); outline-offset: -1px;
}
.cell.inword { background: var(--word); }
.cell.sel { background: var(--cursor); }
.cell .num { position: absolute; top: 3px; left: 4px; font: 700 10px/1 var(--f-sans); z-index: 2; }
.cell .ltr { position: relative; z-index: 2; font: 700 clamp(20px, 6vw, 30px)/1 var(--f-sans); margin-top: 8%; }
.cell.solved .ltr { color: var(--lc); }
.cell .bar-a, .cell .bar-d { position: absolute; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .3s; }
.cell.sa .bar-a, .cell.sd .bar-d { transition-delay: var(--bd, 0s); opacity: 1; }
.cell .bar-a { left: 5px; right: 5px; bottom: 4px; height: 3px; background: var(--ca); }
.cell .bar-d { top: 5px; bottom: 5px; right: 4px; width: 3px; background: var(--cd); }
.cell::before {
  content: ""; position: absolute; inset: 0; z-index: 1; opacity: 0; pointer-events: none;
  background-image: var(--shimmer); background-size: 300% 300%;
}
.cell.shim::before { animation: cell-flash .95s ease-in-out var(--d, 0s) both; }
.cell.shim .ltr {
  color: transparent;
  background-image: linear-gradient(100deg, var(--ink) 0 30%, #ffffff 42%, #90e0ef 48%, #ffffff 54%, var(--lc) 66% 100%);
  background-size: 320% 100%; -webkit-background-clip: text; background-clip: text;
  animation: ltr-shim .95s ease-in-out var(--d, 0s) both;
}
@keyframes cell-flash { 0% { opacity: 0; background-position: 0% 0%; } 35% { opacity: 1; } 70% { opacity: .9; } 100% { opacity: 0; background-position: 100% 100%; } }
@keyframes ltr-shim { 0% { background-position: 0% 0; transform: scale(1); } 45% { transform: scale(1.18); } 100% { background-position: 100% 0; transform: scale(1); } }
/* a filled letter the solver just retyped gets a small nod */
.cell.echo .ltr { animation: echo .35s ease-out; }
@keyframes echo { 40% { transform: scale(1.2); } }
#kb { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; border: 0; padding: 0; }
.hint { font: 11px/1.5 var(--f-mono); color: var(--ink-soft); text-align: center; text-wrap: balance; }
.grid.nudge, .guess.nudge { animation: shake .4s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- the press photo ---------- */
.face { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; background: #fafafa; }
.photo { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.frame {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: #eef3f8;
  border: 1px solid var(--rule); box-shadow: 0 0 0 5px var(--page), 0 0 0 6px var(--rule), 6px 6px 0 6px rgba(11,11,11,.13);
  margin: 6px;
}
.frame img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--fx, 50%) var(--fy, 30%);
  filter: url(#liquid) blur(var(--blur, 36px)) grayscale(var(--gray, .6)) brightness(var(--bright, 1.15)) contrast(var(--contrast, .9));
  transform: scale(var(--zoom, 1.18)); transform-origin: var(--fx, 50%) var(--fy, 30%);
  transition: filter 1.4s cubic-bezier(.3,.7,.2,1), transform 1.6s cubic-bezier(.3,.7,.2,1);
}
/* a light, fluid shimmer veil: pale pools of light drifting over the photo, thinning as it sharpens */
.frame .veil {
  position: absolute; inset: 0; pointer-events: none; opacity: var(--veil, .9); transition: opacity 1.4s;
  overflow: hidden; mix-blend-mode: screen;
}
.frame .veil::before, .frame .veil::after {
  content: ""; position: absolute; inset: -40%; filter: blur(18px);
}
.frame .veil::before {
  background:
    radial-gradient(40% 35% at 30% 30%, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(35% 40% at 70% 60%, rgba(186,224,255,.8), transparent 70%),
    radial-gradient(30% 30% at 45% 80%, rgba(230,215,255,.7), transparent 70%),
    radial-gradient(45% 30% at 80% 20%, rgba(200,255,240,.6), transparent 70%);
  animation: veil-drift 16s ease-in-out infinite alternate;
}
.frame .veil::after {
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 48%, rgba(220,240,255,.35) 52%, transparent 65%);
  background-size: 250% 250%;
  animation: veil-sheen 6s ease-in-out infinite;
}
@keyframes veil-drift {
  0%   { transform: translate(-4%, -3%) rotate(0deg) scale(1); }
  50%  { transform: translate(5%, 4%) rotate(25deg) scale(1.1); }
  100% { transform: translate(-3%, 6%) rotate(-15deg) scale(1.05); }
}
@keyframes veil-sheen { 0% { background-position: 100% 100%; } 100% { background-position: 0% 0%; } }
@media (prefers-reduced-motion: reduce) {
  .frame .veil::before, .frame .veil::after { animation: none; }
}
.frame .flash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background-image: var(--shimmer); background-size: 300% 300%; mix-blend-mode: color;
}
.frame.flashing .flash { animation: cell-flash 1.2s ease-in-out both; }
.frame { container-type: inline-size; }
.lens {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 7px; background: var(--ink); color: #fff;
  font: 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
}
.photo figcaption { display: grid; gap: 2px; padding: 4px 6px 0; }
.kicker { font: 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
#who { font: 900 22px/1.1 var(--f-heavy); letter-spacing: -.4px; }
.photo.revealed #who { animation: name-in .8s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes name-in { 0% { opacity: 0; transform: translateY(6px) scale(.96); } 100% { opacity: 1; transform: none; } }
.photo figcaption .line { font: italic 14px/1.4 var(--f-clue); color: #333; }
.photo figcaption .more {
  justify-self: start; margin-top: 4px; font: 12px var(--f-mono); letter-spacing: .04em; color: var(--link);
  text-decoration: underline; text-underline-offset: 3px; animation: name-in .8s .25s cubic-bezier(.2,.9,.3,1.3) both;
}
.photo figcaption .more:hover { color: var(--ink); }

.meter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 0 6px; }
.meter i { height: 8px; border: 1px solid var(--rule); background: var(--page); transition: background .4s; }
.meter i.on { background: var(--mc); }

.guess { display: grid; gap: 6px; padding: 0 6px; }
.guess label { font: 13px/1.35 var(--f-clue); font-style: italic; color: #333; }
.guess-row { display: flex; gap: 8px; }
.guess input {
  flex: 1; min-width: 0; font: 15px var(--f-mac); padding: 5px 9px; border: 1px solid #8a8a8a; border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.18); background: #fff;
}
.guess input:focus { outline: 3px solid rgba(41,97,246,.45); outline-offset: 0; border-color: #3b7be0; }
.guess-note { margin: 0; min-height: 1.4em; font: 12px/1.4 var(--f-mono); color: var(--ink-soft); }
.guess-note .x { color: #c62f1e; }
.spotted { margin: 0 6px; padding: 10px 12px; border: 1px solid var(--rule); background: var(--page); display: flex; gap: 10px; align-items: center; font: 13px/1.35 var(--f-mac); }
.spotted .stamp { flex: none; font: 900 22px/1 var(--f-dot); padding: 4px 6px; background: var(--ink); color: var(--cursor); }
.credit { margin: 0 6px; font: 10px/1.4 var(--f-mono); color: var(--ink-soft); }

/* ---------- clues + cartoon ---------- */
.lower { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.clues { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 22px; padding: 16px 20px 18px; border-right: 1px solid var(--rule); align-content: start; }
.clues h3 { margin: 0 0 6px; font: 900 13px var(--f-heavy); letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--rule); padding-bottom: 3px; }
.clues ol { list-style: none; margin: 0 0 12px; padding: 0; }
.clues li { display: grid; grid-template-columns: 22px 1fr; column-gap: 4px; padding: 4px 6px 4px 2px; font: 14px/1.35 var(--f-clue); cursor: pointer; border-radius: 3px; }
.clues li .n { font: 700 13px/1.45 var(--f-sans); text-align: right; }
.clues li.cur { color: #fff; background: linear-gradient(#6aa7ee, #3c7fd8); text-shadow: 0 -1px 0 rgba(0,0,0,.15); }
.clues li.cross { background: var(--word); }
.clues li .ans { grid-column: 2; font: 700 11px var(--f-sans); letter-spacing: .1em; margin-top: 2px; color: var(--wc); }
.clues li .ans:empty { display: none; }
.clues li.cur .ans { color: #fff; }
.clues li .fact { grid-column: 2; font: 12px/1.4 var(--f-sans); color: var(--ink-soft); margin-top: 2px; }
.clues li .fact:empty { display: none; }
.clues li.cur .fact { color: #e6efff; }

.assist { display: flex; align-items: center; gap: 18px; padding: 16px 20px 18px; background: #fafafa; }
.gramps { flex: none; width: 112px; height: auto; }
.assist-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bubble {
  position: relative; background: var(--page); border: 2.5px solid var(--ink); border-radius: 24px;
  padding: 9px 14px 10px; font: 700 15px/1.25 var(--f-comic); color: var(--ink);
}
.bubble::before, .bubble::after { content: ""; position: absolute; border-style: solid; transform: rotate(-18deg); }
.bubble::before { left: -19px; bottom: 10px; border-width: 9px 20px 9px 0; border-color: transparent var(--ink) transparent transparent; }
.bubble::after { left: -13px; bottom: 12px; border-width: 6px 15px 6px 0; border-color: transparent var(--page) transparent transparent; }
.bubble button { font: inherit; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.bubble button:hover { color: var(--c-red); }
.bubble button:focus-visible { outline: 3px solid rgba(41,97,246,.5); outline-offset: 2px; }
.mode-cap { margin: 0; font: 11px/1.4 var(--f-mono); color: var(--ink-soft); }
.assist.nudge .bubble { animation: wiggle .5s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }

/* ---------- sheet (spotted / solved) ---------- */
.sheet {
  position: absolute; left: 50%; top: 0; z-index: 5; width: min(460px, calc(100% - 24px)); transform: translate(-50%, -110%);
  background: #f5f5f5; border: 1px solid #7d7d7d; border-top: 0; border-radius: 0 0 8px 8px;
  transition: transform .45s cubic-bezier(.2,.9,.3,1); overflow: hidden; visibility: hidden;
}
.sheet.open { transform: translate(-50%, 0); visibility: visible; box-shadow: 0 14px 34px rgba(0,0,0,.3); }
.sheet .banner { background-image: var(--shimmer); background-size: 300% 300%; animation: sq-shimmer 8s ease-in-out infinite; }
.sheet canvas { display: block; width: 100%; height: 130px; }
.sheet .body { padding: 14px 18px 16px; display: grid; gap: 8px; }
.sheet h2 { margin: 0; font: 600 24px var(--f-mac); letter-spacing: -.5px; }
.sheet p { margin: 0; font: 13px/1.45 var(--f-mac); color: #333; }
.sheet .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.aqua { font: 12px var(--f-mac); color: #1f1f1f; cursor: pointer; padding: 4px 16px; border-radius: 13px; border: 1px solid #848484; background: linear-gradient(#ffffff, #ececec 50%, #dadada 51%, #f2f2f2); box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(0,0,0,.2); }
.aqua.primary { color: #fff; border-color: #2a62b5; text-shadow: 0 -1px 0 rgba(0,0,0,.25); background: linear-gradient(#c3e2ff, #6db3f6 50%, #3b8cee 51%, #8ccfff); }
.aqua:focus-visible, .foot button:focus-visible { outline: 3px solid rgba(41,97,246,.5); outline-offset: 1px; }

/* ---------- weeks: dateline links, the archive notice, the archive ---------- */
.dl-nav { display: inline-flex; gap: 14px; }
.dl-nav a, .notice a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.dl-nav a:hover, .notice a:hover { color: var(--ink); }
.notice {
  margin: 0; padding: 9px 14px; border: 1px solid var(--rule); background: var(--cross);
  font: italic 14px/1.4 var(--f-clue); box-shadow: 4px 4px 0 rgba(11,11,11,.13);
}
.notice a { font: 12px var(--f-mono); font-style: normal; white-space: nowrap; }
.archive { border-top: 3px double var(--rule); padding-top: 10px; scroll-margin-top: 16px; }
.archive h2 { margin: 0 0 12px; font: 900 20px/1.1 var(--f-heavy); letter-spacing: -.3px; }
.weeks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.wk {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 12px 14px;
  background: var(--page); border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
  box-shadow: 4px 4px 0 rgba(11,11,11,.13); transition: transform .15s, box-shadow .15s;
}
.wk:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 rgba(11,11,11,.16); }
.wk .pnum { grid-row: span 3; align-self: start; }
.wk .when { font: 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.wk .t { font: 700 15px/1.25 var(--f-sans); }
.wk .st { font: italic 13px var(--f-clue); color: var(--ink-soft); }
.wk.done .st { color: var(--c-forest); font-style: normal; font-weight: 700; }
.wk.done .st::before { content: "✓ "; }
.wk.going .st { color: var(--c-orange); }
.wk[aria-current="page"] { background: var(--word); outline: 3px solid var(--link); outline-offset: -1px; }

/* ---------- footer + toast ---------- */
.foot { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: #555; }
.foot .sp { margin-right: auto; }
.foot button { font: inherit; background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; z-index: 10;
  display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px);
  background: var(--page); color: var(--ink); border: 1px solid var(--rule); padding: 8px 14px 8px 8px; font-size: 13px;
  box-shadow: 4px 4px 0 var(--wc, var(--link)); pointer-events: none; transition: .3s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .sq { width: 18px; height: 18px; flex: none; }
.toast b { font: 900 13px var(--f-heavy); letter-spacing: .06em; }

@media (max-width: 760px) {
  .pbody, .lower { grid-template-columns: minmax(0, 1fr); }
  .play { border-right: 0; border-bottom: 1px solid var(--rule); }
  /* on a phone the photo sits small above the grid, with the guess box beside it */
  .face { order: -1; display: grid; grid-template-columns: 124px minmax(0, 1fr); align-items: start; gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
  .face > * { min-width: 0; }
  .photo { grid-row: span 4; }
  .frame { margin: 4px; box-shadow: 0 0 0 3px var(--page), 0 0 0 4px var(--rule), 4px 4px 0 4px rgba(11,11,11,.13); }
  .photo figcaption { padding: 4px 0 0; }
  .photo figcaption .kicker, .photo figcaption .line { display: none; }
  #who { font-size: 15px; }
  .guess-row .aqua { padding-inline: 12px; }
  .meter, .guess, .credit, .spotted { padding: 0; margin: 0; }
  .clues { border-right: 0; border-bottom: 1px solid var(--rule); }
  .dateline span:last-child { margin-left: 0; }
  .wm { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
