/* The public Korean-cognate search (hashidari.com/cognates): the static
 * search page (cognates/index.html) and the server-rendered word pages the
 * site serves at /cognates/<word> (server/publicCognates/page.ts) share this
 * file, layered on styles.css's tokens. Lapis is the Japanese layer and
 * dancheong red the Korean one; a weak twin downgrades to the caution amber
 * and a false friend is a dashed danger outline, the same rules as the
 * app's cognate pill (src/components/CognatePill.css). Always light, like
 * the rest of the marketing site. */
:root {
  --cg-caution: #8c640f;
  --cg-caution-bg: #faf3e2;
  --cg-caution-border: #e8d5a4;
  --cg-danger: #b03d34;
  --cg-danger-border: #e7c4c0;
  --cg-placeholder: #6f6b77;
}

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

.cognate {
  padding: 28px 0 48px;
}

.cognate__wrap {
  max-width: 760px;
  display: grid;
  gap: 20px;
}

/* styles.css gives every marketing <section> a band's padding and top
   rule; these sections are parts of one column instead. */
.cognate .cognate-hero,
.cognate .results,
.cognate .cognate-empty,
.cognate .related {
  padding: 0;
  border-top: 0;
}

.cognate-hero .hero__eyebrow {
  justify-self: start;
  margin-bottom: 0;
}

.results:empty {
  display: none;
}

@media (max-width: 480px) {
  .cognate__wrap {
    padding: 0 16px;
  }
}

.cognate-hero {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.cognate-hero h1 {
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.15;
}

.cognate-hero p {
  font-size: 16px;
}

/* Search box */
.cognate-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--accent-border);
  border-radius: 14px;
  padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow);
}

.cognate-search:focus-within {
  border-color: var(--accent);
}

.cognate-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: 17px/1.4 var(--sans);
  color: var(--text-h);
  padding: 8px 0;
}

.cognate-search__input::placeholder {
  color: var(--cg-placeholder);
}

.cognate-search__input::-webkit-search-cancel-button {
  cursor: pointer;
}

.cognate-search__go {
  flex: none;
  font: 600 15px/1 var(--sans);
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
}

/* The placeholder that cycles through one word typed four ways
   (junbi → 準備 → 준비 → preparation). The input's real placeholder holds
   the same four as plain text: it is what screen readers get, and it is
   what shows (still) under prefers-reduced-motion, where the overlay never
   appears. The overlay hides itself once the box has focus or text. */
.cyc {
  display: none;
  position: absolute;
  left: 14px;
  right: 92px;
  top: 50%;
  height: 1.6em;
  transform: translateY(-50%);
  overflow: hidden;
  pointer-events: none;
  font: 17px/1.6 var(--sans);
}

.cyc span {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--cg-placeholder);
  white-space: nowrap;
  opacity: 0;
  animation: cyc 10s infinite;
}

.cyc span:nth-child(2) {
  animation-delay: 2.5s;
}

.cyc span:nth-child(3) {
  animation-delay: 5s;
}

.cyc span:nth-child(4) {
  animation-delay: 7.5s;
}

@keyframes cyc {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  4%,
  21% {
    opacity: 1;
    transform: none;
  }
  25%,
  100% {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cognate-search--cycling .cognate-search__input::placeholder {
    color: transparent;
  }

  .cognate-search--cycling .cyc {
    display: block;
  }

  .cognate-search--cycling .cognate-search__input:focus ~ .cyc,
  .cognate-search--cycling .cognate-search__input:not(:placeholder-shown) ~ .cyc {
    display: none;
  }

  .cognate-search--cycling .cognate-search__input:focus::placeholder {
    color: var(--cg-placeholder);
  }
}

/* "Try: junbi · 준비 · preparation" */
.try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
}

.try a {
  font: 500 14px/1 var(--sans);
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--accent-border);
  border-radius: 999px;
  padding: 6px 11px;
  text-decoration: none;
}

.try a:hover {
  border-style: solid;
}

.cognate-fine {
  font-size: 13px;
  color: var(--text);
}

/* Results */
.results {
  display: grid;
  gap: 10px;
}

.results__count,
.results__note {
  font-size: 14px;
  color: var(--text);
}

.results__note {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text-h);
}

.results__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  text-decoration: none;
  color: inherit;
}

.row:hover {
  border-color: var(--accent-border);
}

.row__word {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-h);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.row__sub {
  grid-column: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__twin {
  grid-row: 1 / 3;
  grid-column: 2;
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.row__ko {
  font-size: 18px;
  font-weight: 700;
  color: var(--korean);
}

.row__ko--weak {
  color: var(--cg-caution);
}

.row__ko--ff {
  color: var(--cg-danger);
}

.row__ko--says {
  color: var(--text-h);
}

.row mark {
  background: #fbe3a6;
  color: inherit;
  border-radius: 3px;
}

.pill {
  display: inline-block;
  border: 1px solid var(--korean-border);
  background: var(--korean-bg);
  color: var(--korean);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill--weak {
  border-color: var(--cg-caution-border);
  background: var(--cg-caution-bg);
  color: var(--cg-caution);
}

.pill--ff {
  border: 1px dashed var(--cg-danger-border);
  background: transparent;
  color: var(--cg-danger);
}

.pill--says,
.pill--none {
  border-color: var(--border);
  background: var(--surface-sunken);
  color: var(--text);
  font-weight: 600;
}

.results__more {
  justify-self: start;
}

.cognate-empty {
  display: grid;
  gap: 10px;
}

.cognate-empty h1,
.cognate-empty h2 {
  font-size: 20px;
}

/* One word's page */
.entry {
  display: grid;
  gap: 14px;
}

.entry__echo {
  justify-self: start;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-sunken);
  border-radius: 8px;
  padding: 6px 10px;
}

.entry__echo b {
  color: var(--text-h);
  font-weight: 600;
}

.entry__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.entry__word {
  font-size: clamp(40px, 12vw, 56px);
  line-height: 1.05;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.entry__reading {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-h);
}

.entry__romaji {
  color: var(--text);
}

.entry__share {
  flex: none;
  font: 600 14px/1 var(--sans);
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.entry__meaning {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-h);
}

.entry__tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.entry__tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-h);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 2px 7px;
}

.entry__more {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--text);
}

.cognate .twin {
  background: var(--surface);
  border: 1px solid var(--korean-border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.cognate .twin--weak {
  border-color: var(--cg-caution-border);
}

.cognate .twin--ff {
  border: 1.5px dashed var(--cg-danger-border);
}

.cognate .twin--says {
  border-color: var(--accent-border);
}

.cognate .twin--none {
  border-color: var(--border);
}

.twin__label {
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--korean);
}

.twin--weak .twin__label {
  color: var(--cg-caution);
}

.twin--ff .twin__label {
  color: var(--cg-danger);
}

.twin--says .twin__label {
  color: var(--accent);
}

.twin--none .twin__label {
  color: var(--text);
}

.twin__ko {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--korean);
}

.twin--weak .twin__ko {
  color: var(--cg-caution);
}

.twin--ff .twin__ko {
  color: var(--cg-danger);
}

.twin--says .twin__ko {
  color: var(--text-h);
}

.twin__rr {
  font-size: 15px;
  color: var(--text-h);
}

.twin__why {
  font-size: 15px;
  color: var(--text-h);
}

/* The sound strip: one column per kanji. */
.strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 6px;
}

.strip__col {
  display: grid;
  justify-items: center;
  gap: 1px;
  background: var(--surface-sunken);
  border-radius: 10px;
  padding: 9px 4px;
  text-align: center;
  min-width: 0;
}

.strip__k {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-h);
}

.strip__ja {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.strip__ko {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--korean);
}

.twin--weak .strip__ko {
  color: var(--cg-caution);
}

.twin--ff .strip__ko {
  color: var(--cg-danger);
}

.strip__rom {
  font-size: 12px;
  color: var(--text-h);
}

.strip__key {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
}

.strip__key span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

.strip__key-ja::before {
  background: var(--accent);
}

.strip__key-ko::before {
  background: var(--korean);
}

.says {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.says p {
  display: grid;
  justify-items: center;
  background: var(--surface-sunken);
  border-radius: 10px;
  padding: 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-h);
}

.says__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

/* The soft push into the app */
/* The search page's static word links (generated: siteGenerate.ts's
   renderFeaturedWords). */
.featured {
  display: grid;
  gap: 10px;
}

.featured__title {
  font-size: 19px;
  line-height: 1.25;
}

.featured__heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.featured__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.featured__list a {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 15px;
  color: var(--text-h);
  text-decoration: none;
}

.featured__list a:hover {
  border-color: var(--accent-border);
}

.featured__ko {
  color: var(--korean);
}

.push {
  background: linear-gradient(180deg, var(--surface), #f7f3ec);
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.push__title {
  font-size: 19px;
  line-height: 1.25;
}

.push p {
  font-size: 15px;
}

.push__ctas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 8px;
}

.push[hidden],
.push-member[hidden] {
  display: none;
}

.push-member {
  font-size: 15px;
}

.push__fine {
  font-size: 13px;
  color: var(--text);
}

/* Other words that share a kanji, in the search results' row style */
.related {
  display: grid;
  gap: 10px;
}

.related__title {
  font-size: 19px;
  line-height: 1.25;
}

.related__kanji {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.related__kanji span {
  color: var(--text-h);
  font-size: 16px;
}

.cognate-footer {
  font-size: 13px;
}

.cognate-footer .wrap {
  display: grid;
  gap: 12px;
}

.cognate-footer__licence {
  color: var(--text);
  line-height: 1.5;
}

.cognate-footer__licence a {
  color: var(--text);
}
