/* ================================================================
   Types of Nouns — interactive taxonomy map for grammar-nouns.html.
   Mirrors the six branches of the mind map, each in its own colour.
   ================================================================ */

.nt-wrap { display: grid; gap: 1rem; }

/* ---- branch rail ---- */
/* one row: the seven chips stay on a single line and the rail scrolls
   sideways on narrow screens instead of wrapping */
.nt-rail { display: flex; flex-wrap: nowrap; gap: .4rem; overflow-x: auto; padding-bottom: 4px;
           scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nt-rail::-webkit-scrollbar { display: none; }
.nt-branch { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: 999px;
             min-height: 40px; flex: none; white-space: nowrap; border: 1px solid var(--border); background: var(--surface); color: var(--text);
             cursor: pointer; font-weight: 600; font-size: .84rem; font-family: inherit;
             transition: border-color .15s, background .15s, transform .15s; }
.nt-branch:hover { transform: translateY(-1px); border-color: var(--c); }
.nt-branch i { width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); display: block; flex: none; }
.nt-branch b { color: var(--text-muted); font-weight: 700; font-size: .8rem; }
.nt-branch.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.nt-branch.on b { color: var(--text); }

/* ---- the map ---- */
.nt-group { margin-bottom: 1.1rem; }
.nt-glabel { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: .95rem;
             color: var(--c); margin-bottom: .55rem; }
.nt-glabel::after { content: ''; flex: 1; height: 2px; border-radius: 2px;
                    background: color-mix(in srgb, var(--c) 35%, transparent); }

.nt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; }
.nt-card { text-align: left; border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: 14px;
           background: var(--surface); overflow: hidden; cursor: pointer; padding: 0; font-family: inherit;
           color: var(--text); transition: transform .18s, box-shadow .18s, border-color .18s; }
.nt-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 22%, transparent); }
.nt-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--bg-soft); }
/* spans (button content must be phrasing), so each needs to be told to stack */
.nt-body { display: block; padding: .6rem .7rem .7rem; }
.nt-name { display: block; font-weight: 700; font-size: .92rem; line-height: 1.3; }
.nt-mean { display: block; color: var(--text-muted); font-size: .8rem; margin-top: .2rem; line-height: 1.45; }
.nt-eg   { margin-top: .35rem; font-size: .8rem; padding: .22rem .5rem; border-radius: 6px; display: inline-block;
           background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); font-weight: 600; }

/* ---- lightbox ---- */
.nt-box { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 1rem;
          background: rgba(15, 12, 35, .72); backdrop-filter: blur(4px); }
.nt-box.on { display: grid; }
.nt-boxcard { background: var(--surface); border-radius: 20px; overflow: hidden; max-width: 460px; width: 100%;
              max-height: 92vh; overflow-y: auto; border-top: 6px solid var(--c); animation: ntUp .25s ease; }
@keyframes ntUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.nt-boxcard img { width: 100%; display: block; }
.nt-boxbody { padding: 1rem 1.15rem 1.2rem; }
.nt-boxfam { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.nt-boxname { font-size: 1.35rem; font-weight: 700; margin: .2rem 0 .35rem; }
.nt-boxmean { color: var(--text-muted); line-height: 1.55; }
.nt-boxeg { margin-top: .7rem; padding: .5rem .8rem; border-radius: 10px; font-weight: 600;
            background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); }
.nt-boxnav { display: flex; gap: .5rem; margin-top: .9rem; }
.nt-btn { flex: 1; padding: .55rem .9rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
          color: var(--text); font-weight: 600; cursor: pointer; font-family: inherit; font-size: .88rem; }
.nt-btn:hover { border-color: var(--c); }
.nt-btn.go { background: var(--module-grad); color: #fff; border-color: transparent; }

/* ---- guess game ---- */
.nt-game { border: 1px solid var(--border); border-radius: 18px; padding: 1.1rem 1.2rem; background: var(--surface); }
.nt-gtop { display: grid; grid-template-columns: 190px 1fr; gap: 1.1rem; align-items: center; }
@media (max-width: 560px) { .nt-gtop { grid-template-columns: 1fr; } }
.nt-gimg { width: 100%; max-width: 190px; aspect-ratio: 1/1; object-fit: cover; border-radius: 14px;
           margin: 0 auto; display: block; background: var(--bg-soft); }
.nt-gq { font-weight: 600; font-size: 1.05rem; margin-bottom: .7rem; }
.nt-gopts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .45rem; }
.nt-gopt { padding: .55rem .8rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft);
           color: var(--text); font-weight: 600; cursor: pointer; font-family: inherit; font-size: .88rem; text-align: left; }
.nt-gopt:hover:not(:disabled) { border-color: var(--module); }
.nt-gopt:disabled { cursor: default; }
.nt-gopt.right { border-color: #059669; background: rgba(5, 150, 105, .12); color: #059669; }
.nt-gopt.wrong { border-color: #dc2626; background: rgba(220, 38, 38, .1); color: #dc2626; }
.nt-gv { margin-top: .75rem; font-weight: 600; line-height: 1.55; }
.nt-gv .ok { color: #059669; } .nt-gv .no { color: #dc2626; }
.nt-gscore { font-size: .85rem; color: var(--text-muted); margin-top: .45rem; }

/* ---- show more ---- */
.nt-more { display: none; width: 100%; margin-top: .8rem; padding: .7rem 1rem; min-height: 44px;
           border-radius: 14px; border: 1px dashed var(--border); background: var(--bg-soft); color: var(--text);
           font-weight: 700; font-size: .9rem; font-family: inherit; cursor: pointer; }
.nt-more:hover { border-color: var(--module); }
.nt-more.on { display: block; }
.nt-card.nt-hide, .nt-group.nt-hide { display: none; }

/* ================= mobile ================= */
@media (max-width: 700px) {
  /* two across instead of one — the single biggest saving on a phone */
  .nt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .nt-name { font-size: .84rem; }
  .nt-mean { font-size: .74rem; }
  .nt-eg   { font-size: .72rem; }
  .nt-body { padding: .5rem .55rem .6rem; }

  /* one swipeable row instead of six wrapped rows */
  .nt-rail { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity;
             -webkit-overflow-scrolling: touch; padding-bottom: .3rem;
             scrollbar-width: none; -ms-overflow-style: none;
             /* fade the right edge so it reads as scrollable */
             mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
             -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .nt-rail::-webkit-scrollbar { display: none; }
  .nt-branch { flex: none; scroll-snap-align: start; }

  /* comfortable thumb targets */
  .nt-gopt, .nt-btn { min-height: 44px; }
  .nt-boxnav { flex-wrap: wrap; }
}

/* ---- compact explorer: list on the left, ONE picture on the right ---- */
.nt-ex { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
/* the list is exactly as tall as the picture card: the wrapper takes the row
   height from the card, and the list scrolls inside it */
.nt-listwrap { position: relative; min-height: 320px; }
.nt-list { position: absolute; inset: 0; display: grid; gap: .6rem; align-content: start; overflow-y: auto; padding-right: 8px; }
/* the list's scrollbar: thin, glossy, in the site gradient. Chrome drops the
   ::-webkit-scrollbar styling as soon as scrollbar-width/scrollbar-color is
   set, so those two go to Firefox only. */
.nt-list::-webkit-scrollbar { width: 6px; }
.nt-list::-webkit-scrollbar-track { background: color-mix(in srgb, var(--module) 8%, transparent); border-radius: 999px; }
.nt-list::-webkit-scrollbar-thumb { border-radius: 999px;
  background: linear-gradient(180deg, #a78bfa 0%, var(--module) 45%, #ec4899 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55); }
.nt-list::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 45%, #db2777 100%); }
.nt-list::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
@supports not selector(::-webkit-scrollbar) {
  .nt-list { scrollbar-width: thin; scrollbar-color: var(--module) color-mix(in srgb, var(--module) 8%, transparent); }
}
.nt-list .nt-group { margin-bottom: 0; }
.nt-list .nt-glabel { font-size: .8rem; margin-bottom: .35rem; }
.nt-item { display: grid; grid-template-columns: auto 1fr; gap: 0 .5rem; align-items: center; width: 100%; text-align: left;
           padding: .45rem .6rem; margin-bottom: .25rem; border-radius: 10px; border: 1px solid transparent;
           background: transparent; color: var(--text); cursor: pointer; font-family: inherit; min-height: 40px;
           transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.nt-item i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--c); grid-row: 1 / span 2; }
.nt-iname { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.nt-ieg { font-size: .78rem; color: var(--text-muted); line-height: 1.3; }
.nt-item:hover { background: color-mix(in srgb, var(--c) 8%, transparent); transform: translateX(2px); }
.nt-item.on { background: color-mix(in srgb, var(--c) 14%, transparent); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.nt-item.on .nt-iname { color: var(--c); }
.nt-item:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }

.nt-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: center;
             border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: 16px; background: var(--surface);
             padding: 1rem; }
.nt-dpic { position: relative; padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in; background: var(--bg-soft);
           aspect-ratio: 1 / 1; width: 100%; max-width: 380px; margin: 0 auto; display: block; }
.nt-dpic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.nt-dpic:hover img { transform: scale(1.03); }
.nt-dzoom { position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
            background: rgba(255,255,255,.9); font-size: .95rem; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.nt-dbody .nt-boxnav { margin-top: 1rem; }
@keyframes ntSwap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.nt-detail.nt-swap { animation: ntSwap .3s ease both; }
@media (max-width: 860px) {
  .nt-ex { grid-template-columns: 1fr; }
  .nt-listwrap { min-height: 0; }
  .nt-list { position: static; max-height: none; overflow: visible; display: flex; flex-wrap: wrap; gap: .4rem; }
  .nt-list .nt-group { display: contents; }
  .nt-list .nt-glabel { display: none; }
  .nt-item { width: auto; grid-template-columns: auto auto; min-height: 36px; padding: .35rem .7rem; border-radius: 999px;
             border-color: var(--border); background: var(--surface); }
  .nt-item i { grid-row: 1; }
  .nt-ieg { display: none; }
  .nt-detail { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .nt-item, .nt-dpic img, .nt-detail.nt-swap { transition: none; animation: none; } }

/* ---- rules & tricks under the picture (content from the 6-family cards) ---- */
.nt-rules { grid-column: 1 / -1; border-top: 1px dashed color-mix(in srgb, var(--c) 35%, transparent); padding-top: .6rem; margin-top: .2rem; }
.nt-rules > summary { list-style: none; cursor: pointer; font-weight: 700; font-size: .95rem; color: var(--c);
                      display: flex; align-items: center; justify-content: space-between; padding: .3rem 0; }
.nt-rules > summary::-webkit-details-marker { display: none; }
.nt-rules > summary::after { content: "▾"; transition: transform .18s; }
.nt-rules:not([open]) > summary::after { transform: rotate(-90deg); }
.nt-rules .nsm-fam { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; background: none; border: 0; overflow: visible; padding: .5rem 0 0; }
.nt-rules .nsm-fam .more { display: contents; }
.nt-rules .nsm-fam .more > * { margin: 0; }
.nt-rules .nt-notes { grid-column: 1 / -1; display: grid; gap: .4rem; }
.nt-rules .nsm-type.nsm-note { display: grid; grid-template-columns: 150px 1fr; gap: 2px 10px; align-items: baseline; padding: .45rem .7rem; border-radius: 10px;
                                background: color-mix(in srgb, var(--c) 8%, var(--surface)); font-size: .92rem; line-height: 1.5; }
.nt-rules .nsm-type.nsm-note b { color: var(--c); }
.nt-rules .nsm-type.nsm-note span b { color: var(--text); }
.nt-rules .subcard, .nt-rules .note, .nt-rules .g-tip, .nt-rules .g-tblwrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; font-size: .92rem; line-height: 1.5; }
.nt-rules .g-tblwrap { padding: 0; overflow: hidden; }
.nt-rules .g-tbl { border: 0; font-size: .9rem; }
.nt-rules .g-tip { border-style: dashed; border-color: color-mix(in srgb, var(--c) 45%, var(--border)); background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.nt-rules .g-tip-h { font-weight: 700; margin-bottom: .2rem; }
.nt-rules .g-tip-f, .nt-rules .g-ex { display: block; color: var(--text-muted); font-size: .85rem; margin-top: .25rem; }
.nt-rules .subcard-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c); margin-bottom: .2rem; }
.nt-rules .note { border-left: 3px solid var(--c); }
.nt-rules .tp-line { display: block; }
@media (max-width: 700px) { .nt-rules .nsm-fam { grid-template-columns: 1fr; } .nt-rules .nsm-type.nsm-note { grid-template-columns: 1fr; } }
