/* StyloFont theme: indigo → cyan "ink" identity, light + dark. */
:root {
  --bg: #f7f8fc; --bg-2: #eef1fb; --card: #ffffff; --ink: #141a33; --muted: #646b86; --line: #e3e7f3;
  --brand: #4f46e5; --brand-2: #06b6d4; --brand-ink: #fff; --brand-soft: #eef0ff; --fav: #e11d48;
  --grad: linear-gradient(120deg, var(--brand) 0%, #7c3aed 45%, var(--brand-2) 100%);
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 26, 51, .05), 0 8px 24px -12px rgba(20, 26, 51, .18);
  --shadow-lg: 0 18px 40px -18px rgba(79, 70, 229, .45);
  --display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', Tahoma, sans-serif;
  color: var(--ink); background: var(--bg); color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1020; --bg-2: #111833; --card: #141b34; --ink: #e8ebff; --muted: #9aa3c7; --line: #232c4d;
  --brand: #818cf8; --brand-2: #22d3ee; --brand-soft: #1d2450; --fav: #fb7185;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6); --shadow-lg: 0 18px 40px -18px rgba(129, 140, 248, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.6; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; overflow-x: clip; }
a { color: var(--brand); }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 18px; }
button { font: inherit; color: inherit; }

/* Header */
header.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff;
  font: italic 700 20px/1 var(--display); box-shadow: var(--shadow-lg); }
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 1rem; }
.icon-btn:hover { border-color: var(--brand); }
.langs { position: relative; }
.langs summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); font-size: .9rem; font-weight: 600; }
.langs summary::-webkit-details-marker { display: none; }
.langs ul { position: absolute; inset-inline-end: 0; top: 46px; z-index: 50; margin: 0; padding: 6px; list-style: none; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 180px; }
.langs li a { display: block; padding: 9px 11px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.langs li a:hover, .langs li a[aria-current] { background: var(--brand-soft); color: var(--brand); }

/* Hero */
.hero { position: relative; padding: 46px 0 18px; text-align: center; }
.hero::before { content: ''; position: absolute; inset: -60px -40px auto; height: 320px; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 60% at 25% 30%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
              radial-gradient(35% 55% at 78% 25%, color-mix(in srgb, var(--brand-2) 22%, transparent), transparent 70%); filter: blur(10px); }
.hero h1 { margin: 0 0 10px; font-family: var(--display); font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.1; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 auto; max-width: 700px; color: var(--muted); font-size: 1.05rem; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.badges li { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--muted); }
.badges li b { color: var(--brand); }

/* Sticky tool bar */
.tool { position: sticky; top: 60px; z-index: 30; padding: 12px 0 8px; background: linear-gradient(var(--bg) 80%, transparent); }
.field { position: relative; }
.field textarea { width: 100%; min-height: 62px; max-height: 150px; resize: vertical; padding: 18px 54px 18px 20px; font: inherit; font-size: 1.15rem;
  border: 2px solid transparent; border-radius: 18px; color: var(--ink);
  background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad) border-box; box-shadow: var(--shadow-lg); }
[dir="rtl"] .field textarea { padding: 18px 20px 18px 54px; }
.field textarea::placeholder { color: var(--muted); }
.field textarea:focus { outline: none; box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow-lg); }
#clear { position: absolute; inset-inline-end: 12px; top: 14px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-size: 1rem; cursor: pointer; }
.chipbar { position: relative; margin-top: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-size: .9rem; font-weight: 600; cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-lg); }
.progress { position: absolute; inset-inline: 0; bottom: 0; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .1s linear; }

/* Style sections + cards */
.styles section { margin: 26px 0 8px; scroll-margin-top: 220px; }
.styles h2 { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.45rem; margin: 0 0 14px; }
.styles h2::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.hint { margin: 0 0 12px; padding: 11px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: .92rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { position: relative; padding: 14px 16px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; overflow: hidden; }
.card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--grad); opacity: 0; transition: opacity .15s; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: var(--shadow-lg); }
.card:hover::before, .card.flash::before { opacity: 1; }
.card.flash { border-color: var(--brand); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card .name { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acts { display: flex; align-items: center; gap: 6px; flex: none; }
.fav { width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.05rem; line-height: 1; }
.fav:hover { background: var(--brand-soft); }
.fav[aria-pressed="true"] { color: var(--fav); }
.copy { padding: 6px 13px; border: 0; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: .8rem; font-weight: 700; cursor: pointer; }
.card:hover .copy { background: var(--grad); color: #fff; }
.card .out { display: block; font-size: 1.35rem; line-height: 1.45; overflow-wrap: anywhere; min-height: 1.45em; }

/* Favorites */
#favs .empty { padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }

/* Content + link blocks */
.links { margin: 46px 0 0; text-align: center; }
.links h2 { font-family: var(--display); font-size: 1.7rem; margin: 0 0 18px; }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pills a { display: inline-flex; align-items: center; padding: 13px 24px; border-radius: 999px; background: var(--grad); color: #fff;
  text-decoration: none; font-size: .98rem; font-weight: 700; box-shadow: var(--shadow-lg); transition: transform .15s, box-shadow .15s, filter .15s; }
.pills a:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 22px 44px -18px rgba(79, 70, 229, .6); }
.pills a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 3px; }
.seeall { margin: 14px 0 0; font-weight: 700; }
.content { margin: 44px 0; padding: 26px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.content h2 { font-family: var(--display); font-size: 1.5rem; margin: 26px 0 10px; }
.content h2:first-child { margin-top: 0; }
.content ol { padding-inline-start: 22px; }
.content li { margin: 6px 0; }
.content details { border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px; margin: 9px 0; background: var(--bg); }
.content summary { cursor: pointer; font-weight: 700; }
.content details[open] summary { color: var(--brand); }
.content details p { margin: 8px 0 0; color: var(--muted); }

/* Footer */
footer.bottom { border-top: 1px solid var(--line); background: var(--bg-2); padding: 44px 0 0; font-size: .92rem; color: var(--muted); }
.fgrid { display: grid; grid-template-columns: 1.3fr 1fr 1fr .8fr; gap: 32px; }
.fbrand p { margin: 12px 0 0; max-width: 290px; line-height: 1.55; }
.fcol h3 { margin: 4px 0 14px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.fcol ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
footer.bottom a { color: var(--muted); text-decoration: none; transition: color .15s; }
footer.bottom a:hover, footer.bottom a[aria-current] { color: var(--brand); }
.fbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: 36px; padding: 18px 0 22px; border-top: 1px solid var(--line); font-size: .86rem; }
.fbar nav { display: flex; gap: 18px; }

@media (max-width: 860px) { .fgrid { grid-template-columns: 1fr 1fr; } .fbrand { grid-column: 1 / -1; } }
@media (max-width: 420px) { .fgrid { gap: 26px 18px; } .fbar { justify-content: center; } }

/* Floating bits */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--grad); color: #fff; padding: 11px 20px; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow-lg); transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#top { position: fixed; inset-inline-end: 18px; bottom: 22px; z-index: 55; width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: var(--grad); color: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .2s; }
#top.show { opacity: 1; pointer-events: auto; }

.legal { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 26px; margin: 28px 0; box-shadow: var(--shadow); }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .hero { padding-top: 30px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card .out { font-size: 1.2rem; }
  .content { padding: 18px; }
  .langs summary .lang-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
