/* ========================================
   KANZ — The Field Guide
   A jeweler's notes. Quiet shelf, flat list, pearl-toned notes.
   Deliberately less visual weight than the Hadith Collection.
   ======================================== */

/* ================================================================
   SHELF ENTRY — Bottom of home view
   Hairline-bounded row, Aged Brass accent. Not a jewel-tone card.
   ================================================================ */
.fg-shelf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  width: 100%;
  margin-top: var(--space-xl);
  padding: var(--space-md) var(--space-sm);
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--text-light);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.fg-shelf:hover {
  background: rgba(168, 144, 80, 0.04);
}

.fg-shelf__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fg-shelf__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--aged-brass);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
}

.fg-shelf__subtitle {
  font-size: var(--text-xs);
  color: var(--text-lighter);
  font-style: italic;
  font-weight: var(--weight-normal);
}

.fg-shelf__chev {
  color: var(--aged-brass);
  opacity: 0.55;
  font-size: var(--text-lg);
  flex-shrink: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.fg-shelf:hover .fg-shelf__chev {
  opacity: 1;
  transform: translateX(3px);
}


/* ================================================================
   LIST VIEW — Flat list of 10 titles. No cards.
   ================================================================ */
.fg-header {
  padding: var(--space-lg) 0 var(--space-md);
  margin-bottom: var(--space-sm);
}

.fg-header__eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--aged-brass);
  margin-bottom: var(--space-sm);
}

.fg-header__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--text);
  line-height: var(--line-height-heading);
  margin-bottom: var(--space-xs);
  font-weight: var(--weight-medium);
}

.fg-header__subtitle {
  font-size: var(--text-sm);
  color: var(--text-light);
  font-style: italic;
}

.fg-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-light);
}

@keyframes fg-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fg-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  min-height: 56px;
  padding: var(--space-md) var(--space-sm);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  text-align: left;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  animation: fg-fade 400ms ease forwards;
}

.fg-list-item:hover {
  background: rgba(168, 144, 80, 0.04);
}

.fg-list-item__num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--aged-brass);
  opacity: 0.75;
  min-width: 24px;
}

.fg-list-item__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--text);
  font-weight: var(--weight-normal);
  line-height: 1.35;
}

.fg-list-item__chev {
  color: var(--aged-brass);
  opacity: 0.4;
  font-size: var(--text-lg);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.fg-list-item:hover .fg-list-item__chev {
  opacity: 1;
  transform: translateX(3px);
}


/* ================================================================
   NOTE CENTERSTAGE — Pearl-toned card, no jewel glow
   Reuses .centerstage and .centerstage__topbar from views.css.
   ================================================================ */
.fg-note {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  background: var(--pearl-bg);
  border: 1px solid var(--pearl-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  position: relative;
  box-shadow: var(--shadow);
}

.fg-note__eyebrow {
  font-size: var(--text-xxs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--aged-brass);
  opacity: 0.85;
  margin-bottom: var(--space-md);
  text-align: center;
}

.fg-note__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: #f5f0e8;
  line-height: var(--line-height-heading);
  text-align: center;
  margin: 0 0 var(--space-lg);
  font-weight: var(--weight-medium);
}

.fg-note__divider {
  width: 48px;
  height: 1px;
  background: var(--aged-brass);
  opacity: 0.5;
  margin: 0 auto var(--space-lg);
}

.fg-note__body {
  font-size: var(--text-base);
  line-height: var(--line-height-body);
  color: var(--text);
}

.fg-note__body p {
  margin: 0 0 var(--space-md);
}

.fg-note__body p:last-child {
  margin-bottom: 0;
}

.fg-note__body strong {
  color: var(--aged-brass);
  font-weight: var(--weight-semibold);
}

.fg-note__body em {
  font-style: italic;
  color: #f5f0e8;
}

.fg-note__body ul,
.fg-note__body ol {
  margin: 0 0 var(--space-md);
  padding-left: 1.3em;
}

.fg-note__body li {
  margin-bottom: 6px;
}

.fg-note__body blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border-left: 2px solid var(--aged-brass);
  background: rgba(168, 144, 80, 0.06);
  color: #f5f0e8;
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--text-base);
  line-height: 1.65;
}

.fg-note__body blockquote cite,
.fg-note__body blockquote .fg-note__cite {
  display: block;
  margin-top: var(--space-sm);
  font-style: normal;
  font-size: var(--text-xs);
  color: var(--text-light);
  letter-spacing: 0.08em;
}

.fg-note__body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: var(--text-sm);
}

.fg-note__body th {
  text-align: left;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--aged-brass);
  color: var(--aged-brass);
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: bottom;
}

.fg-note__body td {
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}

.fg-note__body tr:last-child td {
  border-bottom: none;
}

.fg-note__body .fg-note__arabic {
  font-family: var(--font-arabic);
  font-size: 1.2em;
  color: #f5f0e8;
  direction: rtl;
  unicode-bidi: isolate;
}

.fg-note__body .fg-note__source {
  display: block;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--text-light);
  font-style: normal;
  letter-spacing: 0.04em;
}

.fg-note__placeholder {
  font-style: italic;
  color: var(--text-lighter);
  text-align: center;
}

/* ================================================================
   SALAH TABLE — two-level visual encoding
   Required (rukn/wajib) = bold + gold mark
   Sunnah = muted + italic
   ================================================================ */
.fg-note__body td.fg-mark {
  width: 24px;
  padding-right: 0;
  text-align: center;
  color: var(--aged-brass);
  font-size: 0.85em;
}

.fg-note__body tr.fg-required td {
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.fg-note__body tr.fg-required em {
  color: #f5f0e8;
  font-style: italic;
}

.fg-note__body tr.fg-sunnah td {
  color: var(--text-light);
  font-weight: var(--weight-normal);
  font-style: italic;
}

.fg-note__body tr.fg-sunnah em {
  color: var(--text-light);
  font-style: italic;
}

/* Legend directly under the salah table */
.fg-note__legend {
  font-size: var(--text-xs);
  color: var(--text-light);
  line-height: 1.7;
  margin: calc(var(--space-md) * -0.5) 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-left: 2px solid var(--aged-brass);
  background: rgba(168, 144, 80, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.fg-note__legend .fg-legend-mark {
  color: var(--aged-brass);
  font-weight: var(--weight-semibold);
}

/* ================================================================
   Mobile table layout — restructured so each row reads as a small
   card with visual hierarchy, not a list of tiny UPPERCASE LABELS
   above every cell. Each table type gets a specific treatment.
   ================================================================ */
@media (max-width: 520px) {
  .fg-note__body table,
  .fg-note__body tbody {
    display: block;
    width: 100%;
  }
  .fg-note__body thead { display: none; }

  .fg-note__body tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
  }
  .fg-note__body tr:last-child { border-bottom: none; }

  .fg-note__body td {
    display: block;
    padding: 0;
    border: none;
    width: 100%;
    font-size: var(--text-sm);
    line-height: 1.55;
  }

  /* Kill the pseudo-label above each cell — hierarchy does the work now. */
  .fg-note__body td[data-label]::before { content: none; }

  /* --- 2-column tables (adab-of-dua: Window / Source) ---
     First cell = primary line, second = secondary reference. */
  .fg-note__body td:first-child {
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--text);
    letter-spacing: 0.01em;
  }
  .fg-note__body td:nth-child(2):not(:only-child) {
    color: var(--text-light);
    font-size: var(--text-xs);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
  }

  /* --- 4-column tables (hadith gradings: Grade / Arabic / Meaning / Acted upon) ---
     Grade + Arabic sit on the same line; Meaning is body; Acted upon is a tag. */
  .fg-note__body tr:has(> td:nth-child(4)) {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "grade arabic"
      "meaning meaning"
      "permit permit";
    row-gap: 4px;
    column-gap: 10px;
    align-items: baseline;
  }
  .fg-note__body tr:has(> td:nth-child(4)) > td:nth-child(1) {
    grid-area: grade;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--aged-brass);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .fg-note__body tr:has(> td:nth-child(4)) > td:nth-child(2) {
    grid-area: arabic;
    justify-self: start;
    font-size: var(--text-base);
  }
  .fg-note__body tr:has(> td:nth-child(4)) > td:nth-child(3) {
    grid-area: meaning;
    color: var(--text);
    font-size: var(--text-sm);
    line-height: 1.5;
  }
  .fg-note__body tr:has(> td:nth-child(4)) > td:nth-child(4) {
    grid-area: permit;
    font-size: var(--text-xs);
    color: var(--text-light);
    padding: 4px 0 0;
    font-style: italic;
  }

  /* --- Salah table (3 columns: mark / moment / what-is-said) --- */
  .fg-note__body td.fg-mark { display: none; }

  .fg-note__body tr.fg-required,
  .fg-note__body tr.fg-sunnah {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "moment said";
    column-gap: var(--space-md);
    align-items: baseline;
    padding: 10px var(--space-sm) 10px var(--space-sm);
  }
  .fg-note__body tr.fg-required > td:nth-child(2),
  .fg-note__body tr.fg-sunnah > td:nth-child(2) {
    grid-area: moment;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text);
  }
  .fg-note__body tr.fg-required > td:nth-child(3),
  .fg-note__body tr.fg-sunnah > td:nth-child(3) {
    grid-area: said;
    text-align: right;
    color: var(--text-light);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
  }

  /* Required rows: gold left-accent, emphasized moment */
  .fg-note__body tr.fg-required {
    border-left: 2px solid var(--aged-brass);
    padding-left: calc(var(--space-sm) - 2px);
    margin-left: 0;
  }
  .fg-note__body tr.fg-required > td:nth-child(2) {
    color: var(--aged-brass);
    font-weight: var(--weight-semibold);
  }

  /* Sunnah rows: muted, italic, no accent */
  .fg-note__body tr.fg-sunnah {
    opacity: 0.75;
  }
  .fg-note__body tr.fg-sunnah > td:nth-child(2),
  .fg-note__body tr.fg-sunnah > td:nth-child(3) {
    font-style: italic;
  }
}
