/* The Drive app's shell. Tokens, buttons, notices and everything lib/render.js
 * emits come from lib/ui.css, which index.html loads first.
 *
 * Only what is specific to a full browser tab belongs here. The panel is
 * 320-500px wide; this is not, so the type is a step larger and the results
 * view puts the photo beside the metadata when there is room.
 */

body {
  font-size: 14px;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

/* The icon and the wordmark are one link. Inherits colour so it does not turn
 * accent-yellow like the rest of the anchors on the page. */
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}

.site-brand:hover h1 {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site-header img {
  border-radius: 6px;
}

.site-header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-header .muted {
  font-weight: 400;
}

.site-main {
  padding: 28px 0;
}

/* Idle and hand-off. Both are one card with one button — the token request has
 * to hang off a real click, so every entry point is a button, never a redirect. */

.stage {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.stage-card {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 32px;
  text-align: center;
}

.stage-lead {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.5;
}

.stage-card .btn {
  padding: 9px 18px;
}

.fine-print {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* The card is centred; a paragraph of explanation inside it is not. */
.notice-stage {
  margin: 20px 0 0;
  text-align: left;
}

.busy-label {
  margin: 0;
  color: var(--muted);
}

/* Results */

.privacy-line {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 12px;
}

/* A wrapping flex row, not a grid. The two basis widths plus the gap come to
 * just under 1000px, so the columns sit side by side above roughly that and
 * stack below it without a media query. */
.results-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 28px;
}

.results-media {
  flex: 1 1 360px;
  min-width: 0;
}

.results-data {
  flex: 2 1 580px;
  min-width: 0;
}

/* Nothing to show beside the metadata — do not leave a gap where the photo
 * would have been. */
.results-media:has(> [hidden]) {
  flex: 0 0 0;
  gap: 0;
}

@media (min-width: 1000px) {
  .results-media {
    position: sticky;
    top: 24px;
  }

  .preview img {
    max-height: 70vh;
  }
}

.preview-upgrade {
  display: block;
  margin-top: 10px;
}

/* Save as PDF, at the end of everything it would save. */

.save-row {
  display: flex;
  justify-content: center;
  padding: 26px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* The iOS app section, matching the bottom of the web tool.
 *
 * Deliberately light on a dark page — it is the same card the website shows,
 * and the contrast is what makes it read as "the other product" rather than
 * more of this one. Its colours are local to this block and do not touch the
 * design tokens. */

.ios-promo {
  --promo-ink: #17150f;
  --promo-body: #46433c;
  --promo-accent: #8a6d13;

  margin: 40px 0 8px;
  padding: 40px 44px 44px;
  border: 1px solid #e7e2d6;
  border-radius: 18px;
  background: linear-gradient(180deg, #fdfaf2 0%, #f7f5ef 100%);
  color: var(--promo-body);
}

.ios-promo-eyebrow {
  margin: 0 0 14px;
  color: var(--promo-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ios-promo h2 {
  margin: 0 0 20px;
  max-width: 16em;
  color: var(--promo-ink);
  font-size: 34px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ios-promo-body {
  margin: 0 0 22px;
  max-width: 46em;
  font-size: 16px;
  line-height: 1.62;
}

.ios-promo-body strong {
  color: var(--promo-ink);
  font-weight: 600;
}

.ios-promo-body a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ios-promo-url {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--promo-accent);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* Five phone screenshots, each a link to the App Store. Geometry, timing and
 * the hover lift are taken from the website's own rules rather than guessed, so
 * the two behave identically. */
.ios-promo-shots {
  display: flex;
  gap: 12px;
  margin: 16px 0 22px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.ios-promo-shots::-webkit-scrollbar {
  height: 7px;
}

.ios-promo-shots::-webkit-scrollbar-thumb {
  background: #e7e2d6;
  border-radius: 4px;
}

.shotlink {
  flex: none;
  display: block;
  line-height: 0;
  border-radius: 16px;
  scroll-snap-align: start;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* The whole point of this change: it lifts, which is what says it is clickable. */
.shotlink:hover {
  transform: translateY(-3px);
}

.shotlink:focus-visible {
  outline: 2px solid var(--promo-accent);
  outline-offset: 3px;
}

.shot {
  width: 165px;
  aspect-ratio: 511 / 1111;
  border-radius: 16px;
  border: 1px solid #e7e2d6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
  display: block;
}

/* Somebody who has asked for less motion should not get a moving advert. */
@media (prefers-reduced-motion: reduce) {
  .shotlink {
    transition: none;
  }
  .shotlink:hover {
    transform: none;
  }
}

.ios-promo-cta {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.ios-promo-devices {
  color: var(--promo-body);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.app-store-badge {
  display: inline-block;
  line-height: 0;
  border-radius: 9px;
}

.app-store-badge img {
  width: 180px;
  height: auto;
  display: block;
}

.app-store-badge:focus-visible {
  outline: 2px solid var(--promo-accent);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .ios-promo {
    padding: 30px 22px 32px;
    border-radius: 14px;
  }

  .ios-promo h2 {
    font-size: 26px;
  }
}

/* Moving between the photos in a batch */

.photo-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.photo-nav-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-nav-step .muted {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 62px;
  text-align: center;
}

/* The filmstrip. Fixed rather than in flow: the tag list can run to several
 * screens, and a strip that scrolls away is no use half way down it. */
.filmstrip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.filmstrip-item {
  flex: 0 0 auto;
  appearance: none;
  padding: 0;
  width: 66px;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filmstrip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.filmstrip-item.is-current {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.filmstrip-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A file that could not be read still gets a slot, so the strip and the table
 * stay the same length and the same order. */
.filmstrip-empty {
  color: var(--muted);
  font-size: 16px;
}

.filmstrip-item.is-failed {
  border-color: #c9483c;
}

/* Room for the strip, so the footer and the last tags are not sitting under it. */
body.has-filmstrip .page {
  padding-bottom: 88px;
}

/* Batch table */

/* Ten columns will not fit a narrow window, and the page body must never
 * scroll sideways — so the table scrolls inside its own box. */
.batch-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.batch {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.batch th,
.batch td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.batch thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-bottom-color: var(--accent);
}

.batch-sort {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.batch-sort:hover {
  color: var(--text);
}

.batch th[data-sorted="asc"] .batch-sort::after {
  content: " ▲";
}

.batch th[data-sorted="desc"] .batch-sort::after {
  content: " ▼";
}

.batch tbody tr {
  cursor: pointer;
}

.batch tbody tr:hover {
  background: var(--surface);
}

.batch tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.batch-thumb,
.batch-thumb-head {
  width: 56px;
  padding: 4px 6px 4px 10px;
}

.batch-thumb img,
.batch-thumb-empty {
  display: block;
  width: 44px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* The filename is the one column allowed to be long. */
.batch-name-column,
.batch-cell.batch-name {
  white-space: normal;
  min-width: 180px;
  max-width: 320px;
  overflow-wrap: anywhere;
}

.batch-name {
  display: block;
}

.batch-error {
  display: block;
  color: #c9483c;
  font-size: 11px;
  white-space: normal;
}

.batch-row-failed .batch-cell {
  color: var(--muted);
}

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}
