/* E-Pao! Meitei Mayek search box - the pill in the masthead.
 *
 * DEPLOY: httpdocs/css/epmayeksearch.css on e-pao.net.
 *
 * Loaded by every page that carries the Mayek block: headerpanel.html
 * (which serves seven ASP pages through <!--#include-->),
 * headerpanelnews.html (GP.asp), index.html and archive.php.
 *
 * DO NOT EDIT THE COPY INSIDE A PAGE - there isn't one any more. Edit
 * this file, then re-run inject_mayek.py, which restamps the ?v= in all
 * four pages from this file's hash. Upload the four pages with it, or
 * readers keep the cached old one for up to four hours.
 */

/* WHAT THIS IS
 * ------------
 * 63,625 Mayek articles, searchable for the first time. Target:
 * epMayekSearch.php - the reader may type English or Meitei Mayek, or
 * use the on-screen Mayek keyboard, which that page opens by default
 * whenever the query is empty.
 *
 * THE MASTHEAD IS FULL. Measured 985px wide with 969px already spent on
 * the date, the Ask-AI pill, the social icons and the Tier-3 box. So the
 * three search boxes SHARE the width rather than each owning it:
 * whichever one has focus expands and the other two give way. Nothing is
 * permanently taken from the Ask-AI pill.
 *
 * MIND THE BUDGET if you retune these widths. The social icons and the
 * Tier-3 box are floated right; the date and the two pills are in normal
 * flow. Let the flow outgrow its share and the icons drop to a second
 * line and spill out of the bar - which is silent, and only shows on a
 * wide screen. Measure after every change.
 *
 * The seal's Mayek letter is an OUTLINED PATH in the page's markup, not a
 * <text> in a Mayek font. e-pao.net loads no Meitei Mayek webfont, so a
 * <text> would be a tofu box for almost every reader. The path is the
 * same glyph, costs no request, and cannot fail.
 */

/* !important throughout: all three inputs carry inline width styles. */
#mmh-pill { display:inline-flex; align-items:center; vertical-align:middle;
            position:relative;   /* the keyboard hangs off this */
            margin:0 5px; background:#fff; border:1.5px solid #c0c0c0;
            border-radius:24px; height:26px; padding:0 4px 0 5px; gap:5px;
            box-shadow:0 1px 4px rgba(0,0,0,0.10); }

/* -- the on-screen Meitei Mayek keyboard, hanging under the box.
      Most adult Manipuris read the news in Mayek but have no way to
      TYPE it, so this is not a convenience, it is the way in. -- */
#mmh-pad { display:none; position:absolute; top:34px; left:-6px;
           z-index:9999; width:336px; padding:9px 10px 10px;
           background:#fff; border:1px solid #c9d7e3; border-radius:10px;
           box-shadow:0 6px 22px rgba(20,40,70,0.22); text-align:left;
           font-family:Verdana,Arial,sans-serif; }
#mmh-pad.on { display:block; }
#mmh-pad b { display:block; font-size:9.5px; text-transform:uppercase;
             letter-spacing:.06em; color:#7b8a99; font-weight:bold;
             margin:6px 0 3px; }
#mmh-pad b:first-child { margin-top:0; }
#mmh-pad button { font-family:'Noto Sans Meetei Mayek','Nirmala UI',serif;
                  font-size:16px; line-height:1; min-width:30px; height:27px;
                  margin:0 2px 2px 0; padding:0 3px; cursor:pointer;
                  background:#f7fafc; color:#254666;
                  border:1px solid #d6e2ec; border-radius:5px; }
#mmh-pad button:hover { background:#3097d1; color:#fff; border-color:#3097d1; }
/* The cheitap are COMBINING marks. On their own a browser draws each one
   on a dotted placeholder circle, and at the letters' size the mark
   itself is a few pixels of hairline - you cannot tell them apart. They
   get their own size, well above the letters, so the mark rather than
   the placeholder is what you see. */
#mmh-pad button.cv { font-size:25px; height:34px; min-width:34px;
                     line-height:1; padding-bottom:2px; }
#mmh-pad .wide { font-family:Verdana,Arial,sans-serif; font-size:10.5px;
                 min-width:64px; }
#mmh-pad .more { display:block; margin-top:7px; font-size:10.5px;
                 color:#3097d1; text-decoration:none; }
#mmh-pad .more:hover { text-decoration:underline; }
@media (max-width:560px) {
  /* hang it off the RIGHT edge of the box, never off the screen: the
     pill sits near the right of a 355px bar, so a left-anchored panel
     runs off into nothing. max-width is the backstop. */
  #mmh-pad { left:auto; right:0; width:288px;
             max-width:calc(100vw - 20px); }
  #mmh-pad button { min-width:27px; font-size:15px; margin:0 1px 2px 0; }
  #mmh-pad button.cv { font-size:22px; min-width:31px; height:31px; }
}
#mmh-pill:hover { border-color:#254666; }
/* The seal is a LABEL, not an ornament: on a phone the input is
   width:0 and the seal is the only thing left to tap. As a label it
   focuses the box by itself, with no script. */
#mmh-pill .seal { flex-shrink:0; display:flex; align-items:center;
                  cursor:text; }
#mmh-pill .seal svg { display:block; }
#mmh-q { border:none; outline:none; font-size:12px; font-family:Arial;
         background:transparent; color:#222; height:12px; }
/* both buttons cost width, so they are spent only while the box is in
   use - that is also when the reader has any need of them */
#mmh-kb { background:none; border:none; cursor:pointer; padding:0 3px;
          height:20px; display:none; align-items:center; flex-shrink:0; }
#mmh-go { background:#254666; border:none; color:#fff; font-size:11px;
          font-weight:bold; font-family:Arial; padding:0 9px; height:20px;
          border-radius:14px; cursor:pointer; white-space:nowrap;
          flex-shrink:0; display:none; }
#masthead.mmf-mm #mmh-kb { display:flex; }
#masthead.mmf-mm #mmh-go { display:block; }
#mmh-go:hover { background:#3097d1; }
#mmh-kb:hover rect { stroke:#3097d1; }
#mmh-kb:hover circle { fill:#3097d1; }

/* THE DATE GETS A FIXED SLOT. epversion09.js writes
   "Wednesday, Nov 18, 2026" - month always 3 letters, day zero-padded,
   so the weekday name is the only thing that moves, and Wednesday is
   the longest of the seven at 192px against Tuesday's 174. Leave the
   slot to the calendar and the row is 18px longer one day in seven,
   which on 18 Nov 2026 pushed the social icons onto a second line and
   out of the bar. Fixed here at 196 (the worst case plus a little), so
   every day lays out the same and the widths below need be right once.
   Only above the site's 1000px breakpoint - below it the date is
   hidden and epao-responsive.js owns this row. */
@media (min-width:1001px) {
  #masthead .date_txt { width:196px !important; }
}

/* HEADROOM. The social icons span has margin-right:6px, which
   getBoundingClientRect does not report - it needs 81px clear,
   not 75. Keep ~15px of slack in every state below. At 5px the
   bar looks fine and drops a line the first day something grows
   by a few pixels. */
/* -- the shared width: resting, then one rule per focused box.

   #gcse-search is sized here as well as its input. The site gives that
   span a fixed width, so shrinking only the input gives nothing back:
   the span keeps its place, the flow runs into the floated social icons
   and they drop out of the bar. The span must move too. -- */
/* 120 at rest, so the box can say "Meitei Mayek Search" in full -
   measured at 113px in its own 12px Arial. The Ask-AI pill drops from
   170 to 145 to pay for it, which also makes it a little less dominant.
   Earlier note, still true: at rest the row once left a 38px hole
   the social icons - the only gap in the bar that was not 0 or 6px, and
   it read as a mistake. The slack goes to the Mayek box rather than the
   Ask-AI pill, which already has the most room of the three. */
#masthead #epaoQuery      { width:145px !important; transition:width .18s ease; }
#masthead #mmh-q          { width:120px !important; transition:width .18s ease; }
#masthead #gcse-search #q { width:118px !important; transition:width .18s ease; }
#masthead #gcse-search    { width:184px !important; transition:width .18s ease; }

/* each focused width is tuned so the row stays shut: what the two
   shrinking boxes give back, the growing one takes. Leave a box out of
   step and the slack piles up as a hole before the social icons. */
#masthead.mmf-ai #epaoQuery      { width:280px !important; }
#masthead.mmf-ai #mmh-q          { width:50px  !important; }
#masthead.mmf-ai #gcse-search #q { width:60px  !important; }
#masthead.mmf-ai #gcse-search    { width:126px !important; }

#masthead.mmf-mm #epaoQuery      { width:70px  !important; }
#masthead.mmf-mm #mmh-q          { width:200px !important; }
#masthead.mmf-mm #gcse-search #q { width:34px  !important; }
#masthead.mmf-mm #gcse-search    { width:100px !important; }

#masthead.mmf-t3 #epaoQuery      { width:72px  !important; }
#masthead.mmf-t3 #mmh-q          { width:55px  !important; }
#masthead.mmf-t3 #gcse-search #q { width:264px !important; }
#masthead.mmf-t3 #gcse-search    { width:330px !important; }

/* -- tablet: same idea, less room (the site's own breakpoint) -- */
@media (max-width:1000px) {
  #masthead #epaoQuery      { width:120px !important; }
  #masthead #mmh-q          { width:70px  !important; }
  #masthead #gcse-search #q { width:84px  !important; }
  #masthead #gcse-search    { width:150px !important; }
  #masthead.mmf-ai #epaoQuery      { width:190px !important; }
  #masthead.mmf-ai #mmh-q          { width:40px  !important; }
  #masthead.mmf-ai #gcse-search #q { width:44px  !important; }
  #masthead.mmf-ai #gcse-search    { width:110px !important; }
  #masthead.mmf-mm #epaoQuery      { width:50px  !important; }
  #masthead.mmf-mm #mmh-q          { width:140px !important; }
  #masthead.mmf-mm #gcse-search #q { width:44px  !important; }
  #masthead.mmf-mm #gcse-search    { width:110px !important; }
  #masthead.mmf-t3 #epaoQuery      { width:50px  !important; }
  #masthead.mmf-t3 #mmh-q          { width:40px  !important; }
  #masthead.mmf-t3 #gcse-search #q { width:200px !important; }
  #masthead.mmf-t3 #gcse-search    { width:266px !important; }
}

/* -- phone: only the box in use shows an input. 355px of masthead, so
      at rest Ask-AI keeps its box and the other two are just icons.
      Tapping one hands it the row. -- */
@media (max-width:560px) {
  /* a real touch target - 44px is the usual minimum, and at rest
     this pill is the whole of Mayek search on a phone */
  #mmh-pill { margin:0 3px; padding:0 4px; gap:3px;
             min-width:44px; justify-content:center; }
  #masthead #epaoQuery      { width:70px !important; }
  #masthead #mmh-q          { width:0 !important; padding:0 !important; }
  #masthead #gcse-search #q { width:0 !important; padding:0 !important;
                              border:none !important; }
  #masthead #gcse-search    { width:36px !important; }
  /* every state is spelled out here. A media query does not raise
     specificity, so a .mmf-* rule left out of this block would keep
     the wider screens' width on a phone. */
  #masthead.mmf-ai #epaoQuery      { width:140px !important; }
  #masthead.mmf-ai #mmh-q          { width:0 !important; }
  #masthead.mmf-ai #gcse-search #q { width:0 !important; }
  #masthead.mmf-ai #gcse-search    { width:36px !important; }
  #masthead.mmf-mm #epaoQuery      { width:0 !important; }
  #masthead.mmf-mm #mmh-q          { width:150px !important; padding:0 3px !important; }
  #masthead.mmf-mm #mmh-go         { display:none; }
  #masthead.mmf-mm #gcse-search #q { width:0 !important; }
  #masthead.mmf-mm #gcse-search    { width:36px !important; }
  #masthead.mmf-t3 #epaoQuery      { width:0 !important; }
  #masthead.mmf-t3 #mmh-q          { width:0 !important; }
  #masthead.mmf-t3 #gcse-search #q { width:150px !important; padding:0 3px !important;
                                     border:1px solid #c0c0c0 !important; }
  #masthead.mmf-t3 #gcse-search    { width:190px !important; }
}
