/* Hub pages (navigation/resources.html, navigation/learning.html): the icon tiles, admin controls and edit modals. */

#background-canvas { position: fixed; top: 30%; left: 0; z-index: -1; }

/* width / margin come from the shared .content (styles/stylesheet.css) */
.content { margin-bottom: 5%; }

/* ── Admin controls ── */
.admin-only { display: none; }
body.admin-mode .admin-only { display: inline-flex; }

.adm-btn {
  background: none; border: none; cursor: pointer;
  font-size: 13px; padding: 2px 6px; border-radius: 2px;
  font-family: 'Optima', arial, sans-serif;
  min-height: unset !important; min-width: unset !important;
}
.adm-add  { color: #1d60c0; border: 1px solid rgba(0,80,200,0.25); background: rgba(0,80,200,0.06); }
.adm-add:hover  { background: rgba(0,80,200,0.14); }
.adm-del  { color: #c00; border: 1px solid rgba(200,0,0,0.2); background: rgba(200,0,0,0.05); }
.adm-del:hover  { background: rgba(200,0,0,0.14); }
.adm-edit { color: #666; border: 1px solid #ddd; }
.adm-edit:hover { background: #f0f0f0; }

/* Inline icon controls */
.adm-plus {
  background: none; border: none; cursor: pointer;
  color: #4caf50; font-size: 18px; line-height: 1;
  padding: 0 2px; font-weight: 300;
  min-height: unset !important; min-width: unset !important;
}
.adm-plus:hover { color: #2e7d32; }
.adm-text-del {
  background: none; border: none; cursor: pointer;
  color: #c00; font-size: 11px; letter-spacing: 0.04em;
  padding: 0; font-family: 'Optima', arial, sans-serif;
  min-height: unset !important; min-width: unset !important;
  opacity: 0.7;
}
.adm-text-del:hover { opacity: 1; text-decoration: underline; }

.section-header-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.section-header-row .section-header { margin-bottom: 0; }

.item-admin-btns {
  display: none; gap: 4px; position: absolute; top: 6px; right: 6px;
}
body.admin-mode .category-card:hover .item-admin-btns,
body.admin-mode .cat-tile:hover .item-admin-btns,
body.admin-mode .subcategory-item:hover .item-admin-btns { display: flex; }
.category-card, .cat-tile { position: relative; }
.subcategory-item { position: relative; }

.add-section-row {
  display: none; margin-top: 30px; padding-top: 20px;
  border-top: 1px dashed #ddd;
}
body.admin-mode .add-section-row { display: flex; gap: 10px; align-items: center; }

/* ── Modal ── */
.res-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 600;
  align-items: center; justify-content: center;
}
.res-modal.active { display: flex; }
.res-modal-box {
  background: #fff; padding: 28px 32px 30px;
  width: 420px; max-width: 94vw;
  border: 1px solid #ddd;
}
.res-modal-box h3 { font-weight: 300; font-size: 19px; margin: 0 0 18px; color: #444; }
.res-modal-box label { display: block; font-size: 12px; color: #999; margin: 12px 0 3px; }
.res-modal-box input, .res-modal-box select, .res-modal-box textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid #ddd; padding: 7px 9px;
  font-family: 'Optima', arial, sans-serif; font-size: 14px;
  color: #444; background: #fafafa; outline: none;
  min-height: unset !important;
}
.res-modal-box textarea { resize: vertical; min-height: 50px; }
.res-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.res-modal-save {
  background: rgba(210,245,250,0.5); border: 1px solid rgba(143,97,77,0.35);
  color: #1d60c0; font-family: 'Optima', arial, sans-serif;
  font-size: 14px; padding: 8px 20px; cursor: pointer;
  min-height: unset !important;
}
.res-modal-save:hover { background: #c2e2e787; }
.res-modal-cancel {
  background: none; border: 1px solid #ddd; color: #999;
  font-family: 'Optima', arial, sans-serif;
  font-size: 14px; padding: 8px 16px; cursor: pointer;
  min-height: unset !important;
}
.res-modal-cancel:hover { border-color: #aaa; color: #555; }

/* ── Layout of the groups (tablet and up) ──
   The groups (By Function, By Topic, More) take 80% of the content width. The gap between the three is the same
   everywhere; the gap after the page description is the largest of all. */
@media (min-width: 769px) {
    body.p-resources .content > #resources-body,
    body.p-resources .content > .section-block { width: 80%; margin-left: 20px; }   /* indented under the description */

    /* each group's rule runs the full width of the group, and its tiles are inset from the sides */
    body.p-resources .section-header-row .section-header { flex: 1; }
    body.p-resources .category-grid { padding: 0 16px; }
    body.p-resources .learning-note { margin: 0 16px; }

    .resources-intro { margin-bottom: 64px; }
    .section-block { margin-top: 44px; margin-bottom: 0; }
    .section-block .section-header { margin: 0; }
    .section-header-row { margin-bottom: 22px; }
}

/* ── Hub tiles: plain text — icon + title, a bullet list under it.
   Hover: the tile slides right, icon and title turn green, and an arrow slides in. ── */

/* By Function: four to a row. By Topic: five, all on one line. (Two across on tablets, one on phones.) */
.category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}
.section-block[data-id="topics"] .category-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* Learning (the Guides): three to a row */
.section-block[data-id="guides"] .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) {
    .category-grid,
    .section-block[data-id="topics"] .category-grid,
    .section-block[data-id="guides"] .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cat-tile {
    display: block;
    box-sizing: border-box;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #444;
    text-decoration: none;
    font-family: 'Optima', arial, sans-serif;
    transition: transform 0.28s ease, border-color 0.28s ease;
}
.cat-tile:hover,
.cat-tile:focus-visible { transform: translateX(8px); border-color: #45a049; }

.cat-head { display: flex; align-items: center; gap: 10px; }

.cat-icon {
    flex: none;
    width: 24px;
    height: 24px;
    color: #888f8d;
    transition: color 0.28s ease, transform 0.28s ease;
}

.cat-title {
    font-size: 20px;
    font-weight: 300;
    line-height: 1.2;
    color: #444;
    transition: color 0.28s ease;
}

.cat-arrow {
    margin-left: -2px;
    font-size: 18px;
    color: #45a049;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.cat-tile:hover .cat-icon,
.cat-tile:focus-visible .cat-icon,
.cat-tile:hover .cat-title,
.cat-tile:focus-visible .cat-title { color: #45a049; }
.cat-tile:hover .cat-icon { transform: scale(1.08); }
.cat-tile:hover .cat-arrow,
.cat-tile:focus-visible .cat-arrow { opacity: 1; transform: translateX(0); }

.cat-list {
    margin: 8px 0 0;
    padding-left: 25px;
    list-style: disc;
    font-size: 17px;
    line-height: 1.4;
    color: #888f8d;
}
.cat-list li { margin-bottom: 1px; }
.cat-desc { margin: 8px 0 0; font-size: 17px; line-height: 1.4; color: #888f8d; }

@media (min-width: 769px) {
    /* five tiles across 80% of the page: a little less padding so the bullets don't wrap so much */
    .section-block[data-id="topics"] .cat-tile { padding: 10px 10px; }
    .section-block[data-id="topics"] .cat-head { gap: 8px; }
    .section-block[data-id="topics"] .cat-list { padding-left: 22px; font-size: 16px; }

    /* the first group, By Function: roomier tiles, no icons, and titles smaller than the "By Function" heading (24px) */
    .section-block[data-id="cat"] .cat-tile { padding: 16px 14px 12px; }
    .section-block[data-id="cat"] .cat-title { font-size: 20px; }
    .section-block[data-id="cat"] .cat-arrow { font-size: 18px; }
    .section-block[data-id="cat"] .cat-list { padding-left: 20px; font-size: 17px; margin-top: 10px; }
}
.section-block[data-id="cat"] .cat-icon { display: none; }

/* "More" → the Learning page. Padded 20px like the tiles above, so its text lines up with theirs. */
.learning-note {
    display: block;
    box-sizing: border-box;
    padding: 10px 10px;
    border: 1px solid transparent;
    border-radius: 3px;
    text-decoration: none;
    font-family: 'Optima', arial, sans-serif;
    color: #444;
    transition: border-color 0.28s ease;
}
.learning-note:hover { border-color: #45a049; }
.learning-note-title { display: block; font-size: 20px; font-weight: 300; }
.learning-note-text { display: block; margin-top: 2px; font-size: 17px; color: #888f8d; transition: color 0.2s ease; }
.learning-note-arrow { display: inline-block; transition: transform 0.25s ease; }
.learning-note:hover .learning-note-text { color: #45a049; }
.learning-note:hover .learning-note-arrow { transform: translateX(6px); }

@media (prefers-reduced-motion: reduce) {
    .cat-tile, .cat-icon, .cat-arrow, .learning-note-arrow { transition: none; }
    .cat-tile:hover { transform: none; }
}
