/* auriea.org — default skin. Any page may override or escape this entirely. */

:root {
  --bg: #faf8f4;
  --ink: #1c1a17;
  --quiet: #8a8378;
  --link: #7a2f21;
  --missing: #b0483a;
  --hair: #e2dcd2;
  --accent: #2f4a7a;
}
/* the dark palette. It applies two ways: by the system preference (unless a
   light choice was made), and by an explicit dark choice. The two selectors
   must carry the same values — keep them in step. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14120f;
    --ink: #e8e2d6;
    --quiet: #7d766a;
    --link: #d98d6b;
    --missing: #a05c50;
    --hair: #2b2822;
    --accent: #8fa8d8;
  }
}
:root[data-theme="dark"] {
  --bg: #14120f;
  --ink: #e8e2d6;
  --quiet: #7d766a;
  --link: #d98d6b;
  --missing: #a05c50;
  --hair: #2b2822;
  --accent: #8fa8d8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 Georgia, "Times New Roman", serif;
}
main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem 1.2rem 4rem;
  /* a bare URL is one unbreakable word — let it wrap rather than run
     out of the box */
  overflow-wrap: break-word;
}
nav {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  padding: .8rem 1.2rem;
  border-bottom: 1px solid var(--hair);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .82rem;
  letter-spacing: .04em;
}
nav a { color: var(--quiet); text-decoration: none; }
nav a:hover { color: var(--ink); }
nav .site { color: var(--ink); font-weight: 600; letter-spacing: .08em; }
nav form.searchform { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
nav .search-toggle {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  margin: 0;
  padding: .1rem;
  color: var(--quiet);
  cursor: pointer;
}
nav .search-toggle:hover { color: var(--ink); }
nav form.searchform input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  font: inherit;
  width: 0;
  padding: 0;
  opacity: 0;
  transition: width .18s ease, opacity .15s ease;
}
nav form.searchform.open input {
  width: 9rem;
  opacity: 1;
  border-bottom-color: var(--hair);
}
nav form.searchform input:focus { outline: none; border-color: var(--quiet); }

/* a pulldown in the nav bar — a <details> the browser opens/closes on its
   own, styled to sit inline with the plain links around it */
nav details.navdrop { position: relative; }
nav details.navdrop summary {
  cursor: pointer;
  color: var(--quiet);
  list-style: none;
}
nav details.navdrop summary::-webkit-details-marker { display: none; }
nav details.navdrop summary::after { content: " \25be"; font-size: .7em; }
nav details.navdrop summary:hover,
nav details.navdrop[open] summary { color: var(--ink); }
nav details.navdrop .navdrop-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: .6rem;
  display: flex;
  flex-direction: column;
  min-width: 8rem;
  background: var(--bg);
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: .3rem 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  z-index: 20;
}
nav details.navdrop .navdrop-menu a { padding: .3rem .9rem; white-space: nowrap; }
nav details.navdrop .navdrop-menu a:hover { background: var(--hair); color: var(--ink); }

/* the page's category — a lone [[wikilink]] lifted from the top of the
   body to sit as a quiet label just above the title */
p.category {
  margin: 1.4rem 0 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: lowercase;
}
p.category a.wikilink { color: var(--quiet); border-bottom: none; }
p.category a.wikilink:hover { color: var(--link); }
p.category + h1.pagetitle { margin-top: .2rem; }
h1.pagetitle { font-weight: 400; font-size: 1.7rem; margin: 1.4rem 0 .8rem; }
h1, h2, h3, h4 { font-weight: 500; line-height: 1.25; }
a { color: var(--link); }
a.wikilink { text-decoration: none; border-bottom: 1px solid var(--hair); }
a.wikilink:hover { border-color: var(--link); }
a.wikilink.missing { color: var(--missing); border-bottom-style: dashed; }
/* linkeveryword's own doing, not a deliberate [[link]] — a dotted
   underline instead of solid, so it reads as found rather than placed */
a.wikilink.autolink { border-bottom-style: dotted; }
hr { border: none; border-top: 1px solid var(--hair); margin: 2rem 0; }
blockquote { margin: 1rem 0 1rem 1rem; padding-left: 1rem; border-left: 2px solid var(--hair); color: var(--quiet); }
img { max-width: 100%; height: auto; }
/* embedded players stay inside the page — the width yields, and the
   picture keeps the 640x400 shape the embed module gives it */
main iframe { max-width: 100%; }
iframe.video { aspect-ratio: 16 / 10; height: auto; }
audio { max-width: 100%; }
/* tt is the old wiki's spelling of monospace — 24 pages still say it.
   typewritten text reads as a dark gray, not a flat black — softened
   toward --quiet so it sits a shade back from the prose around it */
pre, code, tt {
  font-family: ui-monospace, Menlo, monospace;
  color: color-mix(in srgb, var(--ink) 72%, var(--quiet) 28%);
}
code { font-size: .85em; }
/* tt stands as its own quoted passage, never mid-sentence — a block,
   held in from the margins; a point smaller than the inline code chip */
pre, tt { font-size: .77em; }
/* 50px is the room these want, but a phone doesn't have 50px to spare on
   each side — the padding narrows with the viewport rather than eating
   the whole line down to a few words */
tt { display: block; padding: 0 clamp(1.1rem, 6vw, 50px); }
pre { overflow-x: auto; padding: .8rem clamp(1.1rem, 6vw, 50px); border: 1px solid var(--hair); }

/* footnotes — ((asides)), numbered in reading order and collected below */
sup.footnote-ref { font-size: .72em; line-height: 0; }
sup.footnote-ref a { text-decoration: none; padding: 0 .1em; }
ol.footnotes {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hair);
  font-size: .88em;
  color: var(--quiet);
}
ol.footnotes li { margin: .5rem 0; }
ol.footnotes li:target { color: var(--ink); }
.footnote-back { text-decoration: none; margin-left: .3em; }

.quiet { color: var(--quiet); }
footer {
  max-width: 46rem;
  margin: 0 auto;
  padding: .8rem 1.2rem 2.5rem;
  border-top: 1px solid var(--hair);
  display: flex;
  justify-content: space-between;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .78rem;
}
footer a { color: var(--quiet); margin-left: .8rem; }
.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-left: .8rem;
  color: var(--quiet);
  font: inherit;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }

/* edit form */
.editform textarea {
  width: 100%;
  min-height: 24rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hair);
  padding: .8rem;
  font: 15px/1.5 ui-monospace, Menlo, monospace;
}
.editform input[name=summary] {
  width: 60%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hair);
  color: var(--ink);
  font: inherit;
}
.editform button {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: .35rem 1.2rem;
  font: inherit;
  cursor: pointer;
}
.editform details { margin-top: .6rem; color: var(--quiet); }

/* a destructive action stands apart, quietly — the --missing rust, not
   a loud red banner. Distance (margin-top) matters more than color here. */
.deleteform { margin-top: 2rem; }
.deleteform button.danger {
  background: transparent;
  color: var(--missing);
  border: 1px solid var(--missing);
  padding: .35rem 1.2rem;
  font: inherit;
  cursor: pointer;
}
.deleteform button.danger:hover { background: var(--missing); color: var(--bg); }

/* in-place editor */
img.cm-inline-image {
  max-width: 100%;
  vertical-align: bottom;
  margin: 2px 4px 2px 0;
}

.cm-frontmatter, .cm-frontmatter span {
  font-family: ui-monospace, Menlo, monospace !important;
  font-size: .76rem !important;
  font-weight: normal !important;
  color: var(--quiet) !important;
  line-height: 1.7 !important;
}

h1.pagetitle.editing {
  border-bottom: 1px dashed var(--hair);
  outline: none;
}
h1.pagetitle.editing:focus { border-color: var(--quiet); }
.editor-host { min-height: 40vh; }
.editbar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: .8rem;
  align-items: baseline;
  padding: .7rem 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(4px);
  border-top: 1px solid var(--hair);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .85rem;
}
.editbar input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hair);
  color: var(--ink);
  font: inherit;
}
.editbar input:focus { outline: none; border-color: var(--quiet); }
.editbar button {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: .3rem 1.1rem;
  font: inherit;
  cursor: pointer;
}
.editbar button.ghost { background: transparent; color: var(--quiet); }
#edit-hint { font-size: .75rem; }

/* a past version of a page */
.pastbanner {
  border: 1px solid var(--hair);
  padding: .6rem .9rem;
  margin-bottom: 1.5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .82rem;
  color: var(--quiet);
}
.pastbanner button {
  background: transparent;
  border: 1px solid var(--quiet);
  color: var(--ink);
  padding: .15rem .7rem;
  font: inherit;
  cursor: pointer;
  margin: 0 .5rem;
}

/* listings */
/* table-layout: fixed so a long, unbroken summary (a URL, a run of
   [[notation]]) can never force the whole table wider than its column —
   auto layout will happily blow past 100% and spill out of the page for
   exactly that reason, worse the narrower the page gets */
table.listing { border-collapse: collapse; width: 100%; table-layout: fixed; }
table.listing td { padding: .25rem .6rem .25rem 0; vertical-align: top; overflow-wrap: break-word; }
/* the date column reads like a ledger — never broken across lines */
table.listing td:first-child { white-space: nowrap; width: 6.5em; }
ul.hits { list-style: none; padding: 0; }
ul.hits li { margin: .5rem 0; }
ul.hits .quiet { display: block; font-size: .85em; }
ul.hits li.createhit {
  padding: .5rem .7rem;
  margin: 0 0 1rem;
  border: 1px dashed var(--missing);
  border-radius: 3px;
}
ul.hits li.createhit a::before { content: "+ "; }

/* image wall */
.wall {
  columns: 4 180px;
  column-gap: 6px;
}
.wall a { display: block; margin-bottom: 6px; }
.wall img { width: 100%; display: block; }
/* a model-viewer has no intrinsic size the way an <img> does, so a tile
   needs an explicit height to sit in the masonry columns evenly */
.wall model-viewer { width: 100%; height: 180px; display: block; background: color-mix(in srgb, var(--ink) 4%, var(--bg)); }

/* index — every page on one shelf */
.abc { font-family: ui-sans-serif, system-ui, sans-serif; letter-spacing: .06em; }
.abc a { text-decoration: none; margin-right: .45em; }
.index h2.index-letter { scroll-margin-top: 1rem; }
.index { columns: 3 14rem; column-gap: 2rem; }
.index a { display: block; text-decoration: none; border: none; padding: .08rem 0; overflow-wrap: break-word; }
.index h2.index-letter {
  column-span: none;
  font-size: 1rem;
  color: var(--quiet);
  border-bottom: 1px solid var(--hair);
  margin: 1rem 0 .3rem;
}

/* calendar — a year of months */
.calendar { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.calendar .month { border-collapse: collapse; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .78rem; }
.calendar .month caption { text-align: left; font-family: Georgia, serif; font-size: .95rem; padding-bottom: .3rem; }
.calendar .month th { color: var(--quiet); font-weight: 400; padding: .1rem .35rem; }
.calendar .month td { text-align: center; padding: .1rem .35rem; color: var(--quiet); }
.calendar .month td a { text-decoration: none; font-weight: 700; }
/* unwritten days are doors too — quiet ones */
.calendar .month td.empty a { color: inherit; font-weight: 400; }
.calendar .month td.empty a:hover { color: var(--link); }
.calendar .month td.today { outline: 1px solid var(--accent); }
.calendar .month caption a { color: inherit; text-decoration: none; }

/* tag cloud */
.cloud { line-height: 2.2; }
.cloud .tag { text-decoration: none; margin-right: .7em; white-space: nowrap; }
.cloud sup { color: var(--quiet); font-size: .6em; }

/* thumbs */
.thumb { display: inline-block; }
.thumb img { display: block; }

/* oddmuse long tables (Book pages, About) */
table.user { border-collapse: collapse; margin: 1rem 0; }
table.user td { border: 1px solid var(--hair); padding: .5rem .7rem; vertical-align: top; }

/* below desktop width, an inline-expanding search input would either
   overflow the nav or crowd out the links (this covers phones and the
   full run of iPad sizes, portrait and landscape) — so it drops to its
   own full-width row instead of trying to squeeze in sideways */
@media (max-width: 1100px) {
  nav { flex-wrap: wrap; }
  nav form.searchform.open { flex: 1 1 100%; margin-left: 0; }
  nav form.searchform.open input { flex: 1 1 auto; width: auto; min-width: 0; }
}

@media (max-width: 640px) {
  nav { gap: .6rem; }
}

/* lightbox */
main img { cursor: zoom-in; }
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 1.2rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
}
#lightbox.on { display: flex; }
body.lightboxed { overflow: hidden; }
#lightbox figure {
  margin: 0;
  min-width: 0;
  max-width: min(92vw, 72rem);
  text-align: center;
}
#lightbox figure img {
  max-width: 100%;
  max-height: 84vh;
  width: auto;
  height: auto;
  cursor: auto;
  box-shadow: 0 8px 40px color-mix(in srgb, var(--ink) 25%, transparent);
}
#lightbox figcaption {
  margin-top: .7rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: .82rem;
  color: var(--ink);
}
#lightbox .lb-stem:not(:empty) { display: block; margin-top: .3rem; color: var(--quiet); font-size: .9em; }
#lightbox .lb-stem code { color: inherit; }
#lightbox .lb-tags:not(:empty) { display: block; margin-top: .3rem; }
#lightbox .lb-tags .tag { margin-right: .6em; }
#lightbox .lb-meta { display: block; margin-top: .2rem; color: var(--quiet); }
#lightbox .lb-meta a { color: var(--quiet); }
#lightbox button {
  background: transparent;
  border: none;
  color: var(--quiet);
  font: 2.6rem/1 Georgia, serif;
  cursor: pointer;
  padding: .2rem .6rem;
  user-select: none;
}
#lightbox button:hover { color: var(--ink); }
#lightbox .lb-close { position: absolute; top: .4rem; right: .6rem; }
@media (max-width: 640px) {
  #lightbox { padding: .6rem; gap: 0; }
  #lightbox .lb-prev, #lightbox .lb-next { position: absolute; bottom: .4rem; z-index: 21; }
  #lightbox .lb-prev { left: .6rem; }
  #lightbox .lb-next { right: .6rem; }
}

/* login + upload */
.loginform input[type=password] {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hair);
  color: var(--ink);
  font: inherit;
  width: 14rem;
}
.loginform button, .uploadform button {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: .35rem 1.2rem;
  font: inherit;
  cursor: pointer;
  margin-left: .6rem;
}
.uploadform input[type=file] { font: inherit; color: var(--quiet); }
.uploadform textarea[name=alt] {
  display: block;
  width: min(34rem, 100%);
  margin: .8rem 0;
  background: transparent;
  border: 1px solid var(--hair);
  padding: .6rem;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.uploadform textarea[name=alt]:focus { outline: none; border-color: var(--quiet); }
