/* ==========================================================================
   phone.css - the Windows Phone (Lumia) shell.

   GEOMETRY
   Microsoft's WP8 Tile spec, verbatim, at WXGA:
       small   159 × 159
       medium  336 × 336
       wide    691 × 336
   Two smalls plus a gutter make a medium, so the gutter is 18px
   (2·159 + 18 = 336), and four smalls plus three gutters make the grid
   (4·159 + 3·18 = 690 ≈ 691). So Start is a 4-column grid of 159px units
   with an 18px gap - everything below is that ratio expressed in vw, which
   keeps the proportions identical at any phone width.
   ========================================================================== */

:root {
  /* 18 / 768 = 2.34vw. Windows Phone put a wide margin on the right of Start
     to house the → arrow; with the arrow replaced by a swipe there's nothing
     to leave room for, so the same total margin is split evenly and the grid
     sits centred. */
  --wp-side: 5.1vw;
  --wp-gap: 2.34vw;
  --wp-unit: calc((100vw - 2 * var(--wp-side) - 3 * var(--wp-gap)) / 4);

  --wp-status-h: 26px;
  --wp-nav-h: 44px;

  /* Windows Phone shipped a true dark and a true light theme. */
  --wp-bg: #000;
  --wp-fg: #fff;
  --wp-fg-dim: rgba(255, 255, 255, 0.55);
  --wp-chrome: #1f1f1f;
  --wp-panel: rgba(255, 255, 255, 0.08);
}

body.wp-light {
  --wp-bg: #f2f2f2;
  --wp-fg: #000;
  --wp-fg-dim: rgba(0, 0, 0, 0.55);
  --wp-chrome: #e6e6e6;
  --wp-panel: rgba(0, 0, 0, 0.06);
}

/* The phone shell replaces the desktop one entirely - there is no desktop
   to switch to, exactly as on a real Lumia. */
#phone {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--wp-bg);
  color: var(--wp-fg);
  overflow: hidden;
  font-family: var(--font);
}
body.is-phone #phone { display: flex; }
body.is-phone #shell { display: none; }

/* --------------------------------------------------------------------------
   STATUS BAR
   -------------------------------------------------------------------------- */
.wp-status {
  flex: none;
  height: var(--wp-status-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--wp-fg);
  background: transparent;
  z-index: 5;
}
.wp-status svg { width: 14px; height: 14px; }
.wp-status-sig { display: flex; align-items: flex-end; gap: 1.5px; height: 11px; }
.wp-status-sig i { width: 2.5px; background: currentColor; opacity: 0.35; }
.wp-status-sig i.is-on { opacity: 1; }
.wp-status-time { font-variant-numeric: tabular-nums; margin-left: 2px; }
.wp-status-bat {
  position: relative;
  width: 20px; height: 10px;
  border: 1.5px solid currentColor;
  display: flex; align-items: stretch; padding: 1.5px;
}
.wp-status-bat::after {
  content: ''; position: absolute; right: -3.5px; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 4px; background: currentColor;
}
.wp-status-bat i { display: block; background: currentColor; }

/* --------------------------------------------------------------------------
   SCREEN STACK
   -------------------------------------------------------------------------- */
.wp-body { flex: 1; position: relative; min-height: 0; overflow: hidden; }

.wp-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wp-screen[hidden] { display: none !important; }

/* Start ⇄ app list slide as a pair, so it reads as one surface moving rather
   than two screens swapping. */
.wp-screen.is-in-right  { animation: wp-in-right 250ms var(--ease-out) both; }
.wp-screen.is-in-left   { animation: wp-in-left 250ms var(--ease-out) both; }
.wp-screen.is-out-left  { animation: wp-out-left 250ms var(--ease-out) both; z-index: 1; }
.wp-screen.is-out-right { animation: wp-out-right 250ms var(--ease-out) both; z-index: 1; }

@keyframes wp-in-right  { from { transform: translateX(100%); } to { transform: none; } }
@keyframes wp-in-left   { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes wp-out-left  { from { transform: none; } to { transform: translateX(-38%); opacity: 0; } }
@keyframes wp-out-right { from { transform: none; } to { transform: translateX(38%); opacity: 0; } }

/* --------------------------------------------------------------------------
   SOFT KEYS - the capacitive back / start / search row
   -------------------------------------------------------------------------- */
.wp-nav {
  flex: none;
  height: var(--wp-nav-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #000;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 5;
}
body.wp-light .wp-nav { background: #111; }

.wp-key {
  flex: 1;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.82);
  transition: color 90ms linear, transform 90ms linear;
}
.wp-key:active { color: #fff; transform: scale(0.9); }
.wp-key svg { width: 19px; height: 19px; }
.wp-key.is-disabled { opacity: 0.28; pointer-events: none; }

/* Back chevron and search glyph are drawn; Start is the four-pane flag. */
.wp-key-start svg { width: 21px; height: 21px; }

/* --------------------------------------------------------------------------
   LOCK SCREEN
   -------------------------------------------------------------------------- */
.wp-lock {
  background: #06131c;
  color: #fff;
  justify-content: space-between;
  transition: transform 340ms var(--ease-in), opacity 340ms var(--ease-in);
  will-change: transform;
}
.wp-lock.is-dragging { transition: none; }
.wp-lock.is-unlocking { transform: translateY(-100%); opacity: 0; }

.wp-lock-wall {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 110% 42% at 24% 116%, #04090d 0 58%, transparent 60%),
    radial-gradient(circle 300px at 72% 66%, rgba(255, 172, 92, 0.28), transparent 66%),
    linear-gradient(178deg, #071726 0%, #123c52 38%, #2f6f80 60%, #9db089 80%, #dfa96f 100%);
}
.wp-lock-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,0) 46%, rgba(0,0,0,.5));
}

.wp-lock-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 0 24px 34px;
}
.wp-lock-time {
  font-family: var(--font-light);
  font-weight: 200;
  font-size: clamp(64px, 21vw, 118px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.wp-lock-date {
  font-family: var(--font-light);
  font-weight: 300;
  font-size: clamp(16px, 4.6vw, 25px);
  margin-top: 4px;
}
.wp-lock-notes { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.wp-lock-note { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 300; }
.wp-lock-note svg { width: 19px; height: 19px; }

.wp-lock-hint {
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  animation: hint-pulse 2.8s ease-in-out 1.4s infinite;
}

/* --------------------------------------------------------------------------
   START SCREEN
   -------------------------------------------------------------------------- */
.wp-start { overflow-y: auto; overflow-x: hidden; }

.wp-tiles {
  display: grid;
  grid-template-columns: repeat(4, var(--wp-unit));
  grid-auto-rows: var(--wp-unit);
  gap: var(--wp-gap);
  padding: 16px var(--wp-side) 40px;
  align-content: start;
  justify-content: center;
}

.wp-tile {
  position: relative;
  overflow: hidden;
  background: var(--tile-color, var(--accent));
  color: #fff;
  border: 0;
  padding: 0;
  text-align: left;

  /* Same press physics as the desktop tiles - WP called it the tilt effect. */
  --rx: 0deg; --ry: 0deg; --tscale: 1;
  /* Reorder offset written by the drag FLIP - see tiles.css. */
  --fx: 0px; --fy: 0px;
  transform:
    translate(var(--fx), var(--fy))
    perspective(560px) rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--tscale));
  transition: transform 240ms var(--ease-out);
  will-change: transform;
}
.wp-tile.is-pressed { transition: transform 90ms var(--ease-std); }

/* -- drag to rearrange ----------------------------------------------------- */
.wp-tile.is-flipping { transition: none; }
body.is-dragging-tile .wp-tile:not(.is-flipping) {
  transition: transform 165ms var(--ease-out);
}

.wp-tile.is-drag-source {
  opacity: 0.22;
  pointer-events: none;
}
.wp-tile.is-drag-source .wp-faces,
.wp-tile.is-drag-source .wp-tile-label { visibility: hidden; }

/* WP8 lifted the held tile clear of the grid before you moved it. */
.wp-tile.tile-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 800;
  margin: 0;
  pointer-events: none;
  transition: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  opacity: 0.94;
}
.wp-tile.tile-ghost .wp-tile-action { display: none; }

.wp-tile-sm { grid-column: span 1; grid-row: span 1; }
.wp-tile-md { grid-column: span 2; grid-row: span 2; }
.wp-tile-wd { grid-column: span 4; grid-row: span 2; }

/* -- faces ----------------------------------------------------------------- */
.wp-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backface-visibility: hidden;
}

.wp-tile-label {
  position: absolute;
  left: 8px; right: 8px; bottom: 6px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.wp-tile-sm .wp-tile-label { display: none; }

/* Icons are sized off the grid unit, not a percentage. A percentage would
   resolve against the icon wrapper, which is itself content-sized - the two
   chase each other and the glyph collapses to a few pixels. */
.wp-tile-icon { pointer-events: none; display: grid; place-items: center; }
.wp-tile-icon svg { width: calc(var(--wp-unit) * 0.62); height: auto; aspect-ratio: 1; }
.wp-tile-sm .wp-tile-icon svg { width: calc(var(--wp-unit) * 0.46); }
.wp-tile-wd .wp-tile-icon svg { width: calc(var(--wp-unit) * 0.70); }

/* -- iconic template ------------------------------------------------------ */
/* Glyph and count sit above the label, both pushed left, WP-style. */
.wp-face.is-iconic { justify-content: flex-start; align-items: flex-start; padding: 12% 8px 0 10px; }
.wp-face.is-iconic .wp-tile-icon { margin-bottom: auto; }
/* The iconic glyph is deliberately smaller than a flip-tile icon. */
.wp-face.is-iconic .wp-tile-icon svg { width: calc(var(--wp-unit) * 0.44); }
.wp-tile-sm .wp-face.is-iconic .wp-tile-icon svg { width: calc(var(--wp-unit) * 0.42); }
.wp-iconic-count {
  position: absolute;
  right: 9px; top: 8px;
  font-family: var(--font-light);
  font-weight: 300;
  font-size: 26px;
  line-height: 1;
}
.wp-tile-sm .wp-iconic-count { font-size: 17px; right: 6px; top: 5px; }

/* -- flip template -------------------------------------------------------- */
.wp-faces { position: absolute; inset: 0; transform-style: preserve-3d; perspective: 420px; }
.wp-faces .wp-face { transition: transform 480ms var(--ease-out), opacity 480ms var(--ease-out); }
.wp-faces[data-anim='flip'] .wp-face            { transform: rotateX(-90deg); opacity: 0; }
.wp-faces[data-anim='flip'] .wp-face.is-current { transform: rotateX(0deg);   opacity: 1; }
.wp-faces[data-anim='flip'] .wp-face.is-leaving { transform: rotateX(90deg);  opacity: 0; }

/* -- cycle template ------------------------------------------------------- */
.wp-faces[data-anim='cycle'] .wp-face            { opacity: 0; transform: scale(1.06); }
.wp-faces[data-anim='cycle'] .wp-face.is-current { opacity: 1; transform: scale(1); }
.wp-faces[data-anim='cycle'] .wp-face.is-leaving { opacity: 0; transform: scale(1); }

.wp-face.is-photo { background: linear-gradient(135deg, var(--photo-a, #444), rgba(0,0,0,.72)); }

/* -- text back face -------------------------------------------------------- */
.wp-face.is-text {
  justify-content: flex-end;
  align-items: flex-start;
  padding: 12px 12px 26px;
}
.wp-face-title { font-size: 12px; font-weight: 600; opacity: 0.85; margin-bottom: 4px; }
.wp-face-body {
  font-size: 14px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  line-clamp: 4;
  overflow: hidden;
}
.wp-tile-wd .wp-face-body { -webkit-line-clamp: 2; line-clamp: 2; }

/* -- clock + weather templates -------------------------------------------- */
.wp-face.is-clock, .wp-face.is-weather { justify-content: center; }
/* Also sized off the grid unit - a percentage font-size would resolve against
   the inherited font size, not the tile. */
.wp-clock-time {
  font-family: var(--font-light);
  font-weight: 200;
  font-size: calc(var(--wp-unit) * 0.40);
  line-height: 1;
}
.wp-clock-sub { font-size: 12px; opacity: 0.8; margin-top: 4px; }
.wp-weather-temp {
  font-family: var(--font-light);
  font-weight: 200;
  font-size: calc(var(--wp-unit) * 0.42);
  line-height: 1;
}
.wp-weather-city { font-size: 12px; opacity: 0.85; margin-top: 3px; }

/* -- entrance: the WP turnstile ------------------------------------------- */
/* Tiles pivot in around their left edge, staggered - WP's signature move. */
.wp-tiles.is-entering .wp-tile {
  animation: wp-turnstile 300ms var(--ease-out) both;
  animation-delay: var(--delay, 0ms);
}
@keyframes wp-turnstile {
  from { opacity: 0; transform: perspective(560px) rotateY(58deg); transform-origin: left center; }
  to   { opacity: 1; transform: perspective(560px) rotateY(0deg);  transform-origin: left center; }
}

/* Start and the app list are two pages of one horizontal pager, so vertical
   panning belongs to the browser and horizontal gestures belong to us. */
.wp-start, .wp-applist { touch-action: pan-y; }

/* Shown once on the first visit to Start, then never again - Windows Phone
   had no such hint, but a first-time web visitor has no way to guess the
   gesture. Delete this block and its markup to go fully period-accurate. */
.wp-swipe-hint {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  /* Sits over whatever tile happens to be at the bottom, so it carries its
     own backdrop rather than relying on the wallpaper for contrast. */
  width: fit-content;
  margin: 0 auto;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.82);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  z-index: 3;
  animation: wp-hint 4.4s var(--ease-std) forwards;
}
body.wp-light .wp-swipe-hint { background: rgba(255, 255, 255, 0.92); color: rgba(0, 0, 0, 0.85); }
@keyframes wp-hint {
  0%   { opacity: 0; transform: translateX(10px); }
  14%  { opacity: 1; transform: none; }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

/* -- long-press edit mode -------------------------------------------------- */
.wp-tiles.is-editing .wp-tile { opacity: 0.45; }
.wp-tiles.is-editing .wp-tile.is-editing { opacity: 1; z-index: 2; }

.wp-tile-action {
  position: absolute;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: #fff;
  color: #1a1a1a;
  border-radius: 50%;
  z-index: 4;
  transform: scale(0);
  transition: transform 140ms var(--ease-out);
}
.wp-tile.is-editing .wp-tile-action { transform: scale(1); }
.wp-tile-action svg { width: 13px; height: 13px; }
.wp-tile-unpin { top: 5px; right: 5px; }
.wp-tile-resize { bottom: 5px; right: 5px; }

.wp-tile.is-unpinning { animation: wp-unpin 200ms var(--ease-in) both; pointer-events: none; }
@keyframes wp-unpin { to { opacity: 0; transform: scale(0.55); } }

/* --------------------------------------------------------------------------
   APP LIST
   -------------------------------------------------------------------------- */
.wp-applist { overflow-y: auto; }
.wp-applist-inner { padding: 10px 0 40px; }

.wp-applist-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 16px 14px;
  padding: 8px 10px;
  background: var(--wp-panel);
}
.wp-applist-search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--wp-fg);
  font-size: 15px;
  min-width: 0;
}
.wp-applist-search input::placeholder { color: var(--wp-fg-dim); }
.wp-applist-search svg { width: 16px; height: 16px; color: var(--wp-fg-dim); }

/* Letter divider: a small square, tappable to open the jump grid. */
.wp-letter {
  width: 34px; height: 34px;
  margin: 14px 0 8px 16px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 300;
  font-family: var(--font-light);
}

.wp-app-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 9px 16px;
  text-align: left;
  color: var(--wp-fg);
  transition: background-color 90ms linear;
}
.wp-app-row:active { background: var(--wp-panel); }
.wp-app-icon {
  width: 44px; height: 44px;
  flex: none;
  display: grid; place-items: center;
  background: var(--tile-color, var(--accent));
  color: #fff;
}
.wp-app-icon svg { width: 22px; height: 22px; }
.wp-app-name { font-size: 16px; font-weight: 300; }

.wp-applist-empty { padding: 24px 16px; color: var(--wp-fg-dim); font-size: 15px; }

/* Jump grid - tapping a letter divider zooms out to the alphabet. */
.wp-jump {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: var(--wp-bg);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: start;
  gap: 8px;
  padding: 18px 16px;
  animation: wp-jump-in 200ms var(--ease-out) both;
}
@keyframes wp-jump-in { from { opacity: 0; transform: scale(1.12); } to { opacity: 1; transform: none; } }

.wp-jump-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 300;
  font-family: var(--font-light);
}
.wp-jump-cell.is-empty { background: var(--wp-panel); color: var(--wp-fg-dim); pointer-events: none; }

/* --------------------------------------------------------------------------
   APP PAGES
   -------------------------------------------------------------------------- */
/* The app node is mounted inside #wp-appscreen, so it has to fill that host
   as a flex column - otherwise it sizes to its content and the app bar ends
   up floating above a gap (or pushed off the bottom entirely). */
.wp-app {
  background: var(--wp-bg);
  color: var(--wp-fg);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.wp-app-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* A page's body lines up with its title. Without this, every page() screen
   (contact, résumé, project details...) ran its text into the screen edge. */
.wp-app-scroll > .wp-turnstile { padding: 4px 20px 28px; }

/* Turnstile page entry - content pivots in from the right edge. */
.wp-app.is-entering .wp-turnstile > * {
  animation: wp-page-in 300ms var(--ease-out) both;
  animation-delay: var(--i, 0ms);
}
@keyframes wp-page-in {
  from { opacity: 0; transform: perspective(700px) rotateY(-42deg); transform-origin: right center; }
  to   { opacity: 1; transform: perspective(700px) rotateY(0); transform-origin: right center; }
}

/* -- standard page header -------------------------------------------------- */
.wp-page-head { padding: 14px 20px 8px; flex: none; }
.wp-page-app { font-size: 13px; font-weight: 400; color: var(--wp-fg); opacity: 0.85; }
.wp-page-title {
  font-family: var(--font-light);
  font-weight: 200;
  font-size: clamp(34px, 10vw, 48px);
  line-height: 1.05;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   PANORAMA
   A single wide canvas that scrolls horizontally; the title is deliberately
   larger than the viewport and the background pans more slowly than content.
   -------------------------------------------------------------------------- */
/* One section per swipe. Proximity snapping let a flick stop anywhere,
   halfway between sections; mandatory + snap-stop lands on the next
   section's edge every time, in order. */
.wp-pano { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; position: relative; scroll-snap-type: x mandatory;
  /* Sideways swipes are paged in JS (pageBySwipe); vertical stays native. */
  touch-action: pan-y; }
.wp-pano.is-dragging { user-select: none; }
/* touch-action stops at the nearest scroll container, and each section
   scrolls vertically, so it has to be repeated here or the browser takes
   sideways swipes that start inside a section and glides past the stop. */
.wp-pano-section { touch-action: pan-y; }
.wp-pano::-webkit-scrollbar { display: none; }
.wp-pano { scrollbar-width: none; }

.wp-pano-bg {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 100%;   /* sized to the scroll travel in panorama() */
  background:
    radial-gradient(ellipse 60% 50% at 18% 12%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 60% at 78% 88%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 72%),
    var(--wp-bg);
  will-change: transform;
  z-index: 0;
}

.wp-pano-track { position: relative; z-index: 1; display: flex; height: 100%; width: max-content; }

.wp-pano-title {
  font-family: var(--font-light);
  font-weight: 200;
  font-size: clamp(46px, 15vw, 76px);
  line-height: 1;
  padding: 12px 24px 14px 20px;
  white-space: nowrap;
  position: absolute;
  top: 0; left: 0;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}

.wp-pano-section {
  width: 84vw;
  flex: none;
  scroll-snap-stop: always;
  padding: calc(clamp(46px, 15vw, 76px) + 30px) 18px 20px 20px;
  scroll-snap-align: start;
  overflow-y: auto;
}
.wp-pano-section h3 {
  font-family: var(--font-light);
  font-weight: 300;
  font-size: 26px;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   PIVOT
   Headers in a row; the active one is full-strength, neighbours are dimmed
   and partly off-screen. Swipe or tap to move between them.
   -------------------------------------------------------------------------- */
.wp-pivot { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* Same size and position as a panorama title, so "projects" and "about me"
   match. As the list scrolls it eases toward the smaller size (--t: 0 → 1),
   which still sits well above the pivot headings beneath it. */
.wp-pivot-title {
  --t: 0;
  --big: clamp(46px, 15vw, 76px);
  --small: clamp(34px, 10vw, 50px);
  flex: none;
  font-family: var(--font-light);
  font-weight: 200;
  font-size: calc(var(--big) * (1 - var(--t)) + var(--small) * var(--t));
  /* Room for descenders ("projects" has a j) before the pivot headings. */
  line-height: 1.12;
  padding: 10px 24px 4px 20px;
  white-space: nowrap;
  overflow: hidden;
}

.wp-pivot-heads {
  flex: none;
  display: flex;
  gap: 22px;
  padding: 4px 20px 8px;
  /* Driven by the swipe (see pivot()), never scrolled directly. */
  overflow-x: hidden;
  scrollbar-width: none;
}
/* Trailing room so the last heading can slide all the way to the left edge,
   where the active heading always sits. */
.wp-pivot-heads::after { content: ''; flex: none; width: 70vw; }
.wp-pivot-heads::-webkit-scrollbar { display: none; }

.wp-pivot-head {
  flex: none;
  font-family: var(--font-light);
  font-weight: 200;
  font-size: clamp(28px, 8.4vw, 40px);
  line-height: 1.1;
  color: var(--wp-fg-dim);
  white-space: nowrap;
  transition: color 200ms var(--ease-out);
}
.wp-pivot-head.is-active { color: var(--wp-fg); }

.wp-pivot-views {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.wp-pivot-views::-webkit-scrollbar { display: none; }

.wp-pivot-view {
  flex: none;
  width: 100%;
  overflow-y: auto;
  scroll-snap-align: start;
  padding: 6px 20px 20px;
}

/* --------------------------------------------------------------------------
   CONTENT ATOMS
   -------------------------------------------------------------------------- */
.wp-prose { font-size: 15px; line-height: 1.6; color: var(--wp-fg); opacity: 0.86; }
.wp-prose + .wp-prose { margin-top: 12px; }

.wp-list { display: flex; flex-direction: column; }
.wp-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 0;
  text-align: left;
  color: var(--wp-fg);
  border-bottom: 1px solid var(--wp-panel);
}
.wp-list-item:active { background: var(--wp-panel); }
.wp-list-swatch { width: 46px; height: 46px; flex: none; background: var(--tile-color, var(--accent)); display: grid; place-items: center; color: #fff; }
.wp-list-swatch svg { width: 22px; height: 22px; }
.wp-list-text { flex: 1; min-width: 0; }
.wp-list-title { font-size: 17px; font-weight: 300; }
.wp-list-sub { font-size: 13px; color: var(--wp-fg-dim); margin-top: 2px; }

.wp-meter { height: 6px; background: var(--wp-panel); margin-top: 6px; }
.wp-meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 700ms var(--ease-out); }
.wp-app.is-ready .wp-meter i { width: var(--w); }

.wp-chip {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  margin: 0 5px 5px 0;
  background: var(--wp-panel);
  color: var(--wp-fg);
}

.wp-tilegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.wp-photo {
  position: relative;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--tile-color, var(--accent)), rgba(0,0,0,.7));
  display: flex; align-items: flex-end; padding: 8px;
  color: #fff; font-size: 12px;
}

/* --------------------------------------------------------------------------
   APP BAR
   Up to four circular buttons; the ellipsis raises the bar to reveal the
   button labels and any text-only menu items.
   -------------------------------------------------------------------------- */
.wp-appbar {
  flex: none;
  background: var(--wp-chrome);
  position: relative;
  z-index: 4;
}
.wp-appbar-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  height: 52px;
  position: relative;
  /* Symmetric, so the buttons centre on the screen rather than on the
     space left of the ellipsis. */
  padding: 0 44px;
  transition: height 160ms linear;
}
/* Opening adds a label under each circle. The row has to grow to hold it,
   or the circle gets pushed up against the panel's top edge. */
.wp-appbar.is-open .wp-appbar-row {
  height: 78px;
  align-items: flex-start;
  padding-top: 12px;
}
.wp-appbar.is-open .wp-appbar-more { top: 29px; }
.wp-appbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--wp-fg);
  /* A fixed tap area around the circle. Stretching to fill the bar made
     the empty space beside a button open it too. */
  flex: none;
  width: 64px;
}
.wp-appbar-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 2px solid var(--wp-fg);
  border-radius: 50%;
  transition: background-color 100ms linear, color 100ms linear;
}
.wp-appbar-icon svg { width: 15px; height: 15px; }
.wp-appbar-btn:active .wp-appbar-icon { background: var(--wp-fg); color: var(--wp-bg); }

.wp-appbar-label {
  font-size: 11px;
  color: var(--wp-fg);
  opacity: 0;
  max-height: 0;
  transition: opacity 160ms linear, max-height 160ms linear;
}
.wp-appbar.is-open .wp-appbar-label { opacity: 0.85; max-height: 16px; }

.wp-appbar-more {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--wp-fg);
  letter-spacing: 2px;
  font-size: 17px;
  line-height: 1;
}

.wp-appbar-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms var(--ease-out);
}
.wp-appbar.is-open .wp-appbar-menu { max-height: 220px; }
.wp-appbar-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--wp-fg);
  border-top: 1px solid rgba(128, 128, 128, 0.2);
}
.wp-appbar-item:active { background: var(--accent); color: #fff; }

/* --------------------------------------------------------------------------
   SETTINGS
   -------------------------------------------------------------------------- */
.wp-setting { padding: 14px 0; border-bottom: 1px solid var(--wp-panel); }
.wp-setting-label { font-size: 13px; color: var(--wp-fg-dim); margin-bottom: 8px; }

.wp-accents { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.wp-accent { aspect-ratio: 1; background: var(--sw); box-shadow: inset 0 0 0 0 var(--wp-fg); transition: box-shadow 120ms linear; }
.wp-accent.is-active { box-shadow: inset 0 0 0 3px var(--wp-fg); }

.wp-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }

/* --------------------------------------------------------------------------
   MISC APPS
   -------------------------------------------------------------------------- */
.wp-calc { display: flex; flex-direction: column; height: 100%; }
.wp-calc-display {
  flex: none;
  padding: 18px 20px;
  text-align: right;
  font-family: var(--font-light);
  font-weight: 200;
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.wp-calc-keys { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; }
.wp-calc-key {
  background: var(--wp-panel);
  color: var(--wp-fg);
  font-size: 20px;
  font-weight: 300;
}
.wp-calc-key:active { background: var(--accent); color: #fff; }
.wp-calc-key.is-op { color: var(--accent); }
.wp-calc-key.is-eq { background: var(--accent); color: #fff; }
.wp-calc-key.is-wide { grid-column: span 2; }

.wp-clock-face { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 6px; }
.wp-clock-big {
  font-family: var(--font-light);
  font-weight: 100;
  font-size: clamp(58px, 22vw, 110px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.wp-clock-day { font-size: 16px; color: var(--wp-fg-dim); }

.wp-mine-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.wp-mine-cell {
  aspect-ratio: 1;
  background: var(--wp-panel);
  color: var(--wp-fg);
  font-size: 14px;
  font-weight: 700;
  display: grid; place-items: center;
}
.wp-mine-cell.is-open { background: rgba(128, 128, 128, 0.12); }
.wp-mine-cell.is-mine { background: var(--c-red); color: #fff; }
.wp-mine-cell.is-flag { background: var(--c-amber); color: #000; }

.wp-ie-bar { flex: none; display: flex; gap: 8px; padding: 8px 12px; background: var(--wp-chrome); }
.wp-ie-bar input {
  flex: 1; min-width: 0;
  padding: 8px 10px;
  border: 0;
  background: var(--wp-bg);
  color: var(--wp-fg);
  font-size: 14px;
}
.wp-ie-page { padding: 16px 20px 30px; }
.wp-ie-page h1 { font-family: var(--font-light); font-weight: 200; font-size: 30px; margin-bottom: 10px; }
.wp-ie-page h2 { font-size: 18px; font-weight: 600; margin: 18px 0 7px; }
.wp-ie-page p, .wp-ie-page li { font-size: 15px; line-height: 1.6; opacity: 0.85; margin-bottom: 9px; }
.wp-ie-page ul { margin-left: 18px; }
.wp-ie-page li { list-style: disc; }
.wp-ie-page a { color: var(--accent); text-decoration: underline; }

/* Placeholder apps */
.wp-empty { display: flex; flex-direction: column; justify-content: center; gap: 14px; height: 100%; padding: 0 20px; }
.wp-empty p { font-size: 16px; line-height: 1.55; color: var(--wp-fg-dim); }


/* The terminal keeps its monospace shell on the phone, just tighter. */
.wp-app .term-body { padding: 0 16px 16px; }
.wp-app .term-out,
.wp-app .term-line { font-size: 12px; }
