/* ============================================================
   haileyefadler.com — stylesheet
   ------------------------------------------------------------
   CONTENTS
     01. Colour + variables
     02. Reset + page background (the night canopy)
     03. The torn sheet
     04. Paper texture + age
     05. Masthead (entry mark, name, flourish, role)
     06. Bio prose (drop cap, book indents)
     07. Ledger headings
     08. Records (date, entry body, excerpt, award)
     09. LINE STYLES — straight vs. wavy  ← toggle here
     10. Margin note
     11. Closing (contact, sign-off, mark, colophon)
     12. Section divider
     13. Focus states
     14. Small screens
   ============================================================ */


/* ============================================================
   01. COLOUR + VARIABLES
   ============================================================ */

:root {
  --paper: #f0e9d8;          /* the sheet */
  --ink: #2b3440;            /* body text — iron gall blue-black */
  --ink-faded: #5c6672;      /* secondary text, rules */
  --ink-annotation: #6b7a8c; /* handwriting, dates, colophon */
  --ink-blue: #3f5f80;       /* the spiral mark */
  --accent-wax: #a84a35;     /* the one warm accent — awards, hover — Old 8a5a44 */
  --rule: rgba(92, 102, 114, 0.28); /* straight-line colour */
}


/* ============================================================
   02. RESET + PAGE BACKGROUND
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background-color: #12181f;
  background-image:
    linear-gradient(rgba(24, 32, 42, 0.45), rgba(18, 24, 33, 0.6)),
    url(assets/night-canopy.jpg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  font-family: 'EB Garamond', Georgia, serif;
  color: var(--ink);
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 3.5rem) 1rem clamp(2rem, 6vw, 5rem);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}


/* ============================================================
   03. THE TORN SHEET
   The .page wrapper carries the shadow so it follows the torn
   silhouette. The .sheet is ONE element masked at top and
   bottom — no joins, so no seams are possible.
   ============================================================ */

.page {
  position: relative;
  width: min(46rem, 100%);
  filter:
    drop-shadow(0 2px 2px rgba(16, 21, 28, 0.4))
    drop-shadow(0 14px 30px rgba(16, 21, 28, 0.45));
  opacity: 0;
  transform: translateY(10px);
  animation: settle 900ms ease-out 120ms forwards;
}

@keyframes settle { to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .page { animation: none; opacity: 1; transform: none; }
}

.sheet {
  --tear: clamp(2.5rem, 5vw, 4rem);  /* depth of the torn edges */
  position: relative;
  background: var(--paper);
  padding:
    calc(var(--tear) + clamp(0.75rem, 2vw, 1.5rem))
    clamp(1.5rem, 7vw, 5rem)
    calc(var(--tear) + clamp(0.5rem, 1.5vw, 1rem));

  -webkit-mask-image:
    url(assets/tear-top.png),
    url(assets/tear-bottom.png),
    linear-gradient(#000, #000);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: top center, bottom center, center;
  -webkit-mask-size:
    100% var(--tear),
    100% var(--tear),
    100% calc(100% - 2 * var(--tear) + 2px);
  mask-image:
    url(assets/tear-top.png),
    url(assets/tear-bottom.png),
    linear-gradient(#000, #000);
  mask-repeat: no-repeat;
  mask-position: top center, bottom center, center;
  mask-size:
    100% var(--tear),
    100% var(--tear),
    100% calc(100% - 2 * var(--tear) + 2px);
}


/* ============================================================
   04. PAPER TEXTURE + AGE
   ::before = grain.  ::after = faint stains, kept away from
   the torn edges so nothing draws attention to them.
   ============================================================ */

.sheet::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.sheet::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 26% 10% at 94% 78%, rgba(138, 106, 60, 0.07), transparent),
    radial-gradient(ellipse 20% 10% at 0% 34%, rgba(138, 106, 60, 0.05), transparent);
  pointer-events: none;
}

.sheet > * { position: relative; z-index: 1; }


/* ============================================================
   05. MASTHEAD
   ============================================================ */

.entry-mark {
  font-family: 'La Belle Aurore', cursive;
  color: var(--ink-annotation);
  font-size: 1.1rem;
  margin-bottom: 1.4rem;
}

h1 {
  font-family: 'IM Fell English', serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.flourish {
  display: block;
  margin: 1.8rem 0 0;
  width: min(14rem, 60%);
  color: var(--ink-faded);
}

.role {
  font-style: italic;
  color: var(--ink-faded);
  font-size: 1.2rem;
  margin-top: 1.4rem;
}


/* ============================================================
   06. BIO PROSE
   Book convention: no gap between paragraphs, first line of
   each subsequent paragraph indented. First paragraph stays
   flush so the drop cap sits correctly.

   DROP CAP: line-height controls the float BOX height (how
   many lines wrap beside it); font-size controls how big the
   letter LOOKS. Adjust independently.
   ============================================================ */

.prose {
  margin-top: 3.25rem;
  font-size: 1.14rem;
  line-height: 1.75;
}

.prose p + p {
  margin-top: 0;
  text-indent: 1.5em;
}

.prose p:first-of-type::first-letter {
  font-family: 'IM Fell English', serif;
  font-size: 4.15em;
  line-height: 0.78;
  float: left;
  margin-top: 0.04em;
  margin-right: 0.04em;
  margin-bottom: -0.12em;
}


/* ============================================================
   07. LEDGER HEADINGS
   (the rule beside each heading lives in section 09)
   ============================================================ */

.ledger-head {
  margin-top: 3.25rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.ledger-head h2 {
  font-family: 'IM Fell English', serif;
  font-weight: 400;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}


/* ============================================================
   08. RECORDS
   (the vertical rule beside each entry lives in section 09)
   ============================================================ */

.record {
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1.25rem;
}

.record .date {
  font-style: italic;
  color: var(--ink-annotation);
  font-size: 0.98rem;
  line-height: 1.6;
  text-align: right;
  padding-top: 0.15rem;
}

.record .body .title {
  font-family: 'IM Fell English', serif;
  font-size: 1.2rem;
}

.record .body .note {
  color: var(--ink-faded);
  margin-top: 0.3rem;
}

/* Quoted opening line, dissolving at the end */
.excerpt {
  margin-top: 0.6rem;
  font-style: italic;
  color: var(--ink-faded);
  line-height: 1.6;
}

/* Wrap the final words in <span class="fade"> to fade them out.
   Keep the span short enough to stay on one line — if it wraps,
   the gradient restarts on each line. */
.excerpt .fade {
  background: linear-gradient(90deg,
    var(--ink-faded) 0%,
    rgba(92, 102, 114, 0) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.award {
  display: inline-block;
  margin-top: 0.45rem;
  font-style: italic;
  color: var(--accent-wax);
  font-size: 1rem;
}


/* ============================================================
   09. LINE STYLES — STRAIGHT vs. WAVY
   ------------------------------------------------------------
   Every rule and underline on the page lives here so the two
   looks can be swapped in one place.

   TO SWITCH: comment out the ACTIVE block below, uncomment
   the ALTERNATIVE block. (Anything between slash-star and
   star-slash is ignored by the browser.)

   Covers: ledger heading rules · record vertical rules ·
   closing top rule · link underlines
   ============================================================ */


/* ---------- ACTIVE: WAVY (hand-drawn) ---------- */

/* Horizontal rule beside each ledger heading */
.ledger-head .rule-line {
  flex: 1;
  border-bottom: none;
  height: 8px;
  transform: translateY(-0.35em);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 8' preserveAspectRatio='none'%3E%3Cpath d='M2 4.6 C 60 2.4, 120 6.2, 190 4.0 S 320 2.6, 398 4.4' fill='none' stroke='%235c6672' stroke-width='1.1' stroke-linecap='round' opacity='0.6'/%3E%3C/svg%3E");
}

/* Vertical rule beside each record entry */
.record .body {
  font-size: 1.1rem;
  line-height: 1.7;
  border-left: none;
  padding-left: 1.25rem;
  background-repeat: no-repeat;
  background-position: left top;
  background-size: 8px 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 400' preserveAspectRatio='none'%3E%3Cpath d='M4.6 2 C 2.4 60, 6.2 120, 4.0 190 S 2.6 320, 4.4 398' fill='none' stroke='%235c6672' stroke-width='1.1' stroke-linecap='round' opacity='0.6'/%3E%3C/svg%3E");
}

/* Rule above the closing section */
.closing {
  border-top: none;
  background-repeat: no-repeat;
  background-position: left top;
  background-size: 100% 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 8' preserveAspectRatio='none'%3E%3Cpath d='M2 4.6 C 60 2.4, 120 6.2, 190 4.0 S 320 2.6, 398 4.4' fill='none' stroke='%235c6672' stroke-width='1.1' stroke-linecap='round' opacity='0.6'/%3E%3C/svg%3E");
}

/* Link underlines */
.record .body .title a,
.closing a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: none;
  padding-bottom: 0.18em;
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: 100% 5px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 5' preserveAspectRatio='none'%3E%3Cpath d='M1 2.8 C 30 1.6, 60 3.8, 100 2.4 S 160 1.6, 199 2.9' fill='none' stroke='%235c6672' stroke-width='1.2' stroke-linecap='round' opacity='0.75'/%3E%3C/svg%3E");
  transition: color 200ms ease, background-image 200ms ease;
}

.record .body .title a:hover,
.closing a:hover,
.record .body .title a:focus-visible,
.closing a:focus-visible {
  color: var(--accent-wax);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 5' preserveAspectRatio='none'%3E%3Cpath d='M1 2.8 C 30 1.6, 60 3.8, 100 2.4 S 160 1.6, 199 2.9' fill='none' stroke='%238a5a44' stroke-width='1.2' stroke-linecap='round' opacity='0.9'/%3E%3C/svg%3E");
}


/* ---------- ALTERNATIVE: STRAIGHT (original) ----------
   Uncomment this block and comment out the WAVY block above.

.ledger-head .rule-line {
  flex: 1;
  border-bottom: 1px solid var(--rule);
  transform: translateY(-0.35em) rotate(-0.2deg);
}

.record .body {
  font-size: 1.1rem;
  line-height: 1.7;
  border-left: 1px solid var(--rule);
  padding-left: 1.25rem;
}

.closing {
  border-top: 1px solid var(--rule);
}

.record .body .title a,
.closing a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-faded);
  transition: border-color 200ms ease, color 200ms ease;
}

.record .body .title a:hover,
.closing a:hover,
.record .body .title a:focus-visible,
.closing a:focus-visible {
  color: var(--accent-wax);
  border-color: var(--accent-wax);
}

---------- end STRAIGHT ---------- */


/* ============================================================
   10. MARGIN NOTE
   ============================================================ */

.margin-note {
  font-family: 'La Belle Aurore', cursive;
  color: var(--ink-annotation);
  font-size: 1.1rem;
  line-height: 1.5;
  max-width: 17rem;
  margin: 2.75rem 0 0 auto;
  text-align: right;
  transform: rotate(-1.2deg);
}


/* ============================================================
   11. CLOSING
   (the rule above this section lives in section 09)
   ============================================================ */

.closing {
  margin-top: 3.25rem;
  padding-top: 1.75rem;
  font-size: 1.08rem;
  line-height: 1.7;
}

.signoff {
  display: inline-block;
  margin-top: 2rem;
  font-family: 'La Belle Aurore', cursive;
  font-size: 1.4rem;
  transform: rotate(-1deg);
}

.mark {
  display: block;
  margin: 1rem auto 0;
  width: 3rem;
  height: 3rem;
  opacity: 0.9;
  transform: rotate(-4deg);
}

.colophon {
  margin-top: 2.25rem;
  text-align: center;
  font-size: 1rem;
  font-style: italic;
  color: var(--ink-annotation);
}


/* ============================================================
   12. SECTION DIVIDER
   The single flourish between the bio and the ledger.
   Used once only — the ledger headings have their own rules.
   ============================================================ */

.divider {
  display: block;
  margin: 3rem auto 0;
  width: min(15rem, 55%);
  color: var(--ink-faded);
  opacity: 0.7;
}


/* ============================================================
   13. FOCUS STATES (keyboard navigation)
   ============================================================ */

a:focus-visible {
  outline: 2px solid var(--accent-wax);
  outline-offset: 3px;
}


/* ============================================================
   14. SMALL SCREENS
   Dates move above entries; the vertical rule is dropped since
   there's no column to sit beside.
   ============================================================ */

@media (max-width: 34rem) {
  .record {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .record .date { text-align: left; }

  .record .body {
    border-left: none;
    padding-left: 0;
    background-image: none;
  }

  .margin-note { max-width: 100%; }
}
