:root {
  --mint: #19e3c3;
  --mint-dark: #0fb99d;
  --navy: #0f1535;
  --muted: #6b7088;
  --chip: #eef0f6;
  --field: #f2f3f8;
  --line: #dfe2ec;
  --page: #e9ebff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: #fff;
  color: var(--navy);
  font: 15px/1.5 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: var(--mint-dark); }

/* Header: mint band with rounded bottom, like the reference */
.hero {
  background: var(--mint);
  border-radius: 0 0 44px 44px;
  padding-bottom: 28px;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { font-size: 1.3rem; font-weight: 300; color: var(--navy); text-decoration: none; }
.brand strong { font-weight: 800; }
.topbar nav a {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  margin-left: 18px;
}
.topbar nav a.nav-cta {
  display: inline-block;
  margin: 0;
  background: var(--navy);
  color: var(--mint);
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 99px;
  box-shadow: 0 4px 12px rgba(15, 21, 53, .3);
  transition: transform .1s;
}
.topbar nav a.nav-cta:hover { transform: translateY(-2px); }
.hero h1 { font-size: 1.6rem; font-weight: 800; margin: 10px 0 18px; }

.search {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 99px;
  padding: 4px 6px 4px 20px;
}
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--navy);
  padding: 10px 0;
  min-width: 0;
}
.search button {
  border: 0;
  background: transparent;
  color: var(--navy);
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.filters label {
  display: grid;
  gap: 4px;
  font-size: .8rem;
  font-weight: 800;
}
.filters select {
  width: 100%;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, .55);
  color: var(--navy);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  padding: 8px 14px;
}

button.clear {
  margin-top: 12px;
  border: 0;
  background: var(--navy);
  color: #fff;
  border-radius: 99px;
  padding: 7px 16px;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}

main.wrap { padding-top: 24px; padding-bottom: 56px; flex: 1; width: 100%; }

/* Footer: mint band's counterpart, with the legal notice */
.site-footer {
  background: var(--navy);
  color: #c9cce0;
  border-radius: 44px 44px 0 0;
  padding: 22px 0 26px;
  font-size: .78rem;
  line-height: 1.6;
}
.site-footer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.site-footer summary::-webkit-details-marker { display: none; }
.site-footer summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--mint);
  border-bottom: 2px solid var(--mint);
  transform: rotate(45deg);
  transition: transform .15s;
}
.site-footer details[open] summary { margin-bottom: 14px; }
.site-footer details[open] summary::after { transform: rotate(-135deg); }
.site-footer summary:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
.site-footer p { margin: 0 0 10px; }
.site-footer strong { color: #fff; }
h2.section { font-size: 1.2rem; font-weight: 800; margin: 0; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* On/off switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .85rem; font-weight: 700; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: #c9ccdb;
  transition: background .15s;
  flex: none;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 21, 53, .35);
  transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--mint-dark); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Cards */
.card { padding: 18px 0; border-bottom: 1px solid var(--line); }
.card h2 { font-size: 1.25rem; font-weight: 800; margin: 0; }
.card .meta { color: var(--mint-dark); font-weight: 600; font-size: .85rem; margin: 2px 0 8px; }
.card p { margin: 0 0 12px; font-size: .85rem; color: #2b3050; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
  background: var(--chip);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: .75rem;
  font-weight: 700;
}
.badge.rating { background: var(--navy); color: #fff; }
.badge.state { background: #d6fbf4; color: #086b5a; }
/* Stories whose link is no longer public: greyed out and not clickable */
.card.unavailable h2 { color: var(--muted); }
.card.unavailable .meta, .card.unavailable p, .card.unavailable .tags-line { color: #a3a7b8; }
.card.unavailable .badge { background: #eceef3; color: #9a9eb0; }
.card.unavailable .badge.gone { background: #8a8fa6; color: #fff; }
.btn.disabled {
  background: #e6e8ef;
  border-color: #e6e8ef;
  color: #9a9eb0;
  cursor: not-allowed;
}

/* Tooltip on the "Not available" button: hover, keyboard focus, or tap (".open", set by tooltip.js) */
.tip-wrap { position: relative; display: inline-block; }
.tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 10;
  width: max-content;
  max-width: min(260px, 78vw);
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(15, 21, 53, .28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .12s, transform .12s, visibility .12s;
  pointer-events: none;
}
.tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 22px;
  border: 7px solid transparent;
  border-top-color: var(--navy);
}
.tip-wrap.open .tip,
.tip-wrap:has(:focus-visible) .tip { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) {
  .tip-wrap:hover .tip { opacity: 1; visibility: visible; transform: none; }
}
.tags-line { margin-top: 10px; font-size: .75rem; color: var(--muted); }

/* Buttons */
.btn, button.btn {
  display: inline-block;
  background: var(--mint);
  color: var(--navy);
  border: 2px solid var(--mint);
  border-radius: 10px;
  padding: 10px 28px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.btn.outline { background: #fff; border-color: var(--navy); }
.btn.block { display: block; width: 100%; text-align: center; padding: 14px; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: default; }

/* Main call to action: big, mint with navy text, pinned to the bottom of the screen */
.cta-bar {
  position: sticky;
  bottom: 0;
  margin: 8px -20px 0;
  padding: 16px 20px 20px;
  background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0));
}
.btn.cta {
  background: var(--mint);
  border-color: var(--mint);
  color: var(--navy);
  font-size: 1.2rem;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15, 185, 157, .35);
  transition: transform .1s, box-shadow .1s;
}
.btn.cta:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(15, 185, 157, .45); }
.btn.cta:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
/* Not ready yet: clearly different from the active button, so it is obvious it cannot be pressed */
.btn.cta:disabled {
  background: var(--chip);
  border-color: var(--chip);
  color: var(--muted);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}
.submit-hint { margin: 0 0 10px; text-align: center; color: var(--muted); font-size: .85rem; min-height: 1.3em; }

/* Form */
.upload { display: grid; gap: 22px; }
.field { display: grid; gap: 6px; }
.field > span, fieldset legend { font-weight: 800; padding: 0; }
.field small, fieldset small { color: var(--muted); font-size: .8rem; }
.upload input[type=url], .upload input[type=text], .upload input[type=password], .upload textarea {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--field);
  color: var(--navy);
  font: inherit;
  padding: 12px 16px;
}
.upload input:focus, .upload textarea:focus { outline: 0; border-color: var(--navy); }
.check { display: flex; align-items: flex-start; gap: 12px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--navy); cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span {
  display: inline-block;
  background: var(--chip);
  border: 2px solid transparent;
  border-radius: 99px;
  padding: 7px 18px;
  font-weight: 700;
}
.chips input:checked + span { background: #fff; border-color: var(--navy); }
.chips input:focus-visible + span { outline: 2px solid var(--mint-dark); outline-offset: 2px; }

/* Thank-you screen */
.thanks { text-align: center; padding: 24px 0 8px; display: grid; gap: 12px; justify-items: center; }
.thanks .check {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--mint);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.thanks h2 { font-size: 1.8rem; font-weight: 800; margin: 0; }
.thanks p { color: var(--muted); margin: 0 0 12px; }
.thanks .btn { width: 100%; max-width: 360px; text-align: center; padding: 14px; font-size: 1.05rem; }

/* Reader */
.byline { font-weight: 600; margin-bottom: 10px; }
.hero .chips-row { margin-bottom: 0; }
.chapter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 28px; }
.chapter-bar select {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 99px;
  background: var(--field);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  padding: 11px 16px;
}
.btn.small { padding: 8px 16px; }
.reader-tools {
  position: sticky;
  top: 10px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
  pointer-events: none; /* the row is transparent: only the buttons catch clicks */
}
.tool {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 99px;
  background: var(--chip);
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 21, 53, .18);
}
.tool:disabled { opacity: .4; cursor: default; }
.tool.danger { background: #d6293e; color: #fff; }
.tool.danger:hover:not(:disabled) { background: #b81f33; }
.tool.danger:focus-visible { outline-color: #d6293e; }

/* What each tool does: shown on hover, on keyboard focus, and briefly after a tap (tooltip.js) */
.tool[data-tip] { position: relative; }
.tool[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: max-content;
  max-width: min(220px, 70vw);
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--tip-bg, #0f1535);
  color: var(--tip-fg, #fff);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 6px 18px rgba(15, 21, 53, .28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .12s, transform .12s, visibility .12s;
  pointer-events: none;
}
.tool[data-tip]:focus-visible::after,
.tool[data-tip].tip-open::after { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) {
  .tool[data-tip]:hover::after { opacity: 1; visibility: visible; transform: none; }
}
.tool[aria-expanded="true"]::after { display: none; } /* the open menu already explains itself */
.share-note {
  align-self: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--chip);
  border-radius: 99px;
  padding: 4px 12px;
}
.share-note:empty { display: none; }
.tool:focus-visible { outline: 3px solid var(--mint-dark); outline-offset: 2px; }
.icon-sun { display: none; }
html.dark .icon-sun { display: block; }
html.dark .icon-moon { display: none; }

/* Dark reading mode: the mint header stays, the reading area goes dark */
html.dark body { background: #12152b; }
html.dark main {
  --tip-bg: #e4e6f4;
  --tip-fg: #0f1535;
  --dialog-bg: #1b1f3d;
  --chip: #262a4d;
  --field: #262a4d;
  --line: #2f3460;
  --muted: #a0a5c6;
  --navy: #e4e6f4;
  color: #e4e6f4;
}
html.dark main .btn { color: #0f1535; }
html.dark main .btn.outline { background: transparent; border-color: #8d93b8; color: #e4e6f4; }
html.dark .site-footer { background: #0a0d22; }

/* The page is a column: the text takes all the free height, so the chapter buttons and the report
   button always sit at the bottom, even when a chapter is short. */
.reader-main { display: flex; flex-direction: column; }
.reader-main .story-area { flex: 1; width: 100%; }

/* The author's own words, set apart from the story */
.authors-note {
  max-width: 680px;
  margin: 40px auto 0;
  padding: 18px 22px;
  border-radius: 16px;
  background: var(--chip);
}
.authors-note h2 { margin: 0 0 8px; font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.authors-note p { margin: 0; font-size: .95rem; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }

/* Small print about what this chapter does not show */
.media-note { width: 100%; max-width: 680px; margin: 28px auto 0; font-size: .72rem; line-height: 1.5; color: var(--muted); text-align: center; }

.story {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: var(--story-size, 1.15rem);
  line-height: 1.8;
  max-width: 680px;
  margin: 0 auto;
}
.story p { margin: 0 0 1.1em; }
.story .chapter-title { font-family: 'Montserrat', system-ui, sans-serif; font-size: 1.4rem; font-weight: 800; margin: 0 0 24px; }
.story blockquote { margin: 0 0 1.1em; padding-left: 1em; border-left: 4px solid var(--mint); }
.story hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; width: 100%; max-width: 680px; margin: 48px auto 0; }

/* Translate menu */
.tool-menu { position: relative; pointer-events: auto; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(300px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: var(--dialog-bg, #fff);
  color: var(--navy);
  box-shadow: 0 10px 30px rgba(15, 21, 53, .28);
  font-size: .85rem;
}
.menu-field { display: grid; gap: 6px; font-weight: 800; }
.menu-field select {
  border: 0;
  border-radius: 99px;
  background: var(--field);
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  padding: 9px 14px;
}
.menu-btn { width: 100%; text-align: center; padding: 10px; }
.menu-status { margin: 0; min-height: 1.2em; font-weight: 700; }
.menu-status:empty { display: none; }
.menu-link { font-weight: 800; }
.menu-note { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }

/* Kudos: the heart at the end of the story, and the small count on catalog cards */
.kudos-row { width: 100%; max-width: 680px; margin: 40px auto 0; display: grid; justify-items: center; gap: 8px; }
.kudos-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--navy);
  border-radius: 99px;
  background: transparent;
  color: var(--navy);
  padding: 10px 14px 10px 22px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.kudos-btn svg { fill: none; transition: fill .15s; }
.kudos-btn:hover:not(:disabled) { border-color: #d6293e; color: #d6293e; }
.kudos-btn:focus-visible { outline: 3px solid var(--mint-dark); outline-offset: 3px; }
.kudos-btn.given { background: #d6293e; border-color: #d6293e; color: #fff; cursor: default; }
.kudos-btn.given svg { fill: currentColor; }
.kudos-count {
  min-width: 2em;
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--chip);
  color: var(--navy);
  font-size: .85rem;
  text-align: center;
}
.kudos-btn.given .kudos-count { background: rgba(255, 255, 255, .25); color: #fff; }
#kudosNote { color: #d6293e; font-weight: 700; }
#kudosNote:empty { display: none; }

.card-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.kudos-tag { font-size: .85rem; font-weight: 800; color: var(--muted); }
.kudos-tag .heart { color: #d6293e; }

/* Author's social media, at the end of the story */
.author-note {
  width: 100%;
  max-width: 680px;
  margin: 40px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}
.author-note p { margin: 0; font-weight: 800; }
.author-note small { color: var(--muted); font-size: .75rem; }
.optional { font-weight: 500; color: var(--muted); }

/* Report */
.report-row { width: 100%; max-width: 680px; margin: 32px auto 0; }
.btn.danger { background: #d6293e; border-color: #d6293e; color: #fff; }
html.dark main .btn.danger { color: #fff; }
.btn.danger:hover:not(:disabled) { background: #b81f33; border-color: #b81f33; }
.report-row .btn.danger { padding: 8px 18px; font-size: .85rem; }
.report-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 0;
  border-radius: 20px;
  padding: 24px;
  background: var(--dialog-bg, #fff);
  color: var(--navy);
  box-shadow: 0 20px 50px rgba(15, 21, 53, .4);
}
.report-dialog::backdrop { background: rgba(15, 21, 53, .55); }
.report-dialog h2 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 800; }
.report-hint { margin: 0 0 14px; color: var(--muted); font-size: .85rem; }
.report-dialog textarea {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--field);
  color: var(--navy);
  font: inherit;
  padding: 12px 14px;
  resize: vertical;
}
.report-dialog textarea:focus { outline: 0; border-color: var(--navy); }
.captcha { margin-top: 12px; min-height: 65px; }
.report-status { min-height: 1.4em; margin: 8px 0; color: #d6293e; font-weight: 700; font-size: .85rem; }
.report-actions { display: flex; justify-content: flex-end; gap: 10px; }
.report-done { text-align: center; display: grid; gap: 12px; justify-items: center; }
.report-done p { margin: 0; color: var(--muted); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#msg { padding: 12px 16px; border-radius: 14px; display: none; font-weight: 600; }
#msg.ok { display: block; background: #d6fbf4; color: #086b5a; }
#msg.error { display: block; background: #fde3e6; color: #8a1c2b; }
.empty, .loading { color: var(--muted); text-align: center; padding: 40px 0; }

/* Skeletons: grey shapes, shimmering, where the content is about to appear */
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
.sk {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--chip) 30%, var(--sk-shine, #f8f9fc) 50%, var(--chip) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; background: var(--chip); }
}
.sk-line { height: .95rem; margin: 0 0 .8rem; }
.sk-paragraph { margin: 0 0 1.6rem; }
.sk-story { max-width: 680px; margin: 0 auto; }

.sk-card { pointer-events: none; }
.sk-card-title { height: 1.3rem; margin-bottom: .7rem; }
.sk-card-author { height: .9rem; margin-bottom: 1rem; }
.sk-chip { display: inline-block; height: 1.4rem; border-radius: 99px; }
.sk-card-summary { margin: 4px 0 14px; }
.sk-button { width: 92px; height: 42px; border-radius: 10px; }

/* In the mint header, the shapes are light instead of grey */
.hero .sk {
  background: linear-gradient(90deg, rgba(255, 255, 255, .32) 30%, rgba(255, 255, 255, .62) 50%, rgba(255, 255, 255, .32) 70%);
  background-size: 300% 100%;
}
@media (prefers-reduced-motion: reduce) {
  .hero .sk { background: rgba(255, 255, 255, .4); }
}
.sk-title { height: 1.7rem; width: min(60%, 360px); border-radius: 10px; }
.sk-byline { height: 1rem; width: min(30%, 180px); }
.sk-badge { display: inline-block; height: 1.5rem; width: 74px; border-radius: 99px; }
.hero h1:has(.sk), .hero .byline:has(.sk) { line-height: 1; }

html.dark main { --sk-shine: #343968; }
.more { text-align: center; margin-top: 20px; }
