/* LingoNeko design, shared by every language. Loads after the shared
   stylesheets and before a language layer (90-cjk.css, 95-*).

   Five labeled destinations (Home, Journey, Practice, Stories, Dictionary) in
   one tab bar; a compact one-row header; the Words | Sentences switch inside
   the search toolbar; and Home, built from the app's own white bordered cards
   on the gray page. Nothing here adds a new bar: the header lost its tagline
   and a row, and the toolbar gained its switch in place of the hidden type
   selector. */

/* ---------- One frame for every section ---------- */
/* Same scrollbar space whether or not a page scrolls, so nothing shifts sideways
   when moving between sections. */
html {
  scrollbar-gutter: stable;
}
:root {
  --content-width: 960px;
  --content-gutter: 12px;
}
@media (min-width: 1025px) {
  :root {
    --content-gutter: 24px;
  }
}

/* ---------- Header: one centered wordmark, account on the right ---------- */
/* The same header in every section, including the Word Game start screen on
   phones (the header only goes away while a round is under way). */
body:not(.word-game-round-active) header {
  align-items: center;
  box-sizing: border-box;
  column-gap: 8px;
  display: grid;
  flex-shrink: 0;
  grid-template-columns: 1fr auto 1fr;
  height: 65px;
  padding: 8px 12px 9px;
  text-align: center;
}
body:not(.word-game-round-active) header #site-title {
  align-items: center;
  flex-direction: column;
  font-size: 28px !important;
  gap: 0;
  grid-column: 2;
  grid-row: 1;
  line-height: 1.05;
  margin: 0;
  white-space: nowrap;
}
body:not(.word-game-round-active) header .header-top-row {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  margin: 0;
}
body:not(.word-game-round-active) header #auth-container {
  flex-wrap: nowrap;
  margin: 0;
  position: static;
  white-space: nowrap;
}
.wordmark-neko {
  color: var(--color-interactive);
}
body:not(.word-game-round-active) header .site-wordmark-descriptor {
  color: #35495f;
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.32em;
  margin: 3px 0 0;
  text-indent: 0.32em;
  text-transform: uppercase;
}
@media (min-width: 1025px) {
  body:not(.word-game-round-active) header {
    height: 78px;
    padding: 12px 24px;
  }
  body:not(.word-game-round-active) header #site-title {
    font-size: 34px !important;
  }
}

/* ---------- Tab bar: five tabs fit at their normal size ---------- */
@media (max-width: 1024px) {
  #mode-nav .mode-tab {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 2px;
    padding-right: 2px;
  }
  #mode-nav:has([data-mode="grammar"]) .mode-tab-label,
  #mode-nav .mode-tab-label {
    display: block;
    font-size: 13px;
    letter-spacing: 0;
    line-height: normal;
    min-height: 0;
    white-space: nowrap;
    width: auto;
  }
}

/* ---------- Words | Sentences, inside the search toolbar ---------- */
.type-switch {
  display: none;
}
body[data-mode="words"] .type-switch,
body[data-mode="sentences"] .type-switch {
  background-color: var(--color-wash-blue);
  border: 1px solid var(--color-wash-blue-border);
  border-radius: 10px;
  box-sizing: border-box;
  display: flex;
  flex: 0 0 100%;
  gap: 4px;
  padding: 4px;
}
html.home-view .type-switch {
  display: none !important;
}
.type-switch-btn {
  align-items: center;
  border-radius: 7px;
  box-sizing: border-box;
  color: #3e5368;
  display: flex;
  flex: 1 1 0;
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  letter-spacing: 0.05em;
  min-height: 44px;
  text-decoration: none;
  text-transform: uppercase;
}
.type-switch-btn:hover {
  background-color: rgba(255, 255, 255, 0.7);
}
.type-switch-btn.active {
  background-color: var(--color-ink);
  box-shadow: 0 2px 5px rgba(13, 58, 105, 0.22);
  color: var(--color-surface);
}
.type-switch-btn:focus-visible {
  outline: 3px solid var(--color-wash-blue-active-border);
  outline-offset: 2px;
}
@media (min-width: 1025px) {
  body[data-mode="words"] .type-switch,
  body[data-mode="sentences"] .type-switch {
    flex: 0 0 auto;
    width: 240px;
  }
}

/* On Home the toolbar is just the search field. */

html.home-view .selectors-wrapper,
html.home-view .search-norwegian-letter-keys {
  display: none !important;
}

/* ---------- Home and the Dictionary start screen ---------- */
#landing-card.home {
  background: none;
  border: 0;
  box-shadow: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 auto;
  max-width: none;
  padding: 12px 0 24px;
  text-align: left;
  width: min(var(--content-width), calc(100% - 2 * var(--content-gutter)));
}
.home-card {
  background: var(--color-surface);
  border: 1px solid var(--color-wash-blue-border);
  border-radius: 12px;
  box-sizing: border-box;
  margin: 0;
  padding: 16px;
  text-align: left;
  width: 100%;
}
.dictionary-empty {
  margin: 12px auto;
  max-width: none;
  width: min(var(--content-width), calc(100% - 2 * var(--content-gutter)));
}
.dictionary-empty[hidden],
.home-card[hidden],
#landing-card.home > [hidden] {
  display: none !important;
}
.home-eyebrow {
  color: var(--color-text-slate);
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.home-eyebrow-outside {
  margin: 0 0 8px 2px;
}
#landing-card.home h2.home-title,
#landing-card.home h3.home-title {
  color: var(--color-ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 22px !important;
  font-weight: 600;
  line-height: 1.25;
  margin: 4px 0;
  text-align: left;
  text-wrap: balance;
}
.home-meta {
  color: var(--color-text-muted);
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.4;
}
.home-goal {
  color: var(--color-text);
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  margin: 2px 0 6px;
}
.home-count {
  color: var(--color-text-muted);
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 14px;
  margin: 0 0 12px;
  text-align: center;
}
.home-progress {
  background: var(--color-surface-strong);
  border-radius: 3px;
  height: 6px;
  margin: 12px 0 14px;
  overflow: hidden;
}
.home-progress[hidden] {
  display: none;
}
.home-progress span {
  background: var(--color-ink);
  display: block;
  height: 6px;
  width: 0;
}
.home-primary,
.home-secondary {
  align-items: center;
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  letter-spacing: 0.05em;
  min-height: 46px;
  text-decoration: none;
  text-transform: uppercase;
  width: 100%;
}
#landing-card.home > .home-card {
  display: flex;
  flex-direction: column;
}
#landing-card.home > .home-row,
.dictionary-empty > .home-row {
  flex-direction: row;
}
#landing-card.home > .home-card > .home-primary,
#landing-card.home > .home-card > .home-secondary {
  margin-top: auto;
}
.home-primary {
  background: var(--color-ink);
  border: 1px solid var(--color-ink);
  color: var(--color-surface);
  margin-top: 12px;
}
.home-primary:hover {
  background: var(--color-ink-active);
}
.home-secondary {
  background: var(--color-surface);
  border: 1.5px solid var(--color-ink);
  color: var(--color-ink);
}
.home-secondary:hover {
  background: var(--color-wash-blue);
}
.home-primary:focus-visible,
.home-secondary:focus-visible,
.dictionary-row:focus-visible,
.home-row:focus-visible,
.game-link-row:focus-visible {
  outline: 3px solid var(--color-wash-blue-active-border);
  outline-offset: 2px;
}
#landing-card.home .landing-daily-quests,
#landing-card.home .landing-progress-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-wash-blue-border);
  border-radius: 12px;
  margin: 0;
  padding: 16px;
}
#landing-card.home .landing-daily-quest-track {
  margin: 12px auto 6px;
}
.home-about {
  color: var(--color-text-muted);
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding: 4px 4px 0;
}
/* The whole reading card is the link, like the My Words row: the link's own
   hit area is stretched over the card, and the card reacts to hover and focus. */
#home-reading {
  position: relative;
}
#home-reading:hover {
  background: var(--color-wash-blue);
}
#home-reading:has(.story-card-link:focus-visible) {
  outline: 3px solid var(--color-wash-blue-active-border);
  outline-offset: 2px;
}
#home-reading .story-card-link {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
  display: flex;
  margin-top: 6px;
  min-height: 0;
  outline: none;
  padding: 0;
}
#home-reading .story-card-link:hover {
  background: none;
}
#home-reading .story-card-link::after {
  content: "";
  inset: 0;
  position: absolute;
}
.dictionary-empty .home-card + .home-card {
  margin-top: 12px;
}
.dictionary-rows {
  padding-bottom: 6px;
}
.dictionary-row,
.home-row {
  align-items: center;
  box-sizing: border-box;
  color: var(--color-ink);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 56px;
  text-decoration: none;
}
.dictionary-row {
  border-top: 1px solid var(--color-wash-blue-border);
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
}
.dictionary-rows .home-eyebrow {
  margin-bottom: 4px;
}
.dictionary-rows .home-eyebrow + .dictionary-row {
  border-top: 0;
}
.dictionary-row-word {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 600;
}
.dictionary-row-gloss {
  color: var(--color-text-muted);
  flex: 1;
  font-size: 15px;
  text-align: right;
}
.home-row {
  padding-top: 8px;
  padding-bottom: 8px;
}
.home-row-copy {
  display: flex;
  flex-direction: column;
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
}
.home-row-title {
  font-size: 17px;
  font-weight: 600;
}
.home-row-sub {
  color: var(--color-text-muted);
  font-size: 14px;
}
.dictionary-row:hover,
.home-row:hover {
  background: var(--color-wash-blue);
}
.home-row:hover {
  background: var(--color-wash-blue);
}

/* Desktop Home: the journey step as a banner, then Today's practice beside the
   saved words and the reading suggestion. */
@media (min-width: 1025px) {
  #landing-card.home {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-template-rows: auto auto 1fr;
    padding: 24px 0 32px;
  }
  #landing-card.home #home-journey {
    align-items: center;
    column-gap: 32px;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 240px;
  }
  #landing-card.home #home-journey > :not(.home-primary):not(.home-progress) {
    grid-column: 1;
  }
  #landing-card.home #home-journey > .home-primary {
    grid-column: 2;
    grid-row: 1 / span 4;
    margin-top: 0;
  }
  #landing-card.home #home-journey > .home-progress {
    grid-column: 1;
  }
  #landing-card.home #landing-daily-quests {
    grid-column: 1;
    grid-row: 2 / span 2;
  }
  #landing-card.home #home-my-words {
    grid-column: 2;
    grid-row: 2;
  }
  #landing-card.home #home-reading {
    grid-column: 2;
    grid-row: 3;
  }
  #landing-card.home #landing-progress-summary,
  #landing-card.home .home-about {
    grid-column: 1 / -1;
  }
}

/* ---------- Practice: My Words and My Stats rows ---------- */
.game-link-rows {
  align-self: stretch;
  background: var(--color-surface);
  border: 1px solid var(--color-wash-blue-border);
  border-radius: 12px;
  box-sizing: border-box;
  margin: 12px 0;
  overflow: hidden;
  text-align: left;
  width: 100%;
}
.game-link-row {
  align-items: center;
  border-top: 1px solid var(--color-wash-blue-border);
  box-sizing: border-box;
  color: var(--color-ink);
  display: flex;
  justify-content: space-between;
  min-height: 56px;
  padding: 8px 16px;
  text-decoration: none;
}
.game-link-row:first-child {
  border-top: 0;
}
.game-link-row:hover {
  background: var(--color-wash-blue);
}
.game-link-row-copy {
  display: flex;
  flex-direction: column;
  font-family: "Source Sans 3", "Noto Sans", sans-serif;
}
.game-link-row-copy strong {
  font-size: 16px;
  font-weight: 600;
}
.game-link-row-copy span {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ---------- Every section starts in the same frame ---------- */
/* The page used to size its content per section (50% of the window for
   Dictionary and Stories, 920px for Practice, 720px for Journey). One width
   and one gutter instead. Lessons and a running Word Game round keep their own
   narrower, task-shaped layouts. */
html:not(.grammar-boot-lesson) body:not(.word-game-round-active):not(.grammar-lesson) #results-container,
body.word-game-mode:not(.word-game-round-active) #results-container,
html:not(.grammar-boot-lesson) body.grammar-mode:not(.grammar-lesson) #results-container,
body.word-list-mode #results-container,
body.my-stats-mode #results-container,
body.account-page-mode #results-container {
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  max-width: none;
  width: min(var(--content-width), calc(100% - 2 * var(--content-gutter)));
}
#search-container {
  box-sizing: border-box;
  padding-left: var(--content-gutter);
  padding-right: var(--content-gutter);
}
#search-container-inner {
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--content-width);
  min-width: 0;
  width: min(var(--content-width), 100%);
}

/* ---------- Desktop toolbar: filters on one row, the search field below ---------- */
/* At the shared content width the switch, the filters, the æøå keys and the
   search field no longer fit on one line (the field was squeezed to a sliver
   and its button clipped). Filters stay together; the search field gets the
   full width, as it already has on phones. */
@media (min-width: 1025px) {
  #search-container-inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  #search-container-inner .search-and-random-wrapper {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
  html.home-view #search-container-inner .search-and-random-wrapper {
    flex-basis: 100%;
  }
}

/* Journey hides the search toolbar, so the white tab strip has to carry the
   bottom edge itself, like Practice, My Stats and the account pages do. */
@media (min-width: 1025px) {
  body.grammar-mode #mode-nav {
    border-bottom: 1px solid var(--color-border);
  }
}

/* Desktop toolbar balance: the first row spans the full width, split evenly
   between the Words | Sentences switch and the filters; the search row below
   spans the same width. */
@media (min-width: 1025px) {
  #search-container-inner .selectors-wrapper {
    display: flex;
    flex: 1 1 0;
    gap: 12px;
    min-width: 0;
    width: auto;
  }
  #search-container-inner .selectors-wrapper > .pos-filter,
  #search-container-inner .selectors-wrapper > .cefr-filter-group,
  #search-container-inner .selectors-wrapper > .genre-filter {
    flex: 1 1 0;
    min-width: 0;
  }
  #search-container-inner .cefr-filter-group > .cefr-filter {
    width: 100%;
  }
  body[data-mode="words"] .type-switch,
  body[data-mode="sentences"] .type-switch {
    flex: 0 0 240px;
    margin-right: 0;
  }
  #search-container-inner {
    column-gap: 12px;
  }
}
@media (min-width: 1025px) {
  /* Same height as the filter pills beside it. */
  .type-switch-btn {
    min-height: 36px;
  }
}

/* ---------- Skeleton for the reading card ---------- */
.home-skeleton {
  display: block;
  min-height: 126px;
  position: relative;
}
.sk-line,
.sk-badge {
  animation: home-shimmer 1.4s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    var(--color-surface-strong) 25%,
    var(--color-surface-subtle) 50%,
    var(--color-surface-strong) 75%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  display: block;
}
.sk-eyebrow {
  height: 12px;
  width: 38%;
}
.sk-title {
  height: 20px;
  margin-top: 14px;
  width: 62%;
}
.sk-sub {
  height: 16px;
  margin-top: 10px;
  width: 44%;
}
.sk-meta {
  height: 14px;
  margin-top: 22px;
  width: 22%;
}
.sk-badge {
  bottom: 0;
  height: 26px;
  position: absolute;
  right: 0;
  width: 36px;
}
@keyframes home-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sk-line,
  .sk-badge {
    animation: none;
  }
}
