/*
 * Cryptofloricon. Modelled on the 2015 site's stylesheet
 * (/Cryptofloricon Dev/css/main.css): brown ink (#581a0e) on paper, a
 * script title face, a Caslon body face, ornamental corners round the main
 * panel, small-caps "• Decode •" links, and a 600px column on wide screens.
 *
 * The script face (Andrade Script Pro) is not served: the build places each
 * script heading as drawings of its words (see build.js, src/headings/).
 *
 * Double-brace asset names are filled in by build.js with the artwork's path: the real
 * file once it is in src/assets/, a labelled placeholder until then.
 */

:root {
  --ink: #581a0e;
  --ink-dark: #1e140f;
  --ink-soft: rgba(88, 26, 14, 0.55);
  --paper: #f1e6cc;
  /* The ornaments' ink: the stroke colour of the corner filigree (assets/borders/*.svg). */
  --ornament: #461408;
  /* The corners' line weight on screen: 1.5 units drawn at 75/340 of size on
     phones and 150/340 on wider screens. The dividers are drawn to match. */
  --ornament-stroke: 0.33px;
  /* Only for the text logotype, shown if the logo image is missing. */
  --title-font: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --body-font: "Libre Caslon Text", "Big Caslon", "Adobe Caslon Pro", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background-color: #f1e6cc; }

body {
  margin: 0;
  padding: 10px 0 20px;
  color: var(--ink);
  font: 16px/1.65 var(--body-font);
  background-color: var(--paper);
  /* Placeholder paper (soft mottling) under the real texture once it is in. */
  background-image:
    url("paper.png"),
    radial-gradient(ellipse at 20% 10%, rgba(255, 250, 235, 0.7), transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(200, 170, 120, 0.25), transparent 55%);
  background-repeat: repeat, no-repeat, no-repeat;
  min-height: 100vh;
}

a { color: var(--ink); }
a:hover, a:focus-visible { color: var(--ink-dark); }
:focus-visible { outline: 2px dotted var(--ink); outline-offset: 2px; }

img { vertical-align: middle; max-width: 100%; }

.wrapper {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 12px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ---------- masthead: logo, tabs ---------- */

.masthead { text-align: center; }

.logo { display: inline-block; text-decoration: none; }
.logo img { width: 80%; min-width: 260px; }
.logotype {
  display: inline-block;
  font: 3.4em/1.1 var(--title-font);
  padding: 0.1em 0.2em 0;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 2.2em;
  margin: 0.4em auto 0.2em;
  font-size: 1.3em;
  font-variant: small-caps;
}
.tabs a { text-decoration: none; }
.tabs a:hover { text-decoration: underline; }
.tabs.bottom { margin-top: 1em; }

/* ---------- the main panel with its ornamental corners ---------- */

.border {
  display: block;
  margin: 10px auto 0;
  padding: 56px 18px 56px;
  text-align: center;
  background:
    url("borders/tl.svg") left top / 75px 100px no-repeat,
    url("borders/tr.svg") right top / 75px 100px no-repeat,
    url("borders/bl.svg") left bottom / 75px 100px no-repeat,
    url("borders/br.svg") right bottom / 75px 100px no-repeat;
}

.title {
  /* Andrade's swash capitals and descenders need room between lines (Ed, 2026-11-23). */
  font: 2em/1.95 var(--body-font);
  /* The words are drawings (see .drawn below); the spaces between them are
     the body face's, narrowed to Andrade's own (0.23em; Libre Caslon's is 0.272em). */
  word-spacing: -0.042em;
  margin: 0 auto;
  padding: 12px 0;
  font-weight: normal;
}
/*
 * A drawn word: an SVG of its outlines, 1em tall from Andrade's ascender to
 * its descender (the baseline 0.605em down), as wide as the word's advance.
 * The margins make each line 1.95em with the baseline where the font put it
 * (half the leading, 0.475em, above the ascender), whatever face the spaces
 * are in. Swashes reach outside the box and are let show.
 */
.drawn svg {
  height: 1em;
  margin: 0.475em 0;
  vertical-align: top;
  overflow: visible;
  fill: currentColor;
}
/* Three lines, as on the 2015 site: the phrase, "– to –" on its own line, the phrase. */
.title .line, .title .joiner { display: block; }
/* The webfont had no italic, so browsers slanted "– to –" by 14° (a quarter shear) about its baseline. */
.title .joiner svg { transform: skewX(-14.04deg); transform-origin: 0 0.605em; }
.title .line { text-wrap: balance; }
/* One size throughout (Ed, 27b): the long phrase wraps, balanced, as
   "Encrypt and Decrypt / Floral Bouquets" where it does not fit. */

h2 { font-variant: small-caps; font-weight: normal; font-size: 1.25em; margin: 1.4em 0 0.3em; }
h2 a { text-decoration: none; }

.divider { margin: 14px auto; }
.divider svg, .divider img { display: block; margin: 0 auto; height: auto; overflow: visible; }
/* The divider is inlined by build.js; its lines take the corners' ink and weight. */
.divider path {
  stroke: var(--ornament);
  stroke-width: var(--ornament-stroke);
  vector-effect: non-scaling-stroke;
}
/* A stand-in divider (an <img>) blends into the paper. */
.divider img { mix-blend-mode: multiply; }
.divider-large svg, .divider-large img { width: 70%; max-width: 360px; }
.divider-small svg, .divider-small img { width: 40%; max-width: 200px; }

.intro { margin: 0 auto 1em; max-width: 30em; }

.calls { font-size: 1.2em; font-variant: small-caps; margin: 1.2em 0 0.4em; }
.call { text-decoration: none; white-space: nowrap; }
/* "– or –" sits on its own line between the two calls, as on the 2015 site. */
.calls .joiner { display: block; }
.call:hover { text-decoration: underline; }
.joiner { font-style: italic; font-variant: normal; font-size: 0.85em; }

.buttons { margin: 1em 0; font-size: 1.2em; font-variant: small-caps; }
.buttons a { text-decoration: none; }
.link-button {
  font: inherit;
  font-variant: small-caps;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 4px 10px;
  cursor: pointer;
}
.link-button:hover { color: var(--ink-dark); text-decoration: underline; }

.hint { font-style: italic; margin: 0 0 0.6em; }

/* ---------- bouquets: the stems side by side ---------- */

.bouquet {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  min-height: 1px;
}
.bouquet .stem { height: 60px; width: auto; }
.bouquet-large .stem { height: 100px; }
.bouquet-small .stem { height: 36px; }
.bouquet-small { min-width: 48px; }

.flower-words { margin: 4px 0 0; font-variant: small-caps; color: var(--ink-soft); }

/* ---------- message pages ---------- */

.entry { margin: 0 auto; }
.passage { text-align: left; }
.passage p { margin: 0 0 1em; }
.xref { text-decoration: underline; }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 0;
  list-style: none;
  margin: 0.5em 0;
  padding: 0;
  font-variant: small-caps;
}
.tag-list li + li::before { content: "\00a0\2022\00a0"; }
.tag-list a { text-decoration: none; }
.tag-list a:hover { text-decoration: underline; }
.tag-list .current { text-decoration: underline; }

.shared-note { font-style: italic; }

/* ---------- decode ---------- */

.flower-picker {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  user-select: none;
  -webkit-user-select: none;
}
.flower-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 1 60px;
  min-width: 0;
  padding: 6px 1px 2px;
  font: inherit;
  font-size: 0.72em;
  letter-spacing: -0.01em;
  font-variant: small-caps;
  color: var(--ink);
  background: rgba(255, 252, 240, 0.35);
  border: 1px dotted var(--ink-soft);
  border-radius: 4px;
  cursor: pointer;
  touch-action: manipulation;
}
.flower-btn img { height: 83px; width: auto; }
.flower-btn:active { transform: translateY(1px); }
.flower-btn:focus:not(:focus-visible) { outline: none; }
.flower-btn.chosen { border-style: solid; background: rgba(255, 252, 240, 0.7); }
.flower-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-variant: normal;
  font-weight: bold;
}

.bouquet-build { min-height: 112px; margin-top: 14px; display: flex; justify-content: center; align-items: flex-end; }
.stem-button { background: none; border: 0; padding: 0; cursor: pointer; }
.stem-button:hover img { opacity: 0.6; }
.stem-count { min-height: 1.6em; margin: 0; font-variant: small-caps; color: var(--ink-soft); }
.decode-result .title { padding: 0; }

/* ---------- send a message (encode) ---------- */

.search input {
  display: block;
  width: 260px;
  max-width: 100%;
  height: 70px;
  margin: 0 auto;
  padding: 0 18px;
  font: 1.3em var(--body-font);
  text-align: center;
  color: var(--ink);
  border: 0;
  background:
    url("brackets/left.png") left center / 12px 70px no-repeat,
    url("brackets/right.png") right center / 12px 70px no-repeat;
  -webkit-appearance: none;
  appearance: none;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search input::placeholder { color: var(--ink-soft); }
.search input:focus { outline: none; background-color: rgba(255, 252, 240, 0.45); }

.results, .entry-list { list-style: none; margin: 0.6em 0; padding: 0; text-align: left; }
.entry-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0 10px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--ink-soft);
}
.entry-row a { display: flex; align-items: flex-end; gap: 10px; text-decoration: none; }
.entry-row a:hover .row-title { text-decoration: underline; }
/* Browse, the tag pages and Send a Message's results: title left, bouquet right, one row; the title wraps on a phone. */
.entry-list .entry-row a { flex: 1 1 auto; min-width: 0; align-items: center; justify-content: space-between; }
.entry-list .row-title { min-width: 0; overflow-wrap: anywhere; }
.entry-list .bouquet-small { flex: 0 0 auto; justify-content: flex-end; }
.no-results { font-style: italic; text-align: center; border: 0; }

/* ---------- story ---------- */

.prose { text-align: left; }
.prose p { margin: 0 0 1em; }
/* The story's drop cap is drawn (build.js); the letter stays in the text, unseen. */
.dropcap { float: left; font-size: 3.2em; line-height: 1; padding: 0.12em 0.08em 0 0; }
/* The webfont's float was 0.8em tall (its line-height), so the text wraps after two lines. */
.dropcap svg { display: block; height: 1em; margin-bottom: -0.2em; overflow: visible; fill: currentColor; }
.dropcap-letter { font-size: 0; }
/* The author's initials close the introduction, as in the 2013 print master. */
.prose .signature { text-align: right; font-style: italic; margin-top: 0.5em; }

/* ---------- footer ---------- */

.site-footer { text-align: center; font-size: 0.85em; margin-top: 1.4em; }
.footer-links { font-variant: small-caps; font-size: 1.1em; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.credits { margin: 0.6em 0; line-height: 1.6; }

/* ---------- the narrowest phones (320-379px) ---------- */

@media (max-width: 379px) {
  .border { padding-left: 10px; padding-right: 10px; }
  /* Andrade's swash capitals and descenders reach well outside the letters' box. */
  .title { font-size: 1.8em; padding-left: 20px; padding-right: 20px; }
  .flower-btn { font-size: 0.6em; letter-spacing: -0.02em; }
  .flower-btn img { height: 72px; }
}

/* ---------- wider screens ---------- */

@media (min-width: 480px) {
  :root { --ornament-stroke: 0.66px; }
  body { padding-top: 40px; }
  .logo img { width: 90%; min-width: 400px; }
  .logotype { font-size: 4.6em; }
  .border {
    padding: 60px 40px 60px;
    background-size: 150px 200px, 150px 200px, 150px 200px, 150px 200px;
  }
  .flower-btn { flex-basis: 76px; font-size: 0.8em; }
  .flower-btn img { height: 100px; }
  .bouquet-build { min-height: 130px; }
}

@media print {
  body { background: none; }
  .tabs, .site-footer .footer-links { display: none; }
}
