/* Today in Psychology: the homepage band, Word of the Day and Good News. */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.text-button { padding: .35rem 0; border: 0; background: none; color: var(--blue); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }
.text-button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Homepage band */
.today-band { margin: 1.7rem 0 .2rem; }
.today-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; margin-bottom: .8rem; }
.today-head h2 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: clamp(1.5rem, 3vw, 1.85rem); letter-spacing: -.015em; }
.today-date { margin: 0; color: var(--muted); font-size: .92rem; font-weight: 700; }
.today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.today-grid-single { grid-template-columns: minmax(0, 1fr); }
.today-tile { position: relative; display: flex; flex-direction: column; gap: .55rem; min-width: 0; min-height: 12rem; padding: 1.35rem 1.4rem; overflow: hidden; border: 1px solid var(--line); border-radius: .65rem; background: var(--white); transition: box-shadow .15s ease, border-color .15s ease; }
.today-tile:hover { border-color: #9fb3c8; box-shadow: 0 8px 22px rgb(23 42 69 / 9%); }
.today-tile:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
.today-tile h3 { margin: 0; color: var(--navy); font-size: 1.15rem; line-height: 1.3; }
.today-tile > p { margin: 0; }
.today-tile-text { color: var(--muted); }
.today-tile .card-action { margin-top: auto; color: var(--blue); font-weight: 750; text-decoration: none; }
.today-tile .card-action::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* the whole tile opens it */
.today-tile .card-action:focus-visible { outline: none; }
.today-kicker { margin: 0; color: #b21f2d; font-size: .77rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.today-streak { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; margin: 0; color: var(--navy); font-weight: 750; }
.today-streak[hidden] { display: none; }
.streak-dots { display: inline-flex; gap: .22rem; }
.streak-dots i { width: .55rem; height: .55rem; border: 1.5px solid #9fb3c8; border-radius: 50%; }
.streak-dots i.on { border-color: var(--navy); background: var(--gold); }
.word-preview { display: flex; flex-wrap: wrap; gap: .3rem; }
.word-preview span { position: relative; width: 1.75rem; height: 1.95rem; border: 2px solid var(--line); border-radius: .35rem; }
.word-preview.is-solved span { border-color: var(--navy); background: var(--navy); }
.word-preview.is-solved span::after { content: ""; position: absolute; right: 25%; bottom: 14%; left: 25%; height: 2px; border-radius: 2px; background: var(--gold); }
.news-teaser { margin: 0; padding: .55rem .8rem; border-left: 4px solid var(--gold); border-radius: .3rem; background: var(--paper); color: var(--navy); font-size: .98rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }

/* Shared page frame */
.today-page { max-width: 46rem; margin: 0 auto; padding-bottom: 1rem; }
.today-heading { margin-bottom: 1rem; }
.today-empty { margin-top: 1rem; }

/* Word of the Day */
.word-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin: 0 0 .8rem; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.word-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.legend-tile { position: relative; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: .3rem; font-size: .8rem; font-weight: 800; }
.word-board { display: grid; gap: clamp(.25rem, 1vw, .42rem); width: min(100%, calc(var(--letters, 7) * 3.6rem)); margin: 1.2rem auto .4rem; }
.word-row { display: grid; grid-template-columns: repeat(var(--letters, 7), minmax(0, 1fr)); gap: clamp(.25rem, 1vw, .42rem); }
.word-row.shake { animation: today-shake .35s ease; }
.word-tile { position: relative; display: grid; place-items: center; aspect-ratio: 1; border: 2px solid var(--line); border-radius: .5rem; background: var(--white); color: var(--navy); font-size: min(1.5rem, calc(46vw / var(--letters, 7))); font-weight: 800; text-transform: uppercase; }
.word-tile.filled { border-color: #7d93ab; }
.is-correct { border-color: var(--navy) !important; background: var(--navy) !important; color: #fff !important; }
.is-correct::after { content: ""; position: absolute; right: 26%; bottom: 12%; left: 26%; height: 3px; border-radius: 2px; background: var(--gold); }
.is-present { border-color: #c99a12 !important; background: var(--gold) !important; color: var(--navy) !important; }
.is-present::after { content: ""; position: absolute; top: 9%; right: 9%; width: .34rem; height: .34rem; border-radius: 50%; background: var(--navy); }
.is-absent { border-color: #dfe5ec !important; background: #dfe5ec !important; color: #3f4c5c !important; }
.word-message { min-height: 1.6rem; margin: .2rem 0; color: #8b1e2d; font-weight: 700; text-align: center; }
.word-message:empty { visibility: hidden; }
.word-keys { display: grid; gap: .4rem; max-width: 34rem; margin: .4rem auto 0; }
.key-row { display: flex; justify-content: center; gap: .3rem; }
.key { position: relative; flex: 1 1 0; min-width: 0; max-width: 2.75rem; height: 3.2rem; padding: 0; border: 1px solid #c3cfdc; border-radius: .4rem; background: #f1f4f8; color: var(--navy); font: inherit; font-size: 1rem; font-weight: 750; cursor: pointer; }
.key.wide { flex-grow: 1.6; max-width: 4.6rem; font-size: .78rem; }
.key:hover { background: #e4eaf1; }
.key:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.key:disabled { cursor: default; opacity: .65; }
.word-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.2rem; margin: 1.2rem 0 0; }
.word-tools [hidden] { display: none; }
.word-hint summary { color: var(--blue); font-weight: 700; cursor: pointer; }
.word-hint p { margin: .5rem 0 0; color: var(--ink); }
.word-reveal { margin-top: 1.4rem; padding: 1.3rem 1.4rem; border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: .6rem; background: var(--white); }
.word-reveal h2 { margin: .25rem 0 .55rem; color: var(--navy); font-family: Georgia, serif; font-size: 1.9rem; }
.word-reveal h2:focus { outline: none; }
.reveal-definition { margin: 0 0 .7rem; color: var(--ink); font-size: 1.04rem; }
.reveal-where { margin: 0 0 .9rem; color: var(--muted); }
.reveal-explore { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; margin: 0 0 .9rem; }
.reveal-explore p { margin: 0; color: var(--navy); font-weight: 750; }
.reveal-explore .text-button { text-decoration: none; }
.reveal-streak { margin: 0; color: var(--navy); font-weight: 750; }

/* Good News */
.news-tracker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: .2rem 0 .6rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--line); }
.news-tracker div { padding: .85rem 1rem; background: var(--white); }
.news-tracker strong { display: block; color: var(--navy); font-size: 1.65rem; line-height: 1.15; }
.news-tracker span { color: var(--muted); font-size: .86rem; font-weight: 700; }
.goal-note { margin: 0 0 1.2rem; color: var(--muted); font-size: .9rem; }
.news-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; margin: 1.4rem 0 .7rem; color: var(--navy); font-family: Georgia, serif; font-size: 1.45rem; }
.news-heading-date { color: var(--muted); font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .9rem; font-weight: 700; }
.news-list { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.news-post { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--white); }
.news-post:target { animation: today-flash 1.8s ease; }
.news-post-body { min-width: 0; }
.news-post p { margin: 0; color: var(--ink); font-size: 1.02rem; overflow-wrap: anywhere; }
.news-post time { display: block; margin-top: .3rem; color: var(--muted); font-size: .85rem; }
.news-post form { margin: 0; }
.like { display: inline-flex; flex: 0 0 auto; align-items: center; gap: .35rem; min-height: 2.75rem; padding: .35rem .8rem; border: 1px solid #c3cfdc; border-radius: 999px; background: #fff; color: var(--navy); font: inherit; font-weight: 750; cursor: pointer; }
.like svg { width: 1.05rem; height: 1.05rem; }
.like[aria-pressed="true"] { border-color: #c99a12; background: #fff1b8; }
.like[aria-pressed="true"] svg { fill: #b21f2d; stroke: #b21f2d; }
.like:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.like:disabled { cursor: default; opacity: .7; }
.news-empty { margin: 1rem 0; color: var(--muted); }
.news-share { margin-top: 1.8rem; padding: 1.3rem 1.4rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--white); }
.news-share:focus { outline: none; }
.news-share h2 { margin: 0 0 .35rem; color: var(--navy); font-family: Georgia, serif; font-size: 1.45rem; }
.news-share > p { margin: 0 0 .9rem; color: var(--muted); }
.news-share label { display: block; margin-bottom: .3rem; color: var(--navy); font-weight: 750; }
.news-share textarea { width: 100%; padding: .7rem .8rem; border: 1px solid #8a99ab; border-radius: .4rem; font: inherit; resize: vertical; }
.news-share textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-top: .6rem; }
.share-row span { color: var(--muted); font-size: .88rem; }
.share-error { margin: 0 0 .8rem; padding: .6rem .8rem; border-left: 4px solid #b21f2d; border-radius: .3rem; background: #fdebed; color: #8b1e2d; font-weight: 700; }
.share-note { margin: .7rem 0 0; color: var(--muted); font-size: .9rem; }
.news-live { margin: .5rem 0 0; color: var(--muted); font-size: .9rem; }
.news-live:empty { display: none; }

@keyframes today-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes today-flash { from { box-shadow: 0 0 0 4px var(--gold); } to { box-shadow: 0 0 0 0 transparent; } }

@media (max-width: 760px) {
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .today-tile { min-height: 0; }
  .news-tracker strong { font-size: 1.35rem; }
  .news-tracker div { padding: .75rem .7rem; }
  .news-post { flex-direction: column; gap: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .word-row.shake, .news-post:target { animation: none !important; }
  .today-tile { transition: none; }
}

/* The department goal */
.goal { margin: 0 0 .5rem; }
.goal-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; color: var(--navy); font-size: .92rem; font-weight: 750; }
.goal-bar { height: .85rem; margin: .35rem 0 .4rem; overflow: hidden; border-radius: 999px; background: #dfe5ec; }
.goal-bar span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--navy); transition: width .4s ease; }
.goal-reached { margin: 0 0 .4rem; color: #1d5a34; font-weight: 750; }
.goal-reached[hidden] { display: none; }
.tile-goal p { margin: .3rem 0 0; color: var(--muted); font-size: .9rem; font-weight: 700; }
.tile-goal-bar { height: .45rem; overflow: hidden; border-radius: 999px; background: #dfe5ec; }
.tile-goal-bar span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--navy); }
@media (prefers-reduced-motion: reduce) { .goal-bar span { transition: none; } }

/* Good News layout: totals and posts on the left, sharing beside them on wide screens.
   On narrower screens the form follows the totals, so nobody has to scroll past every post to share. */
.today-page .today-heading { padding-bottom: .2rem; }
.today-page .today-heading > p:last-child { margin-bottom: 0; }
.news-tracker-wrap .news-heading { margin-top: .4rem; }
.news-share-wrap .news-share { margin-top: 1.2rem; }
@media (min-width: 1000px) {
  .today-page.news-page { max-width: 70rem; }
  .news-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 21rem); grid-template-rows: auto 1fr; grid-template-areas: "tracker share" "feed share"; column-gap: 2rem; align-items: start; }
  .news-tracker-wrap { grid-area: tracker; }
  .news-share-wrap { grid-area: share; position: sticky; top: 1.5rem; }
  .news-share-wrap .news-share { margin-top: .6rem; }
  .news-feed { grid-area: feed; }
}

/* Hide or show the answer after the reveal */
.reveal-toggle-row { display: flex; justify-content: flex-end; margin-top: 1.2rem; }
.reveal-toggle-row + .word-reveal { margin-top: .4rem; }
.word-reveal[hidden] { display: none; }
