:root {
  --library-reading-size: 17px;
  --bg: #17140f;
  --surface: #221e19;
  --fg: #ece5da;
  --muted: #a79e92;
  --line: #3a332b;
  --accent: #ee9a62;
  --teal: #8cc3c4;
  --display: Arial, Helvetica, sans-serif;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #efe8dc;
  --surface: #fffaf2;
  --fg: #231f1b;
  --muted: #615a52;
  --line: #d9cfbf;
  --accent: #a84a24;
  --teal: #2f5d62;
}
html[data-theme="dark"] { color-scheme: dark; }
.library-head-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(130px, 23vw, 212px);
  align-items: start;
  gap: 22px;
}
.library-head-copy { min-width: 0; }
.library-head-copy .back { margin-top: 22px; }
.library-nicole-photo {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 18px;
  border-radius: 4px;
  transform: translate(clamp(-82px, -8.3vw, -44px), 14px);
}
.volume-tools {
  margin: 0 0 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
}
.volume-tool-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.volume-search {
  flex: 1 1 220px;
  width: auto;
  min-width: 150px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 16px;
}
.volume-search::placeholder { color: var(--muted); }
.volume-tool,
.article-save {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font: 600 14px Arial, Helvetica, sans-serif;
  cursor: pointer;
}
.volume-tool:hover,
.article-save:hover { border-color: var(--accent); }
.volume-tool:focus-visible,
.article-save:focus-visible,
.volume-note-editor:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.volume-size-down { background: #9e4242; border-color: #dc9696; color: #fff; }
.volume-size-up { background: #326e70; border-color: #82bfc0; color: #fff; }
.volume-saved,
.volume-layout { background: color-mix(in srgb, #326e70 24%, var(--surface)); border-color: #82bfc0; }
.volume-saved[aria-pressed="true"],
.volume-layout[aria-pressed="true"] { background: #326e70; border-color: #b4e9e6; color: #fff; }
.volume-save-all,
.volume-notes-toggle { border-color: var(--accent); }
.volume-save-all { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.volume-notes-toggle { background: var(--surface); }
.volume-attach { border-color: #777064; }
.volume-notes {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 1.5px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
}
.volume-notes label { margin: 0 0 8px; font-size: 16px; }
.volume-note-editor {
  display: block;
  width: 100%;
  min-height: 100px;
  margin-top: 7px;
  padding: 10px 12px;
  resize: vertical;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font: 16px/1.5 Arial, Helvetica, sans-serif;
}
.volume-note-editor:focus { border-color: var(--accent); }
.volume-note-status,
.volume-tools::after { color: var(--muted); font-size: 13px; }
.volume-tools::after {
  content: attr(data-status);
  display: block;
  margin: 9px 2px 0;
}
.edition-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.library-call {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 80px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--teal);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.library-call img {
  display: block;
  width: 80px;
  height: 80px;
  flex: 0 0 80px;
  object-fit: contain;
}
.library-call:hover { color: var(--accent); }
.library-call:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.volume-file-names { margin: 8px 0; padding-left: 22px; font-size: 14px; }
.volume-share { margin-top: 7px; border-color: #82bfc0; }
.matches.large-cards { grid-template-columns: 1fr; }
.article { display: flex; flex-direction: column; }
.article > div { display: flex; flex: 1; flex-direction: column; align-items: flex-start; }
.article h3 { font-size: calc(var(--library-reading-size) + 2px); }
.article p { font-size: var(--library-reading-size); }
.article-save { margin-top: auto; border-color: var(--accent); color: var(--accent); }
.article-save[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.volume-empty { grid-column: 1 / -1; padding: 14px; color: var(--muted); }
@media (max-width: 600px) {
  .library-head-section { grid-template-columns: minmax(0, 1fr) clamp(96px, 29vw, 140px); gap: 12px; }
  .library-nicole-photo { margin-top: 18px; transform: translateY(8px); }
  .volume-tools { padding: 11px; }
  .volume-tool-row { gap: 7px; }
  .volume-search { flex: 1 0 100%; }
  .volume-tool { min-height: 38px; padding: 7px 10px; font-size: 13px; }
}

/* Original newsletter-card link alongside existing Library actions. */
.article-library-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:auto;padding-top:4px}
.article-library-actions .article-save{margin-top:0;min-height:44px}
.article-read{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:8px 13px;border:1px solid var(--accent);border-radius:999px;background:var(--surface);color:var(--accent);font:600 14px Arial,Helvetica,sans-serif;text-decoration:none;cursor:pointer}
.article-read:hover{background:color-mix(in srgb,var(--accent) 12%,var(--surface))}
.article-read:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

/* Computer/tablet Library toolbar cleanup; phone controls remain available. */
html[data-hlf-library-desktop="true"] :is(.volume-search,.volume-attach){display:none!important}

/* Compact matching Library toolbar widths on computers and tablets. */
html[data-hlf-library-desktop="true"] .volume-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;--library-tool-width:144px}
html[data-hlf-library-desktop="true"] .volume-tool-row,
html[data-hlf-library-desktop="true"] .library-reader-tools-row{display:contents}
html[data-hlf-library-desktop="true"] .volume-tool-row>.volume-tool:not(.volume-size-down):not(.volume-size-up),
html[data-hlf-library-desktop="true"] .library-reader-tools-row>.hlf-reader-trigger{box-sizing:border-box;flex:0 0 var(--library-tool-width);width:var(--library-tool-width);min-width:0;max-width:100%;padding-inline:7px;white-space:nowrap;margin:0}
html[data-hlf-library-desktop="true"] .volume-tool-row>:is(.volume-size-down,.volume-size-up){box-sizing:border-box;flex:0 0 44px;width:44px;min-width:44px;padding-inline:0;margin:0}
html[data-hlf-library-desktop="true"] .volume-tools>.volume-notes,
html[data-hlf-library-desktop="true"] .volume-tools::after{flex:0 0 100%;box-sizing:border-box;min-width:0}

/* Let the original newsletter pill retain its natural, single-line width. */
html[data-hlf-library-desktop="true"] .edition-actions > .open {
  flex: 0 0 auto;
  white-space: nowrap;
}
html[data-hlf-library-desktop="true"] .edition-actions > .library-call {
  box-sizing: border-box;
  justify-content: center;
  width: min(100%, 12.5rem);
  min-height: 0;
  padding: 9px 17px;
  border: 1px solid var(--teal);
  border-radius: 999px;
}
html[data-hlf-library-desktop="true"] .edition-actions > .library-call img { display: none; }
html[data-hlf-library-desktop="true"] .edition-actions > .library-call:focus-visible {
  outline-color: var(--teal);
}

/* Library actions on light backgrounds, including every edition and viewport. */
html[data-theme="light"] .newsletter-library-page .library-reader-tools-row > .hlf-reader-trigger {
  background: #dbeae7;
  color: #193b38;
  border-color: #447774;
}
html[data-theme="light"] .newsletter-library-page .hlf-reader-trigger .hlf-reader-arrow {
  stroke: #2f5d62;
}
html[data-theme="light"] .newsletter-library-page :is(.edition-actions .open, .article-read, .article-save:not([aria-pressed="true"]), .back) {
  color: #8c361b;
}
html[data-theme="light"] .newsletter-library-page .edition-actions .library-call {
  color: #245457;
}
html[data-theme="light"] .newsletter-library-page .edition-actions .library-call:hover {
  color: #193b38;
}

/* Keep the iPad portrait inside its own grid column in both Library views. */
html[data-hlf-library-ipad] .library-nicole-photo { transform: none; }

.volume-name-wide { display:none; }

@media screen and (min-width:601px) {
  html[data-hlf-wide-active="true"] .volume-summary { justify-content:flex-start; position:relative; }
  html[data-hlf-wide-active="true"] .volume-summary::before,
  html[data-hlf-wide-active="true"] .volume-summary > .volume-name { display:none; }
  html[data-hlf-wide-active="true"] .volume-summary > .volume-count {
    position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);
  }
  html[data-hlf-wide-active="true"] .edition { container-type:inline-size; }
  html[data-hlf-wide-active="true"] .volume-summary .volume-name-wide {
    display:block;min-width:0;margin-inline-start:1em;text-align:left;color:var(--teal);
    font-size:clamp(13px,4.8cqi,22px);line-height:1.4;
  }
  html[data-hlf-wide-active="true"] .volume-name-date { display:inline-block;position:relative; }
  html[data-hlf-wide-active="true"] .volume-name-date::before {
    content:"›";position:absolute;right:calc(100% + .35em);top:50%;
    font-size:1.4em;line-height:1;transform:translateY(-50%);transition:transform .15s;
  }
  html[data-hlf-wide-active="true"] .edition[open] .volume-name-date::before { transform:translateY(-50%) rotate(90deg); }
  html[data-hlf-wide-active="true"] .volume-name-brand { display:block;width:fit-content;font-size:calc(1em - 1pt);color:#fff; }
}
@media(prefers-reduced-motion:reduce){.volume-name-date::before{transition:none!important}}

html[data-hlf-library-desktop="true"] .library-head-copy > .intro {
  max-inline-size:var(--library-intro-width,100%);
}
@media screen and (min-width:601px) {
  html[data-theme="light"][data-hlf-wide-active="true"] .volume-name-brand {
    background:#285c59;
    box-shadow:3px 0 #285c59,-3px 0 #285c59;
    border-radius:2px;
  }
}
