/* The name maker and name pages, and the name card on the keyboard page. */

/* The style fonts: Noto Sans Tifinagh and its regional versions, cut down to
   the Tifinagh block (tools/make-tifinagh-fonts.py). A page only downloads the
   ones its cards use. */
@font-face { font-family: "Tifinagh ircam"; font-display: swap; src: url(/fonts/tifinagh/ircam.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh kabyle"; font-display: swap; src: url(/fonts/tifinagh/kabyle.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh ahaggar"; font-display: swap; src: url(/fonts/tifinagh/ahaggar.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh air"; font-display: swap; src: url(/fonts/tifinagh/air.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh adrar"; font-display: swap; src: url(/fonts/tifinagh/adrar.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh azawagh"; font-display: swap; src: url(/fonts/tifinagh/azawagh.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh ghat"; font-display: swap; src: url(/fonts/tifinagh/ghat.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh hawad"; font-display: swap; src: url(/fonts/tifinagh/hawad.woff2) format("woff2"); }
@font-face { font-family: "Tifinagh tawellemmet"; font-display: swap; src: url(/fonts/tifinagh/tawellemmet.woff2) format("woff2"); }

.tif { font-family: var(--font-tifinagh), sans-serif; }

.trail { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-xs); color: var(--muted); margin-bottom: var(--space-4); }
.trail a { color: var(--muted); }
.name-page h1 { margin-bottom: var(--space-3); }
.name-page .lead .tif { color: var(--ink); white-space: nowrap; }

.name-form { display: grid; gap: var(--space-2); max-width: 520px; margin: var(--space-5) 0 var(--space-5); }
.name-form label { font-weight: 500; }
.name-field { display: flex; gap: var(--space-2); }
.name-field input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 var(--space-4);
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--text-m);
}
.name-field input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

/* The name, as large as the screen allows: the page's one bold moment. */
.big-name {
  margin: var(--space-4) 0 var(--space-3);
  font-family: "Tifinagh ircam", var(--font-tifinagh), sans-serif;
  font-size: clamp(56px, 14vw, 140px); line-height: 1.15; color: var(--ink);
  overflow-wrap: anywhere;
}
.name-note { color: var(--muted); font-size: var(--text-xs); max-width: 68ch; }
.name-page-link { font-weight: 500; }

.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.style-card { margin: 0; padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); display: grid; gap: var(--space-3); align-content: start; }
.name-art { margin: 0; font-size: 52px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; min-height: 1.3em; }
.name-art.effect-outline { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.name-art.effect-flag {
  color: var(--flag-red); background: #FFFFFF; border-radius: var(--radius-key); padding: var(--space-2) var(--space-3) calc(var(--space-2) + 9px);
  background-image: linear-gradient(to top, var(--flag-yellow) 0 3px, var(--flag-green) 3px 6px, var(--flag-blue) 6px 9px, transparent 9px);
}
.style-card figcaption { color: var(--muted); font-size: var(--text-xs); display: grid; gap: 2px; }
.card-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.card-button {
  border: 1px solid var(--line); background: transparent; border-radius: var(--radius-pill);
  padding: 4px 12px; min-height: 34px; cursor: pointer; font-size: var(--text-xs); color: var(--ink);
}
.card-button:hover { border-color: var(--accent); }
.card-button.is-done { background: var(--success); border-color: var(--success); color: var(--on-accent); }

.name-letters { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.name-letters li { display: grid; justify-items: center; min-width: 72px; padding: var(--space-3) var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-key); }
.name-letters .glyph { font-family: var(--font-tifinagh), sans-serif; font-size: var(--text-xl); line-height: 1.2; }
.name-letters .letter-name { font-size: var(--text-xs); color: var(--muted); }
.name-letters .sound { font-size: var(--text-s); }

.names-list h3 { font-size: var(--text-m); font-weight: 500; margin: var(--space-5) 0 var(--space-2); }
.name-links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px var(--space-3); }
.name-links a { display: flex; justify-content: space-between; gap: var(--space-2); padding: 6px 0; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.name-links a:hover span:first-child { text-decoration: underline; }
.name-links .tif { color: var(--muted); }

/* The showcase on the keyboard page: a dark band across the whole width, the
   flag's bands along its top, the name large on one side. */
.showcase {
  --band: #0B2545; --band-ink: #F4F8FB; --band-muted: #A9BED0;
  position: relative; isolation: isolate;
  margin-top: var(--space-7); padding: calc(var(--space-6) + 9px) 0 var(--space-6);
  color: var(--band-ink);
}
/* The band's colour reaches both edges of the window while its content stays
   in the page's column; html clips what spills over, so nothing scrolls sideways. */
.showcase::before {
  content: ""; position: absolute; z-index: -1; inset: 0 calc(50% - 50vw);
  background: linear-gradient(to bottom, var(--flag-blue) 0 3px, var(--flag-green) 3px 6px, var(--flag-yellow) 6px 9px, var(--band) 9px);
}
:root[data-theme="dark"] .showcase { --band: #0F2F52; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .showcase { --band: #0F2F52; } }
.showcase-inner { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--space-6); align-items: center; }
.showcase h2 { font-size: var(--text-xl); font-weight: 600; margin: 0 0 var(--space-2); }
.showcase-lede { color: var(--band-muted); max-width: 46ch; }
.showcase .name-form { margin: var(--space-4) 0; }
.showcase .name-field input { background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.25); color: var(--band-ink); }
.showcase .name-field input::placeholder { color: var(--band-muted); }
.showcase .action.primary { background: var(--flag-yellow); border-color: var(--flag-yellow); color: #0B2545; }
.popular h3 { font-size: var(--text-xs); font-weight: 500; color: var(--band-muted); margin: 0 0 var(--space-2); }
.name-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.name-chips a {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill);
  border: 1px solid rgb(255 255 255 / 0.22); color: var(--band-ink); text-decoration: none; font-size: var(--text-xs);
}
.name-chips a:hover { background: rgb(255 255 255 / 0.1); }
.name-chips .tif { font-size: var(--text-s); color: var(--band-ink); }
.showcase-art { min-width: 0; transition: opacity 220ms; }
.showcase-art.is-changing { opacity: 0; }
.showcase .teaser-art { margin: 0; font-family: "Tifinagh ircam", var(--font-tifinagh), sans-serif; font-size: clamp(56px, 9vw, 112px); line-height: 1.15; color: var(--band-ink); overflow-wrap: anywhere; }
.showcase .teaser-caption { color: var(--band-muted); font-size: var(--text-s); margin-bottom: var(--space-4); }
.showcase-styles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.showcase-styles li { display: grid; gap: 4px; padding: var(--space-3); border-radius: var(--radius-key); background: rgb(255 255 255 / 0.06); min-width: 0; container-type: inline-size; }
/* Each small look fits its box: the name shrinks with the box rather than breaking onto a second line. */
.mini { font-size: clamp(11px, 15cqi, 26px); line-height: 1.2; white-space: nowrap; overflow: hidden; }
.mini-label { font-size: 11px; color: var(--band-muted); }
@media (max-width: 720px) {
  .showcase-inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .showcase-art { order: -1; }
}
@media (prefers-reduced-motion: reduce) { .showcase-art { transition: none; } }

/* Sharing a name page. */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.share-label { font-size: var(--text-xs); color: var(--muted); margin-inline-end: var(--space-1); }
.share-link {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: transparent; color: var(--ink); text-decoration: none; font: inherit; font-size: var(--text-xs); cursor: pointer;
}
.share-link:hover { border-color: var(--accent); }
.share-link[hidden] { display: none; }
.share-whatsapp { background: #1F8A4C; border-color: #1F8A4C; color: #FFFFFF; font-weight: 500; }
.share-whatsapp:hover { border-color: #1F8A4C; filter: brightness(1.08); }
.share-link.is-done { background: var(--success); border-color: var(--success); color: var(--on-accent); }

/* The picture maker. */
.picture-maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; margin-top: var(--space-4); }
.picture-controls { display: grid; gap: var(--space-4); align-content: start; }
.picture-controls fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.picture-controls legend { font-weight: 500; margin-bottom: var(--space-2); padding: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); cursor: pointer; font-size: var(--text-xs);
}
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.picture-style { display: grid; gap: var(--space-2); font-weight: 500; }
.picture-style select { font-weight: 400; min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-key); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.picture-controls .action { justify-self: start; }
.picture-preview { justify-self: center; width: auto; height: auto; max-width: 100%; max-height: 520px; border-radius: var(--radius-panel); border: 1px solid var(--line); background: var(--surface); }
@media (max-width: 720px) { .picture-maker { grid-template-columns: minmax(0, 1fr); } }

/* The wall of popular names on the name maker. */
.name-wall { list-style: none; padding: 0; margin: var(--space-3) 0 var(--space-6); display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); }
.name-wall a {
  display: grid; justify-items: center; gap: var(--space-1); padding: var(--space-4) var(--space-2);
  border-radius: var(--radius-panel); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.name-wall a:hover { border-color: var(--accent); }
.name-wall li { container-type: inline-size; }
.wall-tif { font-family: "Tifinagh ircam", var(--font-tifinagh), sans-serif; font-size: clamp(14px, 15cqi, 34px); line-height: 1.2; white-space: nowrap; text-align: center; }
.wall-name { font-size: var(--text-xs); color: var(--muted); }
