/*
Theme Name: N. T. Whords
Description: A quiet classic theme for reading short stories. Literata and Instrument Serif, four reading colours, adjustable text size, drop caps and ornamental section breaks.
Version: 1.1.1
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nt-whords
*/

:root, html[data-theme="light"] { --ntw-bg:#f6f6f1; --ntw-ink:#20231f; --ntw-muted:#737a70; --ntw-rule:#e0e3da; --ntw-accent:oklch(0.48 0.07 150); }
html[data-theme="sepia"] { --ntw-bg:#ece4cf; --ntw-ink:#302d22; --ntw-muted:#6f6a55; --ntw-rule:#d8cfb4; --ntw-accent:oklch(0.45 0.07 140); }
html[data-theme="dark"]  { --ntw-bg:#171a18; --ntw-ink:#d6dbd5; --ntw-muted:#8b938b; --ntw-rule:#2c312d; --ntw-accent:oklch(0.72 0.07 150); }
html[data-theme="dusk"]  { --ntw-bg:#24241b; --ntw-ink:#e0dac4; --ntw-muted:#9c9679; --ntw-rule:#3b3a2d; --ntw-accent:oklch(0.73 0.07 135); }

html { --ntw-fs:19px; }
html[data-size="0"] { --ntw-fs:17px; }
html[data-size="2"] { --ntw-fs:21px; }
html[data-size="3"] { --ntw-fs:23px; }

body { margin:0; background:var(--ntw-bg); color:var(--ntw-ink); font-family:Literata, Georgia, serif; font-size:var(--ntw-fs); line-height:1.6; font-optical-sizing:auto; -webkit-font-smoothing:antialiased; transition:background-color .3s, color .3s; }
a { color:inherit; text-decoration:none; }
a:hover { text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:.18em; }
:focus-visible { outline:2px solid var(--ntw-accent); outline-offset:3px; }
::selection { background:var(--ntw-accent); color:var(--ntw-bg); }

/* Header */
.ntw-header { display:flex; justify-content:space-between; align-items:center; gap:24px; padding:28px 48px; }
.ntw-site-name { margin:0; font-size:17px; font-weight:400; letter-spacing:.2em; text-transform:uppercase; color:var(--ntw-muted); }
.home .ntw-site-name, .blog .ntw-site-name { visibility:hidden; }
.ntw-controls { display:flex; align-items:center; gap:24px; color:var(--ntw-muted); }
.ntw-size { display:flex; align-items:baseline; gap:10px; }
.home .ntw-size, .blog .ntw-size { display:none; }
.ntw-size button { background:none; border:0; padding:4px; color:inherit; font:inherit; font-size:15px; line-height:1; cursor:pointer; }
.ntw-size .ntw-size-up { font-size:22px; }
.ntw-colours { width:28px; height:28px; margin:4px; border-radius:50%; overflow:hidden; display:grid; grid-template-columns:1fr 1fr; box-shadow:0 0 0 1px var(--ntw-muted); }
.ntw-colours button { border:0; padding:0; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.ntw-colours button::after { content:""; width:5px; height:5px; border-radius:50%; }
.ntw-colours button[aria-checked="true"]::after { background:currentColor; }
[data-theme-set="light"] { background:#f6f6f1; color:#20231f; }
[data-theme-set="sepia"] { background:#ece4cf; color:#302d22; }
[data-theme-set="dark"]  { background:#171a18; color:#d6dbd5; }
[data-theme-set="dusk"]  { background:#24241b; color:#e0dac4; }

/* Shared */
.ntw-kicker { margin:0; font-size:15px; letter-spacing:.28em; text-transform:uppercase; color:var(--ntw-muted); }
.ntw-ornament, .ntw-text hr, .ntw-text .wp-block-separator { display:block; border:0 !important; height:auto !important; width:6em !important; max-width:none; aspect-ratio:1280 / 447; margin:1.4em auto !important; background:var(--ntw-accent) !important; opacity:1; -webkit-mask:url(assets/ornament.svg) center / contain no-repeat; mask:url(assets/ornament.svg) center / contain no-repeat; }
.ntw-link { margin:3em 0 0; text-align:center; font-size:18px; font-style:italic; color:var(--ntw-muted); }

/* Contents */
.ntw-home { max-width:640px; margin:0 auto; padding:64px 24px 120px; display:flex; flex-direction:column; align-items:center; }
.ntw-home-title { margin:12px 0 0; font-family:'Instrument Serif', Georgia, serif; font-size:72px; font-weight:400; line-height:1; text-align:center; }
.ntw-home .ntw-ornament { width:120px !important; margin:36px 0 56px !important; }
.ntw-contents-query { width:100%; margin-top:20px; }
.ntw-contents { list-style:none; margin:0; padding:0; }
.ntw-contents > li { position:relative; display:grid; grid-template-columns:48px minmax(0,1fr) auto; column-gap:12px; row-gap:4px; align-items:baseline; margin:0; padding:18px 0; border-bottom:1px solid var(--ntw-rule); }
.ntw-entry-num { font-size:17px; color:var(--ntw-accent); }
.ntw-entry-title { margin:0; font-family:'Instrument Serif', Georgia, serif; font-size:32px; font-weight:400; line-height:1.1; }
.ntw-entry-title a::after { content:""; position:absolute; inset:0; }
.ntw-entry-year { font-size:17px; font-style:italic; color:var(--ntw-muted); }
.ntw-entry-line { grid-column:2 / 4; margin:0; font-size:18px; font-style:italic; line-height:1.45; color:var(--ntw-muted); text-wrap:pretty; }
.ntw-home-empty { margin:0; font-style:italic; color:var(--ntw-muted); }
.ntw-pagination { margin-top:32px; display:flex; justify-content:space-between; gap:24px; width:100%; font-style:italic; color:var(--ntw-muted); }
.ntw-home .ntw-link { margin-top:64px; font-size:16px; }

/* Story and page */
.ntw-story { max-width:34em; margin:0 auto; padding:72px 24px 140px; }
.ntw-story-head { text-align:center; margin-bottom:3.2em; }
.ntw-meta-number { font-size:15px; letter-spacing:.28em; text-transform:uppercase; color:var(--ntw-accent); }
.ntw-story-title { margin:.3em 0; font-family:'Instrument Serif', Georgia, serif; font-size:80px; font-weight:400; line-height:1; text-wrap:balance; }
.ntw-meta-line { font-size:20px; font-style:italic; color:var(--ntw-muted); text-wrap:pretty; }
.ntw-meta-meta { margin-top:1.2em; font-size:15px; letter-spacing:.2em; text-transform:uppercase; color:var(--ntw-muted); }
.ntw-page .ntw-story-head { margin-bottom:2.4em; }
.ntw-page .ntw-ornament { margin:.4em auto 0 !important; }

body .ntw-text p, body .ntw-text div, body .ntw-text figure { margin-block:0; }
body .ntw-text p { text-align:justify; hyphens:auto; text-wrap:pretty; text-indent:1.5em; }
body .ntw-text p.ntw-first, body .ntw-text p.ntw-noindent { text-indent:0; }
.ntw-story:not(.ntw-page) .ntw-text p.ntw-first::first-letter { float:left; font-family:'Instrument Serif', Georgia, serif; font-size:5.35em; line-height:.8; margin:.089em .1em 0 0; color:var(--ntw-accent); }
.ntw-story:not(.ntw-page) .ntw-text p.ntw-first::first-line { font-variant:small-caps; letter-spacing:.04em; }
/* Two-column poems (leaf poems): leaf on the left, combined poem on the right */
body .ntw-text table { width:min(100vw - 48px, 56em); margin:0 0 0 50%; transform:translateX(-50%); border-collapse:collapse; table-layout:fixed; border:0; }
body .ntw-text td { width:auto; vertical-align:top; padding:0; border:0; text-align:left; hyphens:manual; line-height:1.55; }
body .ntw-text td:first-child { width:50%; padding-right:2em; font-style:italic; text-align:right; }
body .ntw-text td:first-child .ntw-line { padding-left:2em; padding-right:0; text-indent:0; }
body .ntw-text td + td { padding-left:2em; border-left:1px solid var(--ntw-rule); }
.ntw-line { display:block; padding-left:1.2em; text-indent:-1.2em; text-wrap:pretty; }
.ntw-line + .ntw-line { margin-top:.15em; }
.ntw-genre { margin:0 0 2em; text-align:center; font-style:italic; color:var(--ntw-muted); }
.ntw-genre a { color:var(--ntw-accent); }
.ntw-text blockquote { margin:1.2em 1.5em; font-style:italic; }
.ntw-text img { max-width:100%; height:auto; }
.screen-reader-text { position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.ntw-next { margin-top:4em; padding-top:2.4em; border-top:1px solid var(--ntw-rule); display:flex; flex-direction:column; align-items:center; gap:.4em; text-align:center; }
.ntw-next-title { font-family:'Instrument Serif', Georgia, serif; font-size:48px; line-height:1.1; }
.ntw-next-line { font-size:18px; font-style:italic; color:var(--ntw-muted); text-wrap:pretty; }

/* Mobile */
@media (max-width:600px) {
  html { --ntw-fs:17px; }
  html[data-size="0"] { --ntw-fs:16px; }
  html[data-size="2"] { --ntw-fs:18px; }
  html[data-size="3"] { --ntw-fs:20px; }
  .ntw-header { padding:8px 8px 0 20px; gap:8px; }
  .ntw-site-name { font-size:13px; }
  .ntw-controls { gap:0; }
  .ntw-size { gap:0; }
  .ntw-size button { width:44px; height:44px; padding:0; }
  .ntw-colours { width:40px; height:40px; margin:2px 6px; }
  .ntw-colours button::after { width:6px; height:6px; }
  .ntw-kicker { font-size:13px; }
  .ntw-link { font-size:16px; }
  .ntw-link a { display:inline-block; padding:12px 8px; }
  .ntw-home { padding:28px 24px 72px; }
  .ntw-home-title { font-size:52px; margin-top:8px; }
  .ntw-home .ntw-ornament { width:100px !important; margin:28px 0 36px !important; }
  .ntw-contents > li { grid-template-columns:36px minmax(0,1fr); column-gap:8px; row-gap:2px; padding:16px 0; }
  .ntw-entry-num { font-size:15px; }
  .ntw-entry-title { font-size:28px; }
  .ntw-entry-line { grid-column:2; font-size:16px; }
  .ntw-entry-year { grid-column:2; grid-row:3; font-size:15px; }
  .ntw-home .ntw-link { margin-top:40px; }
  .ntw-story { padding:40px 26px 80px; }
  .ntw-story-head { margin-bottom:2.4em; }
  .ntw-meta-number { font-size:13px; }
  .ntw-story-title { font-size:54px; }
  .ntw-meta-line { font-size:17px; }
  .ntw-meta-meta { font-size:13px; }
  body .ntw-text p { text-align:left; hyphens:manual; text-indent:1.4em; }
  body .ntw-text table { width:100%; margin:0; transform:none; }
  body .ntw-text table, body .ntw-text tbody, body .ntw-text tr, body .ntw-text td { display:block; }
  body .ntw-text td:first-child { width:auto; padding:0; }
  body .ntw-text td + td { padding:0; border-left:0; }
  body .ntw-text td + td::before { content:"·\00a0·\00a0·"; display:block; margin:.8em 0; text-align:center; font-family:'Instrument Serif', Georgia, serif; font-size:1.6em; line-height:1; letter-spacing:.15em; color:var(--ntw-accent); }
  .ntw-next { margin-top:3em; padding-top:2em; }
  .ntw-next-title { font-size:36px; }
  .ntw-next-line { font-size:16px; }
}

@media print {
  @page { margin:22mm 20mm; }
  html, html[data-theme] { --ntw-bg:#fff; --ntw-ink:#000; --ntw-muted:#555; --ntw-rule:#bbb; --ntw-accent:#2f5a3e; --ntw-fs:11.5pt; }
  body { background:#fff; color:#000; font-size:11.5pt; line-height:1.5; transition:none; }
  .ntw-header, .ntw-next, .ntw-link, .ntw-pagination { display:none !important; }
  .ntw-story, .ntw-home { max-width:none; padding:0; margin:0; }
  .ntw-story-head { margin-bottom:2.4em; break-after:avoid; }
  .ntw-story-title { font-size:36pt; }
  .ntw-meta-number, .ntw-meta-meta { font-size:9pt; }
  .ntw-meta-line { font-size:12pt; }
  body .ntw-text p { orphans:3; widows:3; }
  .ntw-ornament, .ntw-text hr, .ntw-text .wp-block-separator { -webkit-print-color-adjust:exact; print-color-adjust:exact; break-after:avoid; }
  .ntw-story:not(.ntw-page) .ntw-text p.ntw-first::first-letter { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .ntw-home-title { font-size:40pt; }
  .ntw-entry-title { font-size:18pt; }
  .ntw-entry-line, .ntw-entry-year { font-size:10pt; }
  .ntw-contents > li { break-inside:avoid; }
  body .ntw-text table { width:100%; margin:0; transform:none; break-inside:avoid; }
  a { text-decoration:none; }
}

@media (prefers-reduced-motion:reduce) { body { transition:none; } }
