/* New in 0.3 (text in images, duplicates, languages), the language menu and offer, Homebrew. */

/* ── New in 0.3 ──────────────────────────────────────── */

.new-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.new-grid .card { display: flex; flex-direction: column; min-height: 360px; transition: border-color 0.3s; }
.new-grid .card:hover { border-color: rgba(245, 165, 36, 0.3); }
.new-grid .card:nth-child(2) { --delay: 0.06s; }
.new-grid .card:nth-child(3) { --delay: 0.12s; }

/* Text in images: a search for a word that only the picture says, and the scan that finds it. */
.ocr { flex-direction: column; align-items: stretch; gap: 12px; }
.ocr-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 14px;
}
.ocr-glass { position: relative; flex: none; width: 12px; height: 12px; border: 2px solid var(--text-3); border-radius: 50%; }
.ocr-glass::after { content: ""; position: absolute; right: -5px; bottom: -5px; width: 2px; height: 6px; border-radius: 1px; background: var(--text-3); transform: rotate(-45deg); }
.ocr-search .typed::after { content: ""; display: inline-block; width: 2px; height: 16px; margin-left: 1px; background: var(--amber); vertical-align: -3px; animation: blink 1s steps(1) infinite; }
.ocr-image {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 22px 18px 18px;
  border-radius: 10px;
  background: linear-gradient(150deg, #170f24, #4b1a5a);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.ocr-sun { position: absolute; right: -16px; top: -18px; width: 78px; height: 78px; border-radius: 50%; background: #ff9f36; }
.ocr-image b { position: relative; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; color: #fff; }
.ocr-sale { font-size: 13px; font-weight: 600; color: #ffc067; }
.ocr-hit { margin-top: 6px; font-size: 11.5px; color: rgba(255, 255, 255, 0.72); }
.ocr-hit mark { padding: 0 2px; border-radius: 3px; background: transparent; color: inherit; animation: ocr-mark 3.6s var(--ease) infinite; }
.ocr-scan {
  position: absolute;
  inset: auto 0;
  top: -40%;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(245, 165, 36, 0.16));
  border-bottom: 1px solid rgba(255, 212, 102, 0.7);
  animation: ocr-scan 3.6s var(--ease) infinite;
}
@keyframes ocr-scan { 0% { top: -40%; } 55%, 100% { top: 110%; } }
@keyframes ocr-mark {
  0%, 40% { background: transparent; color: inherit; box-shadow: none; }
  50%, 92% { background: rgba(245, 165, 36, 0.28); color: var(--amber-hi); box-shadow: 0 0 0 1px rgba(245, 165, 36, 0.7); }
  100% { background: transparent; color: inherit; box-shadow: none; }
}

/* Duplicates: the capture card, the "already saved" line, the two keys. */
.dup { flex-direction: column; align-items: stretch; gap: 10px; }
.dup-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); }
.dup-thumb { flex: none; width: 58px; height: 34px; border-radius: 6px; background: linear-gradient(120deg, #3b1a05, #f77d10); }
.dup-lines { display: flex; flex-direction: column; min-width: 0; }
.dup-lines b { overflow: hidden; font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.dup-lines small { font-size: 11.5px; color: var(--text-3); }
.dup-line { display: flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 12.5px; color: var(--text-2); }
.dup-line i { font-style: normal; color: var(--text-3); }
.dup-line em { font-style: normal; color: var(--text-3); }
.dup-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}
.dup-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dup-key.primary { color: var(--text); }
.dup-keys kbd { font-size: 11px; }
.js .reveal .dup-line, .js .reveal .dup-key { opacity: 0; }
.js .reveal.in .dup-line { animation: dup-in 0.6s 0.7s var(--ease) both; }
.js .reveal.in .dup-key { animation: dup-in 0.6s 0.9s var(--ease) both; }
.js .reveal.in .dup-key + .dup-key { animation-delay: 1s; }
@keyframes dup-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Languages: the same HUD in four languages, taking turns. */
.langs { flex-direction: column; align-items: center; gap: 8px; }
.langs span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--text-3);
  animation: lang-turn 8s infinite;
}
.langs span::before {
  content: "✓";
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
  animation: lang-check 8s infinite;
}
.langs span:nth-child(2), .langs span:nth-child(2)::before { animation-delay: 2s; }
.langs span:nth-child(3), .langs span:nth-child(3)::before { animation-delay: 4s; }
.langs span:nth-child(4), .langs span:nth-child(4)::before { animation-delay: 6s; }
@keyframes lang-turn {
  0%, 22% { color: var(--text); border-color: rgba(245, 165, 36, 0.45); background: rgba(245, 165, 36, 0.08); box-shadow: 0 0 30px -8px rgba(245, 165, 36, 0.5); }
  28%, 100% { color: var(--text-3); border-color: var(--border); background: rgba(255, 255, 255, 0.03); box-shadow: none; }
}
@keyframes lang-check {
  0%, 22% { background: var(--brand); color: #241503; }
  28%, 100% { background: rgba(255, 255, 255, 0.08); color: var(--text-3); }
}

/* ── Language menu (nav) ─────────────────────────────── */

.lang-menu { position: relative; }
.lang-menu summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--text); background: var(--surface-2); }
.lang-menu summary svg { flex: none; width: 16px; height: 16px; max-width: none; }
.lang-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  min-width: 170px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(22, 22, 26, 0.96);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: lang-open 0.18s var(--ease);
}
.lang-list a { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px; font-size: 14px; color: var(--text-2); }
.lang-list a:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.lang-list a[aria-current] { color: var(--text); }
.lang-list a[aria-current]::after { content: "✓"; color: var(--amber); }
@keyframes lang-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Section links never wrap; translations are longer than English, so they give way sooner. */
.nav-links a { white-space: nowrap; }
@media (max-width: 1100px) {
  html:not([lang="en"]) .nav-links { display: none; }
}

/* Offer of the visitor's own language, bottom center. */
.lang-offer {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(22, 22, 26, 0.92);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8), 0 0 40px -12px rgba(245, 165, 36, 0.35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 14px;
  opacity: 0;
  translate: -50% 16px;
  transition: opacity 0.5s, translate 0.5s var(--ease);
}
.lang-offer.show { opacity: 1; translate: -50% 0; }
.lang-offer a { transition: color 0.2s; }
.lang-offer a:hover { color: var(--amber-hi); }
.lang-offer button {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.lang-offer button:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* ── Homebrew (final call to action) ─────────────────── */

.brew {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin-top: 22px;
  padding: 6px 6px 6px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
}
.brew-label { flex: none; font-size: 13px; color: var(--text-3); }
.brew code { min-width: 0; overflow-x: auto; padding: 0; border: 0; background: none; font-size: 13px; white-space: nowrap; scrollbar-width: none; }
.brew code::-webkit-scrollbar { display: none; }
.brew .copy { flex: none; }

@media (max-width: 980px) {
  .new-grid { grid-template-columns: minmax(0, 1fr); }
  .new-grid .card { min-height: 0; }
}

@media (max-width: 680px) {
  .brew-label { display: none; }
  .brew code { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
  .lang-menu summary span { display: none; }
  /* Under the nav, at the right edge (the nav is the containing block once it blurs). */
  .lang-list { position: fixed; top: 56px; right: var(--gutter); }
}

@media (prefers-reduced-motion: reduce) {
  .ocr-scan { display: none; }
  .ocr-hit mark { animation: none; background: rgba(245, 165, 36, 0.28); color: var(--amber-hi); }
  .langs span, .langs span::before { animation: none; }
  .langs span:first-child { color: var(--text); border-color: rgba(245, 165, 36, 0.45); }
  .js .reveal .dup-line, .js .reveal .dup-key { opacity: 1; animation: none; }
  .lang-offer { transition: none; }
}
