/* Fingers and tablets. A touch screen has no right button and no pointer to hover with, and a
   tablet's browser has ideas of its own about what a pinch, a long press and the foot of the page
   are for. Loaded after the other sheets, so that what is said here is what holds.
   (js/touch.js is the other half: it puts the game's words about clicking into words about tapping.) */

/* ---------------------------------------------------------------- the page itself */

/* A pinch belongs to the island and a drag to whichever panel scrolls: the page itself never
   zooms, and never bounces when a panel comes to its end. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { touch-action: pan-x pan-y; overscroll-behavior: none; }

/* The bar and the panel run to the edges of the screen (skin.css), and stop short only of a
   tablet's rounded corners, its status bar and the bar it is swiped home by. */
.game {
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.screen.center, .modal {
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

/* Words meant for a mouse and a keyboard, and the same thing said to a finger. */
.for-touch { display: none; }
@media (pointer: coarse) {
  .for-mouse { display: none; }
  .for-touch { display: inline; }
}

@media (pointer: coarse) {
  /* A long press is a way of holding a picture down, not of selecting the words on it or of
     being offered a copy of it. (The code on the chart can still be picked out: it says so itself.) */
  .game, .title-foot, .sheet-head, .story, .leaders, .voyages, .brief, .modal-card .actions { -webkit-user-select: none; user-select: none; }
  img, button, a { -webkit-touch-callout: none; }
  img { -webkit-user-drag: none; }
}

/* ---------------------------------------------------------------- the top bar, where there is less room */

/* An island can have six kinds of thing in store, and a tablet is not wide enough to list them
   beside everything else. So on a tablet the bar has two rows. The first is the world: where
   this is, the time of day, the weather, how many people, the clock and how fast it runs. The
   second is the settlement being looked at: what its scholars are at, and what it has in store.
   (A flex row breaks where something as wide as the bar stands, so something that wide and of no
   height at all is stood between the two.) */
@media (min-width: 641px) and (max-width: 1250px) {
  #topbar { flex-wrap: wrap; gap: 3px 10px; padding-top: 5px; padding-bottom: 6px; }
  #topbar::before { content: ''; order: 1; flex: 0 0 100%; height: 0; }
  #topbar .study-chip, #topbar .mats { order: 2; }
  #topbar .study-chip { flex: 0 1000 auto; min-width: 44px; }
  #topbar .mats { flex: 1 1 0; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none; }
  #topbar .mats::-webkit-scrollbar { display: none; }
  #topbar .mat { flex: none; }
  #topbar .where { min-width: 0; }
  #topbar .where strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #topbar .where .pill { flex: none; }
}
/* Upright, a tablet's first row has no room for the island's name, nor for the weather in words
   (its picture says it, and what is coming is still spelt out). */
@media (min-width: 641px) and (max-width: 900px) {
  #topbar .where strong { display: none; }
  .weather-chip:not(.day-chip) span { display: none; }
}

/* ---------------------------------------------------------------- room for a thumb */

@media (pointer: coarse) {
  /* Fingers do the turning and the zooming; one button to put the view back is enough. */
  .cam-pad button:not([data-cam='home']) { display: none; }

  .icon-btn { width: 40px; height: 40px; }
  .speed button { min-width: 42px; padding: 10px 10px; }
  .study-chip, .weather-chip { min-height: 38px; }
  .btn.small { padding: 8px 13px; }
  .own-item { padding: 10px 12px; }
  .tribe { padding-top: 8px; padding-bottom: 8px; }
  .toast.go { padding: 10px 13px; }
  /* The name under each job is what opens its page: it wants to be easy to hit. */
  .plate { padding: 7px 10px 7px 12px; font-size: 10.5px; }
  /* The shields under the little map. */
  .sector-shield { padding: 7px 0 6px; }
  .sector-shield img { width: 21px; height: 25px; }

  /* The little minus on a picture that counts is drawn small, in its corner, with room for a
     thumb round it: anywhere else on the picture is more. */
  .tile-less { left: -8px; top: -8px; width: 46px; height: 46px; border: 0; border-radius: 0; background: none; font-size: 0; }
  .tile-less::before {
    content: '\2212';
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font: 700 18px/1 var(--sans);
    background: rgba(8, 14, 22, 0.9);
    color: var(--ink);
    border: 1px solid var(--line-2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  }
  .tile.on .tile-less::before { border-color: #fff1c4; }
  /* With nothing to take away there is no minus. */
  .tile[data-hold] .tile-n:empty ~ .tile-less { display: none; }
  /* On the wheel it hangs off the shoulder of its job, as the number does off the other one. */
  .tile.node .tile-less { left: -21px; top: -19px; z-index: 1; }
  /* (The mark on a design made of stand-ins moves out of its way.) */
  .r-slow { top: auto; bottom: 11px; }

  /* A small picture has no corner to spare, so its minus stands beside it, on the left. In the
     rows of seams and of buildings a place is kept for it, and it keeps that place even with
     nobody to take away, so that the rows line up. */
  .tile.mini .tile-less { left: -46px; top: 50%; margin-top: -23px; }
  .lode { grid-template-columns: 90px minmax(0, 1fr) auto 40px; }
  .lode .tile.dig { justify-self: end; }
  .lode .lode-pic { justify-self: end; margin-right: 9px; }
  .work { grid-template-columns: 44px minmax(0, 1fr) 90px; }
  .work > .tile.mini:last-child { justify-self: end; }
  .lode .tile.dig[data-hold] .tile-n ~ .tile-less, .work .tile.mini[data-act='turret'] .tile-n ~ .tile-less { display: grid; }
  .lode .tile.dig.zero .tile-less::before, .work .tile.mini.zero .tile-less::before { opacity: 0.4; }
  .eq:has(.eq-who[data-hold]:not(.zero)) { padding-left: 50px; }
}

/* ---------------------------------------------------------------- where there is little height */

/* A tablet on its side is wide and not at all tall. The wheel is drawn a size smaller there,
   which leaves more of the page under it in sight. */
@media (max-height: 800px) and (min-width: 641px) {
  .hub { --node: 52px; --mid: 70px; height: 262px; margin-top: 8px; }
  .hub.few { height: 124px; }
  .hub::before { width: 234px; height: 234px; }
}

/* An island's sheet on the chart can be taller than the window: the button that begins it stays
   in sight while the rest slides under it. */
.brief > .btn { position: sticky; bottom: 0; z-index: 1; flex: none; box-shadow: 0 0 0 7px #101a28, 0 -16px 16px 4px rgba(16, 26, 40, 0.85); }

/* The button on the banner over the map that puts back whatever is in hand (a finger has no
   other button to do it with, and no Esc). */
.banner-back {
  appearance: none;
  margin: -2px -6px -2px 12px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid #fff1c4;
  background: var(--brass);
  color: var(--ink-dark);
  font: 700 12.5px/1.2 var(--sans);
  white-space: nowrap;
  vertical-align: middle;
  pointer-events: auto;
  cursor: pointer;
}
.banner-back:active { transform: translateY(1px); }

/* A long sheet (How to play, how an island went) keeps its buttons in sight while it is read. */
.modal-card.wide .actions {
  position: sticky;
  bottom: -22px;
  z-index: 1;
  margin: 20px -24px -22px;
  padding: 14px 24px 18px;
  background: linear-gradient(180deg, rgba(13, 22, 34, 0), rgba(13, 22, 34, 0.97) 32%);
}

@media (pointer: coarse) {
  /* A god asking for an answer: the two buttons want room for a thumb each. */
  .speech-actions { gap: 10px; }
  .speech-actions .btn { padding: 9px 18px; min-height: 40px; }
}

/* Where the panel is at its narrowest and the people in a sum have a minus beside them, the sum
   is set a little smaller, so that its answer is not cut short. */
@media (pointer: coarse) and (max-width: 1099px) {
  .eq:has(.eq-who[data-hold]:not(.zero)) { padding-left: 46px; gap: 4px; }
  .eq-out { padding: 4px 9px 4px 4px; gap: 4px; }
  .eq-out img { width: 26px; height: 26px; }
  .eq-out b { font-size: 12.5px; }
}
