/* ============================================================
   datadeer.pl — Quiet Authority, typeset
   ============================================================ */

:root {
  /* Palette — warm paper, oxblood ink */
  --paper:      #F4EFE6;
  --paper-deep: #ECE6D9;
  --ink:        #1A1814;
  --rule:       #C8BFAE;
  --accent:     #5C2920;
  --whisper:    #8A8273;

  /* Type families */
  --display: "Fraunces", "Source Serif 4", Georgia, serif;
  --body:    "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:    "DM Mono", "SF Mono", "Cascadia Mono", ui-monospace, monospace;

  /* Rhythm */
  --baseline:   1.7;
  --measure:    38rem;   /* reading column */
  --gutter:     2rem;
  --margin-col: 11rem;   /* marginalia column on wide screens */
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; padding: 0; }

/* ----- Foundation ----- */
html {
  font-size: 18px;
  background: var(--paper);
  color: var(--ink);
  font-feature-settings: "kern", "liga", "onum";
}

body {
  font-family: var(--body);
  font-size: 1rem;
  line-height: var(--baseline);
  text-rendering: optimizeLegibility;
  font-variation-settings: "opsz" 14;
  padding: 3rem 1.5rem 4rem;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-thickness 120ms ease;
}
a:hover, a:focus-visible {
  text-decoration-thickness: 2px;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip link */
.skiplink {
  position: absolute;
  left: -9999px;
}
.skiplink:focus {
  left: 1rem;
  top: 1rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  z-index: 100;
}

/* ----- Masthead ----- */
.masthead {
  max-width: var(--measure);
  margin: 0 auto 4rem;
  padding-top: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.name {
  font-family: var(--display);
  font-weight: 400;
  font-style: normal;
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.018em;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

.subhead {
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--whisper);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ----- Language switcher ----- */
.langs {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--whisper);
}
.langs a,
.langs .current {
  display: inline-block;
  padding: 0.15rem 0.1rem;
  margin-inline: 0.05rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.langs a {
  color: var(--whisper);
}
.langs a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.langs .current {
  color: var(--accent);
  border-bottom-color: var(--accent);
  cursor: default;
}
.langs .sep {
  color: var(--rule);
  margin-inline: 0.35rem;
  user-select: none;
}

/* ----- Sections ----- */
main {
  max-width: var(--measure);
  margin: 0 auto;
}

.prose {
  position: relative;
  margin-block: 3.5rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.num {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  font-size: 1.75rem;
  font-variation-settings: "opsz" 60;
  line-height: 1;
}

.section-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 60;
  line-height: 1.1;
}

.prose p {
  font-size: 1.0625rem;
  line-height: var(--baseline);
  margin-block: 1.25rem;
  font-variation-settings: "opsz" 16;
  hyphens: auto;
  -webkit-hyphens: auto;
  hanging-punctuation: first;
}

/* Interest pull-quote line */
.interests {
  font-style: italic;
  color: var(--whisper);
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  margin-top: 2rem !important;
}

/* ----- Marginalia ----- */
.margin {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.65;
  color: var(--whisper);
  margin-block: 1.5rem;
  padding-inline-start: 1rem;
  border-inline-start: 1px solid var(--rule);
}
.margin p { margin: 0; font-size: inherit; }
.margin a {
  color: var(--whisper);
  text-decoration-color: var(--rule);
}
.margin a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ----- Project entries ----- */
.entry {
  position: relative;
  margin-block: 2.5rem;
}

.entry-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.25rem;
  font-variation-settings: "opsz" 36;
  line-height: 1.25;
}
.entry-title a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
.entry-title a:hover {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.entry-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--whisper);
  letter-spacing: 0.04em;
  margin-top: 0.35rem !important;
  margin-bottom: 0.85rem !important;
}

.entry > p {
  margin-block: 0.85rem;
}

/* ----- Ornament ----- */
.ornament {
  display: block;
  width: 4rem;
  height: 1rem;
  margin: 3.25rem auto;
  color: var(--rule);
}

/* ----- Notes placeholder ----- */
.placeholder {
  font-style: italic;
  color: var(--whisper);
}

/* ----- Links section ----- */
.links {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.55rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}
.links li {
  display: contents;
}
.links .key {
  color: var(--whisper);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  align-self: baseline;
  padding-top: 0.2rem;
}
.links a {
  color: var(--ink);
  text-decoration-color: var(--rule);
  word-break: break-word;
}
.links a:hover {
  text-decoration-color: var(--accent);
  color: var(--accent);
}

/* ----- Colophon footer ----- */
.colophon {
  max-width: var(--measure);
  margin: 5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--whisper);
  text-align: center;
  letter-spacing: 0.06em;
}
.colophon .rule {
  display: inline-block;
  margin: 0 0.5rem;
  color: var(--rule);
}

/* ----- Note list (index → /notes/...) ----- */
.note-list { display: block; margin-top: 0.25rem; }
.note-list li {
  padding-block: 1rem;
  border-bottom: 1px solid var(--rule);
}
.note-list li:last-child { border-bottom: none; }
.note-list a {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 0.25rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
}
.note-list a:hover .note-title { color: var(--accent); }
.note-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--whisper);
  letter-spacing: 0.06em;
  padding-top: 0.45rem;
}
.note-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.25;
  font-variation-settings: "opsz" 36;
}
.note-deck {
  grid-column: 2;
  font-style: italic;
  color: var(--whisper);
  font-size: 0.95rem;
  line-height: 1.55;
}
.note-lang {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--whisper);
  border: 1px solid var(--rule);
  padding: 0.05em 0.4em;
  margin-left: 0.5em;
  vertical-align: 0.18em;
  text-transform: uppercase;
}

/* ----- Post layout (single essay page) ----- */
.back {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 auto 3rem;
  max-width: var(--measure);
}
.back a {
  color: var(--whisper);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.1rem;
}
.back a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.post { margin-block: 3rem; }
.post-head { margin-bottom: 3rem; }
.post-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--whisper);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.75rem !important;
}
.post-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  margin-bottom: 1.25rem !important;
}
.post-deck {
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink);
  font-variation-settings: "opsz" 24;
  border-left: 2px solid var(--accent);
  padding: 0.1rem 0 0.1rem 1rem;
  margin: 0 !important;
}
.post p {
  font-size: 1.0625rem;
  line-height: var(--baseline);
  margin-block: 1.25rem;
}
.post p em { color: var(--ink); }
.post .lede::first-letter {
  font-family: var(--display);
  font-weight: 400;
  font-size: 3.6em;
  line-height: 0.9;
  float: left;
  margin: 0.05em 0.12em -0.05em 0;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.post hr.scene {
  border: none;
  text-align: center;
  margin-block: 2.5rem;
  color: var(--rule);
}
.post hr.scene::before {
  content: "* * *";
  letter-spacing: 0.5em;
  color: var(--rule);
  font-family: var(--display);
}

/* ============================================================
   Wide screen (>= 1100px)
   Marginalia floats right of the reading column,
   Roman numerals float left into the margin.
   ============================================================ */

@media (min-width: 1100px) {
  body {
    padding: 4rem 0 5rem;
  }
  .masthead, main, .colophon {
    max-width: var(--measure);
    margin-inline: auto;
  }

  .num {
    position: absolute;
    left: 0;
    transform: translateX(calc(-100% - 1.5rem));
    top: 0.1rem;
    font-size: 2rem;
  }
  .section-head { gap: 0; }

  .prose .margin,
  .entry .margin {
    position: absolute;
    right: 0;
    transform: translateX(calc(100% + var(--gutter)));
    top: 2.5rem;
    width: var(--margin-col);
    margin: 0;
    padding: 0.5rem 0 0 0;
    border-inline-start: none;
    border-top: 1px solid var(--rule);
  }
  .entry .margin { top: 0.5rem; }
}

/* ============================================================
   Motion (only when the user is OK with it)
   ============================================================ */

@media (prefers-reduced-motion: no-preference) {
  .masthead,
  .prose,
  .ornament,
  .colophon {
    animation: rise 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .masthead                          { animation-delay: 0.00s; }
  main > .prose:nth-of-type(1)       { animation-delay: 0.08s; }
  main > .ornament:nth-of-type(1)    { animation-delay: 0.14s; }
  main > .prose:nth-of-type(2)       { animation-delay: 0.18s; }
  main > .ornament:nth-of-type(2)    { animation-delay: 0.24s; }
  main > .prose:nth-of-type(3)       { animation-delay: 0.28s; }
  main > .ornament:nth-of-type(3)    { animation-delay: 0.34s; }
  main > .prose:nth-of-type(4)       { animation-delay: 0.38s; }
  main > .ornament:nth-of-type(4)    { animation-delay: 0.44s; }
  main > .prose:nth-of-type(5)       { animation-delay: 0.48s; }
  main > .ornament:nth-of-type(5)    { animation-delay: 0.54s; }
  main > .prose:nth-of-type(6)       { animation-delay: 0.58s; }
  .colophon                          { animation-delay: 0.66s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Print — make it actually print well
   ============================================================ */

@media print {
  html { font-size: 11pt; }
  body { padding: 0; background: white; color: black; }
  a { color: black; text-decoration: none; }
  .ornament, .skiplink, .langs { display: none; }
  .margin {
    border: none;
    padding-left: 0;
    color: #555;
  }
  @page { margin: 2cm; }
}
