/* ============================================
   Timeline Scan: /family-archive/what-we-save/ (page-scoped)

   Loaded after styles.css AND css/family-archive.css, which supply the page
   state (.fam-live / .fam-close) and the section heads (.fam-head). Every
   selector here is ws- prefixed, so the generic phone blocks in styles.css
   that re-declare .hero / .section / .page-header near lines 5060 and 5190
   cannot clobber this layout, and it cannot clobber theirs.

   Structure:
     .ws-legend    the four row names, explained once under the h1
     .ws-tile      the 58px outlined circle (the .ab-tool__icon recipe)
     .ws-card      one detail: head, picture, four rows
     .ws-pic       the picture, with CSS chips laid over it (never baked in)
     .ws-rows      the four rows, a <dl> with one <div> per row
     .ws-reads     the four apps, in the same order on every card
     .ws-why       the popover behind a cross
     .ws-fileart   the one-file illustration in the "It stays" band

   Colour comes from the variables in styles.css only, so both themes work
   without a second palette here. The brand logos are the exception: their
   fills are the companies' own and are inline in the HTML.
   ============================================ */

/* ---------- Shared pieces ---------- */

/* The 58px circle tile, same recipe as .ab-tool__icon on /about. */
.ws-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--accent);
}

.ws-tile svg {
  width: 30px;
  height: 30px;
}

.ws-tile--lg svg {
  width: 33px;
  height: 33px;
}

/* Announced, never drawn: the check and cross glyphs are aria-hidden, so the
   yes/no has to reach a screen reader as words. */
.ws-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Hero ---------- */
.ws-hero {
  padding: 3.25rem 0 2.5rem;
}

.ws-hero h1 {
  font-size: clamp(1.75rem, 0.9rem + 3.4vw, 2.8rem);
  line-height: 1.2;
  margin-bottom: 0.9rem;
}

.ws-hero__lead {
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1rem);
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 42rem;
  margin: 0 auto 2.2rem;
}

/* The legend. Four tiles, one row on a desk, two columns on a phone, so the
   four row names below are learned once instead of five times. */
.ws-legend {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 46rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.ws-legend__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.ws-legend__label {
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* ---------- The five cards ---------- */
.ws-cards {
  display: grid;
  gap: 1.5rem;
  max-width: 980px;
  margin: 0 auto;
}

.ws-card {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "pic  rows";
  column-gap: 1.8rem;
  row-gap: 1.3rem;
  padding: 1.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* A card with an open "why" panel paints over the card beneath it. Set by the
   inline script on toggle; the :has() twin is the no-JS path. */
.ws-card--open,
.ws-card:has(details.ws-why[open]) {
  position: relative;
  z-index: 20;
}

.ws-card__head {
  grid-area: head;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ws-card__head h3 {
  margin: 0 0 0.15rem;
  font-size: 1.3rem;
  line-height: 1.25;
}

.ws-card__q {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ---------- The picture ---------- */
.ws-pic {
  grid-area: pic;
  align-self: start;
  margin: 0;
  max-width: 100%;
}

.ws-pic__frame {
  position: relative;
  display: block;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--photo-border);
  background: var(--photo-bg);
}

.ws-pic__frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
}

/* A chip laid over the picture: the year on Date, the place on Place. */
.ws-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg-secondary);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.ws-chip svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.ws-chip--year {
  left: 0.55rem;
  bottom: 0.55rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.ws-chip--pin {
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  max-width: calc(100% - 1.1rem);
  white-space: nowrap;
}

/* The date slider under the print: faint on purpose, it is a picture of a
   control, not a control. */
.ws-slider {
  position: relative;
  display: flex;
  align-items: center;
  height: 15px;
  margin-top: 0.7rem;
  max-width: 240px;
  opacity: 0.75;
}

.ws-slider__track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.ws-slider__knob {
  position: absolute;
  left: 62%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Notes: the front of the print beside its back. */
.ws-pic--pair {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  align-items: stretch;
  gap: 0.55rem;
}

.ws-pic--pair .ws-pic__frame {
  max-width: none;
}

.ws-back {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-height: 100%;
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--photo-border);
  background: var(--photo-bg);
  transform: rotate(2deg);
}

.ws-back__line {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

/* People: a soft box on each face, the name under it. */
.ws-face {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 5px;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ws-face--a {
  left: 34%;
  top: 22%;
  width: 16%;
  height: 26%;
}

.ws-face--b {
  left: 51%;
  top: 10%;
  width: 17%;
  height: 29%;
}

.ws-face__tag {
  position: absolute;
  top: calc(100% + 4px);
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg-secondary);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.ws-face--a .ws-face__tag {
  right: 0;
}

.ws-face--b .ws-face__tag {
  left: 0;
}

/* Upright: the same print on its side, then standing up. */
.ws-pic--turn {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.4rem;
}

.ws-pic--turn .ws-pic__frame {
  max-width: none;
}

.ws-pic__frame--sideways img {
  transform: rotate(-90deg);
  opacity: 0.55;
}

.ws-turn__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.ws-turn__arrow svg {
  width: 20px;
  height: 20px;
}

/* ---------- The four rows ---------- */
.ws-rows {
  grid-area: rows;
  display: grid;
  gap: 0.9rem;
  margin: 0;
}

.ws-row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  align-items: start;
  gap: 0.35rem 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-light);
}

.ws-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.ws-row dt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.35;
  color: var(--text-muted);
}

.ws-row__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--accent);
}

.ws-row__icon svg {
  width: 16px;
  height: 16px;
}

.ws-row dd {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-primary);
}

/* The apps get the full width of the card: four marks never fit beside a
   label column. */
.ws-row[data-row="reads"] {
  grid-template-columns: minmax(0, 1fr);
}

.ws-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.ws-fchip {
  display: inline-block;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}

/* The exact tags exiftool writes. Mono because they are names of fields, not
   prose, and a reader who knows them wants them verbatim. */
.ws-tags {
  display: inline-block;
  padding: 0.24rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ws-how {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.ws-row[data-row="file"] .ws-tags + .ws-how {
  margin-top: 0.45rem;
}

/* ---------- Who reads it ---------- */
.ws-reads {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.ws-mark {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-height: 48px;
  padding: 0.7rem 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  text-align: center;
}

.ws-mark__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.ws-mark__logo svg {
  width: 26px;
  height: 26px;
}

.ws-mark__appicon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: block;
}

.ws-mark__name {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.ws-mark__how {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* The verdict, top right, so a reader scanning the row of four sees the
   answer before the words. */
.ws-mark__glyph {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.78rem;
  line-height: 1;
}

/* The check and the cross are drawn here, not written in the markup: they
   are decoration (the <span class="ws-sr"> beside each one is what a screen
   reader hears), and generated content stays out of the innerText the word
   budget is measured on. */
.ws-mark--yes .ws-mark__glyph {
  background: var(--green-light);
  color: var(--green);
}

.ws-mark--yes .ws-mark__glyph::before {
  content: "\2713";
}

.ws-mark--no .ws-mark__glyph {
  background: var(--red-light);
  color: var(--red);
}

.ws-mark--no .ws-mark__glyph::before {
  content: "\2717";
}

.ws-mark--no {
  border-style: dashed;
}

/* A cross is a door, and a reader who cannot see the screen-reader hint
   needs to be told so: the qualifier slot carries "Tap for why" in the link
   colour, and goes quiet while the panel is open. */
.ws-mark__how--why {
  color: var(--accent);
  font-weight: 600;
}

.ws-why[open] .ws-mark__how--why {
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- The "why" behind a cross ---------- */
.ws-why {
  position: relative;
  display: flex;
  flex-direction: column;
}

.ws-why > summary.ws-mark {
  flex: 1 1 auto;
  cursor: pointer;
  list-style: none;
}

.ws-why > summary.ws-mark::-webkit-details-marker {
  display: none;
}

.ws-why > summary.ws-mark::marker {
  content: "";
}

.ws-why > summary.ws-mark:hover {
  border-color: var(--accent);
}

.ws-why > summary.ws-mark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ws-why[open] {
  z-index: 21;
}

.ws-why[open] > summary.ws-mark {
  border-color: var(--accent);
  border-style: solid;
}

.ws-why__panel {
  position: absolute;
  z-index: 22;
  top: calc(100% + 0.5rem);
  left: 0;
  width: max-content;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

/* Last column: hang the panel off the right edge so it cannot leave the
   viewport. Four across on a desk, two across on a phone. */
.ws-reads > .ws-why:nth-child(4n) .ws-why__panel {
  left: auto;
  right: 0;
}

.ws-why__panel p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ws-why__panel p + p {
  margin-top: 0.6rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* ---------- It stays in the file ---------- */
.ws-stays__grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.ws-fileart {
  margin: 0;
  max-width: 100%;
}

/* One photo file: the print inside a document outline, the five details
   tagged to its edge. */
.ws-fileart__doc {
  position: relative;
  display: block;
  padding: 0.9rem 2.6rem 0.9rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.ws-fileart__doc img {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--photo-border);
}

.ws-fileart__tags {
  position: absolute;
  top: 50%;
  right: -20px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ws-fileart__tag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--accent);
}

.ws-fileart__tag svg {
  width: 19px;
  height: 19px;
}

.ws-fileart__line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-right: 1.6rem;
  opacity: 0.7;
}

.ws-fileart__rule {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--border));
}

.ws-fileart__year {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ws-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.2rem;
}

.ws-points li {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ws-points p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.ws-stays__line {
  max-width: 44rem;
  margin: 2.4rem auto 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ---------- Take it anywhere ---------- */
.ws-take__list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.ws-take__list li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  text-align: center;
}

.ws-take__list p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.ws-take__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 2rem;
  margin: 2rem 0 0;
}

.ws-take__links a {
  font-family: var(--font-ui);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-glow);
  padding-bottom: 2px;
}

.ws-take__links a:hover,
.ws-take__links a:focus-visible {
  border-bottom-color: var(--accent);
}

/* ---------- Three questions ---------- */
.ws-faq .faq__list {
  max-width: 44rem;
  margin: 0 auto;
}

/* ---------- Tablets ---------- */
@media (max-width: 900px) {
  .ws-card {
    grid-template-columns: 200px minmax(0, 1fr);
    column-gap: 1.4rem;
  }

  .ws-row {
    grid-template-columns: 9.5rem minmax(0, 1fr);
  }

  .ws-stays__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.8rem;
    max-width: 34rem;
  }

  .ws-fileart {
    max-width: 20rem;
    margin: 0 auto;
  }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .ws-hero {
    padding: 2.4rem 0 2rem;
  }

  .ws-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem 0.8rem;
    max-width: 22rem;
  }

  .ws-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "pic"
      "rows";
    padding: 1.25rem 1.1rem;
    row-gap: 1.1rem;
  }

  .ws-pic__frame,
  .ws-slider {
    max-width: none;
  }

  /* The rows stack: a 9.5rem label column beside a sentence is a column of
     two words on a phone. */
  .ws-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }

  /* One app per row on a phone, as a list: logo, then name and qualifier,
     the answer at the right. A cross's explanation then opens in flow under
     its own row, like an accordion. A floating panel over a two-by-two grid
     always covered the mark beneath it, so a reader's next tap closed a
     panel instead of opening the one they aimed at. */
  .ws-reads {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .ws-mark {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.55rem 2.7rem 0.55rem 0.7rem;
    text-align: left;
  }

  .ws-mark__text {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ws-mark__glyph {
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    font-size: 0.9rem;
  }

  .ws-why__panel,
  .ws-reads > .ws-why:nth-child(4n) .ws-why__panel {
    position: static;
    width: auto;
    max-width: none;
    margin-top: 0.4rem;
    box-shadow: var(--shadow-sm);
  }

  .ws-take__list {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.3rem;
    max-width: 22rem;
  }

  .ws-take__list li {
    flex-direction: row;
    align-items: center;
    text-align: left;
  }

  .ws-stays__line {
    margin-top: 1.8rem;
  }
}

@media (max-width: 400px) {
  .ws-card__head {
    gap: 0.8rem;
  }

  .ws-mark {
    padding: 0.65rem 0.4rem 0.55rem;
  }
}
