/* Copyright QFormula 1997-onwards. For full text of the copyright contact copyright owner. */

/* Palette. Kept as tokens so the whole site can be re-skinned to match
   tfa.ca in one place when the two sites are visually aligned. */
:root {
  --ink:        #26272b;
  --ink-soft:   #5c5f66;
  --ink-faint:  #8b8e96;
  --bg:         #ffffff;
  --bg-soft:    #f7f7f9;
  --line:       #e6e6ea;
  --accent:     #6b4ec7;
  --accent-dk:  #4f38a0;
  /* Platform headings. Brightest cyan that still clears WCAG AA on
     white (5.36:1); a more saturated cyan drops under 4:1. */
  --platform:   #0e7490;
  --platform-bg:#ecfdff;
  /* Tagline blue, picked to harmonise with the logo's #c2dff2 ground.
     The requested #0789cc reads beautifully but is 3.85:1 on white, under the
     4.5:1 AA floor for text this size; this is the nearest hue that clears it
     at 5.19:1. */
  --tagline:    #1273a8;
  --chip-a-bg:  #eef2ff;  --chip-a-fg: #3f4fb5;
  --chip-b-bg:  #eefaf2;  --chip-b-fg: #217a4b;
  --chip-c-bg:  #fdf0ff;  --chip-c-fg: #8d3b9c;
  --chip-d-bg:  #fff4e8;  --chip-d-fg: #9a5a1c;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(20,20,40,.06), 0 6px 20px rgba(20,20,40,.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Sans 3", "Source Sans Pro", -apple-system,
               BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* --- Header ------------------------------------------------------------ */
.site-head { padding: 30px 0 4px; }
.site-title {
  margin: 0; font-size: 1.95rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--accent-dk); line-height: 1.15;
}
/* Logo and heading share a row on anything wider than a phone; below that the
   row wraps and they stack, which is the natural reading order anyway. */
.head-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-logo { display: block; width: 112px; height: auto; flex: none; border-radius: 6px; }
.head-text { min-width: 0; }
.site-tagline { margin: 2px 0 0; color: var(--tagline); font-size: 1.02rem;
                font-weight: 600; }
.site-intro { margin: 14px 0 0; color: var(--ink-soft); font-size: .92rem;
              max-width: 62ch; }
.site-foot-link { margin: 6px 0 0; }
.site-foot-link a { color: var(--accent); text-decoration: none;
                    font-weight: 600; }
.site-foot-link a:hover { text-decoration: underline; }
.home-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.home-link:hover { text-decoration: underline; }
.arr { font-weight: 400; }

/* Footer navigation on a work page: back to the catalogue on the left,
   back to the top on the right. */
.work-foot { display: flex; flex-wrap: wrap; gap: 12px;
             align-items: center; justify-content: space-between; }
.colophon { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.logo-link { display: block; flex: none; line-height: 0; border-radius: 6px; }
.logo-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.top-link { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.top-link:hover { color: var(--accent); text-decoration: underline; }

/* --- Search + filters --------------------------------------------------- */
.controls { margin: 26px 0 8px; }
#q {
  width: 100%; padding: 13px 16px; font: inherit; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); outline: none;
}
#q:focus { border-color: var(--accent); background: var(--bg);
           box-shadow: 0 0 0 3px rgba(107,78,199,.13); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-soft); font-size: .92rem;
  cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.count { margin: 16px 0 0; color: var(--ink-faint); font-size: .92rem; }

/* --- Card grid ---------------------------------------------------------- */
.grid {
  display: grid; gap: 22px; margin: 22px 0 60px;
  grid-template-columns: 1fr;
}
@media (min-width: 620px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover {
  transform: translateY(-2px); border-color: #d6d2ea;
  box-shadow: 0 2px 6px rgba(20,20,40,.08), 0 14px 32px rgba(20,20,40,.10);
}
.card-img { background: var(--bg-soft); aspect-ratio: 1 / 1;
            display: flex; align-items: center; justify-content: center; }
.card-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card-img.empty { color: var(--ink-faint); font-size: .9rem; }
.card-body { padding: 14px 16px 18px; }
.card-title { margin: 0 0 6px; font-size: 1.06rem; font-weight: 700; line-height: 1.3; }
.card-meta { margin: 0; color: var(--ink-soft); font-size: .9rem; }

/* A card is a link; the call to action says so, rather than leaving a visitor
   to guess that the cover is clickable. Formats now ride on the meta line. */
.card-cta { margin: 8px 0 0; color: var(--accent); font-size: .9rem;
            font-weight: 700; text-decoration: underline;
            text-underline-offset: 3px; text-decoration-thickness: 1px; }
.card:hover .card-cta { color: var(--accent-dk); }
.card:hover .card-cta .arr { margin-left: 3px; }
.card-cta .arr { display: inline-block; transition: margin-left .15s ease; }

/* --- Chips by type ------------------------------------------------------ */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px;
       font-size: .78rem; font-weight: 600; margin: 0 6px 6px 0; }
.tag-Book     { background: var(--chip-a-bg); color: var(--chip-a-fg); }
.tag-Coloring { background: var(--chip-c-bg); color: var(--chip-c-fg); }
.tag-Song     { background: var(--chip-b-bg); color: var(--chip-b-fg); }
.tag-Poem     { background: var(--chip-b-bg); color: var(--chip-b-fg); }
.tag-Video    { background: var(--chip-d-bg); color: var(--chip-d-fg); }

.empty-state { padding: 40px 0 70px; color: var(--ink-faint); text-align: center; }

/* --- Work page ---------------------------------------------------------- */
.work-head { display: grid; gap: 28px; margin: 26px 0 34px;
             grid-template-columns: 1fr; }
@media (min-width: 720px) { .work-head { grid-template-columns: 300px 1fr; } }
.work-cover img { width: 100%; border-radius: var(--radius);
                  border: 1px solid var(--line); box-shadow: var(--shadow); }
.work-title { margin: 0 0 8px; font-size: 1.9rem; line-height: 1.2;
              letter-spacing: -.02em; }
.work-sub { margin: 0 0 16px; color: var(--ink-soft); }
.work-blurb { margin: 18px 0 0; }

.edition {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 0 0 14px; background: var(--bg-soft);
}
.edition h3 { margin: 0 0 4px; font-size: 1.05rem; }
.edition .specs { margin: 0 0 10px; color: var(--ink-soft); font-size: .9rem; }
/* One block per platform: the platform named once, then a button per region.
   The region carries the contrast, since that is what the reader chooses. */
.buys { display: flex; flex-direction: column; gap: 14px; }
.plat-name {
  margin: 0 0 7px; font-size: .86rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--platform);
  display: inline-block; padding: 2px 9px; border-radius: 5px;
  background: var(--platform-bg);
}
.plat-links { display: flex; flex-wrap: wrap; gap: 8px; }
.buy {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--accent-dk); text-decoration: none; font-size: .9rem; font-weight: 600;
}
.buy:hover { border-color: var(--accent); background: #fbfaff; }
.buys.row { flex-direction: row; flex-wrap: wrap; gap: 8px; }
/* Icon-sized flags. The hairline keeps white-edged flags (US, CA)
   from bleeding into a white button. */
.flag { width: 20px; height: 14px; flex: none; display: block;
        border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.buy.review { color: var(--chip-c-fg); }

/* Each edition shows its own cover, so a print spread is visible where the
   card could only show one image. */
.edition { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 640px) { .edition { grid-template-columns: 150px 1fr; } }
.ed-cover img {
  width: 100%; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; display: block;
}

h2.section { font-size: 1.25rem; margin: 34px 0 14px; }
footer { border-top: 1px solid var(--line); margin-top: 50px;
         padding: 22px 0 46px; color: var(--ink-faint); font-size: .88rem; }
footer a { color: var(--ink-soft); }
