/* ==========================================================================
   فِهرس الألف فكرة — stylesheet
   Ported from the v2 design. The identity is fixed to the «سِدر» palette
   defined in :root below — no theme switcher, no background patterns, and no
   colour computed at runtime.
   ========================================================================== */

@font-face {
  font-family: 'Alexandria';
  src: url('/assets/fonts/alexandria-arabic.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011,
                 U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'Alexandria';
  src: url('/assets/fonts/alexandria-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('/assets/fonts/grotesk-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2212;
}

:root {
  /* Palette «سِدر» — the house identity, taken verbatim from the v2 design.
     The identity is fixed: there is no theme switcher and no runtime colour
     logic, so these values are the single definition of the brand. */
  --bg: #EDEBE2;  --surf: #FFFEFA;  --panel: #F5F3EA;
  --ink: #2C3A2E; --body: #4A5A4C;  --muted: #8A968A;
  --line: #E0E2D6;
  --pri: #3F6B45; --pri-text: #33573A; --on-pri: #F6FBF5;
  --tint: #E2EFE3; --acc: #8A5A2B;  --acc-tint: #F5E7D6;

  /* Ink as raw channels, for scrims and shadows. */
  --veil-rgb: 44, 58, 46;

  --ar: 'Alexandria', system-ui, -apple-system, sans-serif;
  --mono: 'Space Grotesk', ui-monospace, 'SF Mono', monospace;

  --r-sm: 11px; --r-md: 13px; --r-lg: 18px; --r-pill: 999px;
  --header-h: 64px;
  --sidebar-w: 270px;
  --shadow-lift: 0 14px 28px -18px var(--pri);
  --shadow-modal: 0 40px 90px -30px rgba(var(--veil-rgb), 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ar);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.is-static { overflow: auto; }

a { color: var(--pri-text); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: transform .16s cubic-bezier(.2,.7,.2,1), background-color .26s ease,
              border-color .26s ease, box-shadow .24s ease, color .22s ease;
}
button:active { transform: scale(.97); }

/* Accent, not primary: selected items already carry a primary-coloured border,
   so a primary focus ring on top of one would be hard to tell apart. */
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn  { from { opacity: 0; transform: scale(.96) translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position-x: -200%; } }

/* ── Server-rendered layer ────────────────────────────────────────────────── */

.seo {
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.seo h1 { font-size: 30px; font-weight: 600; letter-spacing: -.7px; margin-bottom: 14px; }
.seo h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 34px 0 12px; }
.seo-lede { font-size: 15px; line-height: 1.9; color: var(--body); max-width: 60ch; margin-bottom: 8px; }
.seo-count { font-size: 15px; color: var(--body); margin-top: 12px; }
.seo-crumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.seo-domains { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.seo-domains a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surf); color: var(--ink); font-size: 13.5px;
}
.seo-domains a:hover { border-color: var(--pri); text-decoration: none; }
.seo-domains span { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ── Application shell ────────────────────────────────────────────────────── */

.app { height: 100dvh; display: flex; flex-direction: column; background: var(--surf); }

.hdr {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; flex: none; position: relative; z-index: 30;
  background-color: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: none;
  background: var(--pri); color: var(--on-pri);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; letter-spacing: -.3px;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-title { font-size: 16px; font-weight: 600; color: var(--ink); white-space: nowrap; line-height: 1.4; }
.brand-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; line-height: 1.4; }

/* `flex: 1` alone let the brand, the two button groups and the about button
   squeeze this down to 54px on a ~800px window — a field you cannot read what
   you are typing in. min-width holds a usable size and makes .hdr wrap instead. */
.search { flex: 1 1 240px; min-width: 240px; max-width: 420px; position: relative; }
.search input {
  width: 100%; font-family: inherit; font-size: 13.5px;
  /* Logical, not physical: .search-clear is pinned to inset-inline-start, which
     is the right-hand side in RTL — exactly where the Arabic text begins. The
     reserved padding has to follow the button, or the first letters typed slide
     underneath it. */
  padding-block: 10px;
  padding-inline: 38px 14px;
  color: var(--ink); background: var(--surf);
  border: 1px solid var(--line); border-radius: var(--r-md); outline: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--pri); }
/* type="search" ships a browser-drawn clear button that we neither style nor
   control, so the field showed two ✕ at once, on opposite sides. */
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear {
  position: absolute; inset-inline-start: 9px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tint); color: var(--pri-text); font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.search-clear:active { transform: translateY(-50%) scale(.92); }

.seg { display: flex; gap: 6px; flex: none; }
.seg button {
  padding: 8px 14px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surf); color: var(--body); white-space: nowrap;
}
.seg button:hover { border-color: var(--pri); color: var(--pri-text); }
.seg button[aria-pressed="true"] { background: var(--pri); border-color: var(--pri); color: var(--on-pri); }

.hdr-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.viewtoggle {
  display: flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surf);
}
.viewtoggle button {
  padding: 6px 13px; font-size: 12px; border-radius: var(--r-pill); color: var(--muted);
}
.viewtoggle button[aria-pressed="true"] { background: var(--tint); color: var(--pri-text); font-weight: 600; }

.btn-primary {
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 16px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--pri); border-radius: var(--r-pill);
  background: var(--pri); color: var(--on-pri);
}
.btn-primary:hover { opacity: .88; }

.btn-ghost {
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 15px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surf); color: var(--body);
}
.btn-ghost:hover { border-color: var(--pri); color: var(--pri-text); }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surf); color: var(--ink);
  display: none; align-items: center; justify-content: center; font-size: 16px; flex: none;
}

/* ── Body: sidebar + content ──────────────────────────────────────────────── */

/* Positioning context for the mobile domain drawer — see the media query below. */
.main { display: flex; flex: 1; min-height: 0; position: relative; }

.sidebar {
  width: var(--sidebar-w); flex: none; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 10px 24px;
  background-color: var(--panel);
  border-inline-start: 1px solid var(--line);
}
.dom {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: start;
  padding: 10px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; line-height: 1.55;
}
.dom:hover { background: var(--surf); }
/* Selected state per the design: tinted fill, primary border. */
.dom[aria-pressed="true"] { background: var(--tint); border-color: var(--pri); }
.dom[aria-pressed="true"]:hover { background: var(--tint); }
.dom-no { font-family: var(--mono); font-size: 10px; color: var(--muted); padding-top: 3px; flex: none; }
.dom-name { flex: 1; font-size: 13px; color: var(--ink); }
.dom-total { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding-top: 2px; flex: none; }
.dom-all { font-weight: 600; }
.sidebar hr { border: none; height: 1px; background: var(--line); margin: 10px 4px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.listbar {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 16px 22px 12px; flex: none;
}
.listbar h2 { font-size: 16.5px; font-weight: 600; color: var(--ink); }
.listbar .count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.listbar .sub { font-size: 11.5px; color: var(--muted); margin-inline-start: auto; }

.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 22px 28px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.card {
  display: flex; flex-direction: column; gap: 7px; text-align: start;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surf);
}
.card:hover { border-color: var(--pri); box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.card-head { display: flex; align-items: baseline; gap: 8px; width: 100%; }
.card-name {
  font-family: var(--mono); font-size: 15.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr;
}
.card-meta { font-size: 11.5px; color: var(--muted); }
.card-desc { font-size: 12.5px; line-height: 1.7; color: var(--body); }

.tag {
  font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-pill);
  margin-inline-start: auto; flex: none; white-space: nowrap;
}
.tag-t  { color: var(--acc); background: var(--acc-tint); }
.tag-nt { color: var(--pri-text); background: var(--tint); }

/* List view: index column + detail pane */

.split { display: flex; flex: 1; min-height: 0; }
.index {
  width: 380px; flex: none; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surf); border-inline-start: 1px solid var(--line);
}
.index-head {
  position: sticky; top: 0; z-index: 2; background: var(--surf);
  padding: 14px 18px 11px; border-bottom: 1px solid var(--line);
}
.index-list { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.row {
  display: block; width: 100%; text-align: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surf);
}

/* Only freshly appended items animate in. The view re-renders on every state
   change, so animating unconditionally would flash the whole list on each
   keystroke and on every appended page. */
.card.is-new, .row.is-new { animation: fadeUp .3s ease both; }
.row:hover { border-color: var(--pri); }
.row[aria-current="true"] { border-color: var(--pri); background: var(--tint); }
.row-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.row-name { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--ink); direction: ltr; }
.row-meta { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.row-desc { display: block; font-size: 12.5px; line-height: 1.65; color: var(--body); }

.detail-pane { flex: 1; overflow-y: auto; background: var(--surf); min-width: 0; }

/* ── Idea detail: filled identity panel + reading column ──────────────────── */

.detail-split { display: flex; min-height: 100%; }

/* Identity panel. In RTL this sits on the right, which is where reading starts. */
.detail-side {
  flex: 0 0 34%; max-width: 360px;
  display: flex; flex-direction: column; gap: 14px;
  padding: 30px 30px 26px;
  background: var(--pri); color: var(--on-pri);
}
.detail-entry { font-family: var(--mono); font-size: 12px; color: rgba(255,255,255,.62); }
.detail-name {
  font-family: var(--mono); font-size: 34px; font-weight: 600; line-height: 1.1;
  letter-spacing: -1px; color: var(--on-pri); direction: ltr; word-break: break-word;
}
.detail-side .detail-country {
  display: inline-flex; align-items: center;
  font-size: 17px; color: rgba(255,255,255,.92);
}
.detail-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  padding: 5px 12px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 500; color: var(--on-pri); white-space: nowrap;
}
.pill-type { background: rgba(255,255,255,.22); }
.pill-spec { background: rgba(255,255,255,.12); }

.detail-side-foot {
  margin-top: auto; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.2);
  display: flex; flex-direction: column; gap: 16px;
}
.detail-side-label { font-size: 11.5px; color: rgba(255,255,255,.6); margin-bottom: 5px; }
.detail-domain {
  padding: 0; border: none; background: none; text-align: start;
  font-family: inherit; font-size: 15px; color: var(--on-pri);
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 4px;
}
.detail-domain:hover { text-decoration-color: rgba(255,255,255,.7); }
.detail-link {
  font-family: var(--mono); font-size: 14px; color: var(--on-pri); direction: ltr;
}
.detail-link:hover { text-decoration-color: rgba(255,255,255,.7); }

/* Reading column */
.detail-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 14px;
  padding: 30px 34px 28px; background: var(--surf);
}
.detail-label { font-size: 12px; color: var(--muted); }
.detail-what { font-size: 22px; line-height: 1.6; color: var(--ink); text-wrap: pretty; }
.detail-offers { font-size: 15px; line-height: 1.85; color: var(--body); text-wrap: pretty; }

.edge {
  position: relative; overflow: hidden; border-radius: 14px;
  padding: 18px 22px; background-color: var(--tint);
}
.edge::before { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 4px; background: var(--pri); }
.edge::after {
  content: '\201D'; position: absolute; top: -6px; left: 14px;
  font-size: 64px; line-height: 1; color: var(--pri); opacity: .18; font-family: Georgia, serif;
}
.edge-label { position: relative; display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.edge-label span { font-size: 12px; font-weight: 600; color: var(--pri-text); }
.edge-text { position: relative; font-size: 16px; line-height: 1.85; color: var(--ink); text-wrap: pretty; }

.similar { margin-top: 4px; }
.similar-label { font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.similar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.similar-card {
  display: flex; flex-direction: column; gap: 5px; text-align: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf);
}
.similar-card:hover { border-color: var(--pri); transform: translateY(-2px); }
.similar-name {
  font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr;
}
.similar-meta { font-size: 11.5px; color: var(--muted); }

.detail-nav { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 9px; }
.detail-nav button {
  padding: 9px 16px; font-size: 13px; color: var(--body);
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surf);
}
.detail-nav button:hover:not(:disabled) { border-color: var(--pri); color: var(--pri-text); }
.detail-nav button:disabled { opacity: .4; cursor: default; }
.detail-pos { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ── Overlays ─────────────────────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; z-index: 80; padding: 32px;
  background: rgba(var(--veil-rgb), .45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.sheet {
  width: min(620px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--surf); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-modal); animation: popIn .26s cubic-bezier(.2,.7,.2,1) both;
}
.sheet-wide { width: min(880px, 100%); }
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 22px 26px 18px;
  background-color: var(--tint);
  border-bottom: 1px solid var(--line); border-radius: 20px 20px 0 0;
}
.sheet-title { font-size: 18px; font-weight: 600; color: var(--ink); }
.sheet-body { padding: 22px 26px 26px; display: flex; flex-direction: column; gap: 16px; }
.sheet-close {
  margin-inline-start: auto; width: 30px; height: 30px; flex: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surf); color: var(--ink); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.sheet-close:hover { border-color: var(--pri); color: var(--pri-text); }

/* Idea modals carry their own header, so the close button floats over it
   instead of sitting in a second, redundant title bar. */
.sheet { position: relative; }
.sheet-close-float { position: absolute; top: 20px; left: 20px; z-index: 3; margin: 0; }

/* The identity panel is flush to the modal edge, so the panel must be clipped
   by the modal's own radius rather than painting over the corner. */
.sheet:has(.detail-split) { overflow: hidden; }

.about-block h3 { font-size: 11px; font-weight: 600; color: var(--pri-text); letter-spacing: .1em; margin-bottom: 7px; }
.about-block p { font-size: 14.5px; line-height: 1.9; color: var(--ink); text-wrap: pretty; }
.about-contact {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
}
.about-contact span { font-size: 11px; font-weight: 600; color: var(--muted); }


/* ── Footer / status ──────────────────────────────────────────────────────── */

.foot {
  display: flex; align-items: center; gap: 12px; flex: none; flex-wrap: wrap;
  padding: 9px 20px; border-top: 1px solid var(--line); background: var(--surf);
}
.foot-label { font-size: 11.5px; color: var(--muted); }
.foot-bar { flex: 1; max-width: 220px; height: 5px; background: var(--tint); border-radius: var(--r-pill); overflow: hidden; }
.foot-fill { height: 100%; background: var(--pri); border-radius: var(--r-pill); transition: width .4s cubic-bezier(.2,.7,.2,1); }
.foot-count { font-family: var(--mono); font-size: 11.5px; color: var(--body); }
.foot-note { margin-inline-start: auto; font-size: 11.5px; color: var(--muted); }

/* ── States ───────────────────────────────────────────────────────────────── */

.empty {
  margin: 12px auto; max-width: 460px; padding: 30px 20px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: 14px;
  background-color: var(--panel);
  animation: popIn .3s ease both;
}
.empty-title { font-size: 16px; color: var(--ink); margin-bottom: 7px; }
.empty-body { font-size: 12.5px; color: var(--body); line-height: 1.8; }

.skeleton {
  border: 1px solid var(--line); border-radius: var(--r-md); height: 118px;
  background: linear-gradient(100deg, var(--panel) 30%, var(--surf) 50%, var(--panel) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.sentinel { height: 1px; }
.loading-more { padding: 18px; text-align: center; font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; inset-block-end: 22px; inset-inline-start: 50%;
  transform: translateX(50%); z-index: 90;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--surf); font-size: 12.5px;
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.6); animation: popIn .22s ease both;
}
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pri); flex: none; }

.scrim { position: fixed; inset: 0; background: rgba(var(--veil-rgb), .35); z-index: 25; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .index { width: 320px; }
}

@media (max-width: 900px) {
  .icon-btn { display: flex; }
  /* The page is RTL, so the drawer lives on the right. `right` and `translateX`
     are used rather than logical properties because CSS transforms ignore
     writing direction — pairing translateX(100%) with inset-inline-end pushes
     the panel into view instead of out of it.

     It is positioned against .main, NOT the viewport. Anchored to the viewport
     at top:0 it began underneath the opaque header, which wraps to ~194px on a
     narrow phone, so the reset control and the first three domains were behind
     it with scrollTop already 0 — unreachable. .main starts below the header by
     construction, so this holds whatever height the header takes. */
  .sidebar {
    position: absolute; top: 0; bottom: 0; right: 0; left: auto; z-index: 26;
    width: 290px; max-width: 85vw; box-shadow: var(--shadow-modal);
    transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.7,.2,1);
  }
  .sidebar.open { transform: translateX(0); }
  .brand-sub { display: none; }
  .seg button { padding: 8px 11px; }
  .split { flex-direction: column; }
  .index { width: auto; border-inline-start: none; }
  .detail-pane { display: none; }
  .similar-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-head { padding: 22px 20px 18px; }
  .detail-body { padding: 18px 20px 26px; }
  .detail-name { font-size: 27px; }
  .overlay { padding: 0; align-items: flex-end; }
  .sheet { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .sheet-head { border-radius: 20px 20px 0 0; }
}

@media (max-width: 900px) {
  /* Give the field its own full-width row as soon as the header gets tight —
     the same width at which the sidebar becomes a drawer. It used to wait until
     640px, so every tablet and small laptop got a sliver of a search box. */
  .search { order: 3; flex-basis: 100%; max-width: none; }
}

@media (max-width: 640px) {
  .hdr { gap: 10px; padding: 10px 14px; }
  .grid { grid-template-columns: 1fr; }
  .similar-grid { grid-template-columns: 1fr; }
  .scroller, .listbar { padding-inline: 14px; }
  .foot-note { display: none; }
  .btn-primary span, .btn-ghost span { display: none; }
  .seo { padding: 34px 18px 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Marker on the domain currently in view — matches the design's sidebar dot. */
.dom-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--pri); margin-top: 6px;
}

/* Random-idea entry point. It lives beside the list heading rather than in the
   header — the design keeps a single header button, and this way the feature
   stays reachable on touch devices, where the R shortcut does not exist. */
.btn-suggest {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 12px; font-size: 12px; color: var(--pri-text);
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surf);
}
.btn-suggest:hover { border-color: var(--pri); background: var(--tint); }
@media (max-width: 640px) { .btn-suggest span { display: none; } }

/* Country flag beside the name in the idea detail. */
.flag { width: 1.2em; height: 1.2em; flex: none; margin-inline-end: 8px; border-radius: 50%; }
.detail-country { display: inline-flex; align-items: center; }

@media (max-width: 860px) {
  /* Stack the panel above the content instead of squeezing two columns. */
  .detail-split { flex-direction: column; }
  .detail-side { flex: none; max-width: none; padding: 24px 22px 20px; gap: 11px; }
  .detail-side-foot { margin-top: 14px; padding-top: 16px; flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 12px; }
  .detail-name { font-size: 28px; }
  .detail-main { padding: 22px; }
  .detail-what { font-size: 19px; }
  .similar-grid { grid-template-columns: 1fr; }
}
