/* Inventiff Hub: the page that lists the apps. Only layout lives here;
   every colour, font, radius and timing comes from inventiff.css. */

body {
  min-height: 100%;
  background: var(--navy-950);
  background-image: var(--grad-navy);
  background-attachment: fixed;
  color: var(--navy-50);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 60rem;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
}

/* --- Header ------------------------------------------------------------ */
/* The wordmark in the middle; the view switch to its right, on the edge of
   the list it switches. */
.masthead {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--surface);
}
.logo { grid-column: 2; margin: 0; line-height: 0; }
.logo svg { display: block; width: 158px; height: 28px; }

/* List | Cards, as icons: TimeTracker's page tabs (gold underline under
   the active one), on navy. */
.view-switch {
  grid-column: 3;
  justify-self: end;
  display: flex;
  gap: 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--navy-200) 14%, transparent);
}
.view-tab svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}
.view-tab {
  position: relative;
  padding: 0.25rem 0.25rem 0.5rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--navy-300);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.view-tab:hover { color: var(--navy-100); }
.view-tab[aria-pressed="true"] { color: var(--surface); }
.view-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--gold-500);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}
.view-tab[aria-pressed="true"]::after { transform: scaleX(1); }
.view-tab:focus-visible { outline: none; box-shadow: var(--ring-gold); border-radius: var(--r-md); }

/* --- The apps ---------------------------------------------------------- */
/* The list sits in the middle of whatever height the window leaves (the
   taskbar, a short laptop screen) and shrinks into it, scrolling, rather than
   running off the bottom of the screen. */
.choose {
  margin: auto 0;
  padding: 3rem 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.apps {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 0;
}

/* More than four apps, or less room than four need: the list scrolls on its
   own (hub.js sets the height and rolls the rows over the edges). The edge
   that has more behind it fades, so the cut reads as "keeps going". */
.apps.scrolls {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-500) transparent;
}
.apps.scrolls > li { scroll-snap-align: start; will-change: transform; }
.apps[data-more="below"] {
  mask-image: linear-gradient(to bottom, black calc(100% - 3.5rem), transparent);
}
.apps[data-more="above"] {
  mask-image: linear-gradient(to top, black calc(100% - 3rem), transparent);
}
.apps[data-more="both"] {
  mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3.5rem), transparent);
}

.app {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  grid-template-areas:
    "slash name  where"
    "slash about where";
  column-gap: 1.25rem;
  align-items: baseline;
  padding: 1.6rem 0.25rem;
  border-top: 1px solid color-mix(in srgb, var(--navy-200) 14%, transparent);
  color: inherit;
  text-decoration: none;
}
li:last-child .app { border-bottom: 1px solid color-mix(in srgb, var(--navy-200) 14%, transparent); }

/* "./", as on inventiff.io ("./ Read more"): the one bold thing on the page. */
.slash {
  grid-area: slash;
  align-self: center;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--gold-500);
  transform: skewX(-6deg);
  transition: transform var(--dur-slow) var(--ease), color var(--dur) var(--ease);
}
.name {
  grid-area: name;
  font-size: clamp(1.75rem, 4.2vw, 2.75rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  color: var(--surface);
  transition: color var(--dur) var(--ease);
}
.about {
  grid-area: about;
  margin-top: 0.4rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--navy-200);
  max-width: 34rem;
}
/* "Coming soon", on an app not built yet. */
.where {
  grid-area: where;
  align-self: center;
  font-size: 0.8125rem;
  color: var(--navy-400);
}

a.app:hover .slash,
a.app:focus-visible .slash { transform: translateX(0.4rem) skewX(-6deg); }
a.app:hover .name,
a.app:focus-visible .name { color: var(--gold-300); }
a.app:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 4px; }

/* Not built yet: present, but plainly not a door. */
.app.planned .slash { color: var(--navy-500); }
.app.planned .name { color: var(--navy-300); }
.app.planned .about { color: var(--navy-400); }

/* The endless list (hub.js): no scrollbar; the arrow below says there is more. */
.apps.loops { scrollbar-width: none; }
.apps.loops::-webkit-scrollbar { display: none; }

.more {
  flex: none;
  align-self: center;
  margin-top: 0.75rem;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: var(--navy-200);
  opacity: 0.45;
  cursor: pointer;
  border-radius: var(--r-full);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.more[hidden] { display: none; }
.more svg {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.more:hover { opacity: 0.8; transform: translateY(2px); }
.more:focus-visible { outline: none; opacity: 0.8; box-shadow: var(--ring-gold); }

/* --- Card view: the same apps as tiles, two to a row. ------------------- */
/* Each card takes four rows of the list's grid and lays its mark, name,
   description and note on them (subgrid), so cards side by side are the same
   height and their names and descriptions start on the same line. */
.choose[data-view="cards"] .apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1rem;
  row-gap: 0;
  /* Room for the hover lift and focus ring inside the scrolling box. */
  padding: 0.5rem;
  margin: -0.5rem;
}
.choose[data-view="cards"] .apps > li {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  padding-bottom: 1rem; /* the space between one row of cards and the next */
}
.choose[data-view="cards"] .app {
  grid-row: span 4;
  grid-template-rows: subgrid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "slash" "name" "about" "where";
  row-gap: 0;
  align-items: start;
  padding: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--navy-200) 14%, transparent);
  border-radius: var(--r-xl2);
  background: color-mix(in srgb, var(--navy-200) 5%, transparent);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.choose[data-view="cards"] li:last-child .app { border-bottom: 1px solid color-mix(in srgb, var(--navy-200) 14%, transparent); }
.choose[data-view="cards"] .slash { align-self: start; margin-bottom: 1rem; font-size: 2.25rem; }
.choose[data-view="cards"] .name { font-size: 1.75rem; }
.choose[data-view="cards"] .where { align-self: start; margin-top: 1.25rem; }
.choose[data-view="cards"] a.app:hover,
.choose[data-view="cards"] a.app:focus-visible {
  background: color-mix(in srgb, var(--navy-200) 10%, transparent);
  border-color: color-mix(in srgb, var(--gold-500) 45%, transparent);
}

/* --- List ⇄ Cards: fade out, swap, fade in rising a little (hub.js). ----- */
.apps.leaving {
  opacity: 0;
  transition: opacity var(--dur-fast) ease-in;
}
.apps.arriving { animation: apps-in var(--dur-slow) var(--ease); }
@keyframes apps-in {
  from { opacity: 0; transform: translateY(6px); }
}

/* --- The paper plane from inventiff.io, flying out of the bottom corner.
   Drawn after the site's artwork in the navy tints; behind everything. */
.plane {
  position: fixed;
  right: -3rem;
  bottom: 1.5rem;
  /* Only as wide as the margin right of the list, so it never crosses it. */
  width: min(26rem, calc(50vw - 27rem));
  height: auto;
  pointer-events: none;
  opacity: 0.55;
}
.pl-a { stop-color: var(--navy-400); }
.pl-b { stop-color: var(--navy-200); }
.pl-c { stop-color: var(--navy-600); }
.pl-d { stop-color: var(--navy-800); }
.pl-e { stop-color: var(--navy-400); }
.pl-f { stop-color: var(--navy-400); stop-opacity: 0; }
.pl-sliver { fill: var(--navy-500); }
.pl-trail { fill: none; stroke: var(--navy-300); stroke-width: 2.5; stroke-dasharray: 12 10; }

/* Too little margin beside the list for the plane to read as one. */
@media (max-width: 82rem) {
  .plane { display: none; }
  /* One column is all a phone has: the list, always. */
  .view-switch { display: none; }
}

/* --- Small screens ----------------------------------------------------- */
@media (max-width: 40rem) {
  .plane { display: none; }
  .page { height: auto; min-height: 100dvh; padding: 2rem 1rem 1.5rem; }
  .choose { padding: 2.5rem 0; }
  .app {
    grid-template-columns: 2.75rem minmax(0, 1fr);
    grid-template-areas:
      "slash name"
      "slash about"
      "slash where";
    column-gap: 0.75rem;
    padding: 1.25rem 0;
  }
  .slash { font-size: 2.25rem; align-self: start; }
  .where { margin-top: 0.5rem; align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .slash, .name { transition: none; }
}
