:root{
  --bg: #D3D2CF;
  --text: #2E2E2E;
  --accent: #E76C0E;
  --content-width: 500px;
  --gap: 12px;
  --border-color: rgba(46,46,46,0.6);
  --accent-hover: #cf5a08;     /* slightly darker/livelier hover */
  --accent-visited: #b35509;   /* muted visited colour */
}

/* Page background:
   - fixed image aligned to left edge, repeating vertically.
   - Replace images/background.png with your image path.
*/
html,body{
  height:100%;
}
body{
  margin:0;
  font-family: "Spectral", Georgia, serif;
  background-color: var(--bg);
  color: var(--text);

  /* fixed, left-aligned vertical repeating image */
  background-image: url("images/background.png");
  background-repeat: repeat-y;
  background-position: -200px top;
  background-attachment: fixed;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Central content column */
.site-wrap{
  min-height:100vh;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:48px 20px;
}

.container{
  width:var(--content-width);
  max-width:100%;
  margin:0 auto;
}

/* Logo centered */
.logo{
  display:block;
  max-width:128px;
  width:100%;
  height:auto;
  margin:128px auto 0 auto;
}

/* Small h2 in secondary color, centered under logo */
.section-title{
  font-size:0.75rem;
  font-weight:600;
  color:var(--accent);
  text-align:center;
  margin:64px 0 32px 0;
  letter-spacing:0.4px;
  text-transform: uppercase;
}

/* Poems list styling */
.poems{
  list-style:none;
  margin:0;
  padding:0;
  /* counter-reset removed — numbers now managed by JS for reliability */
}

/* Each list item - dotted separator between items
   NOTE: padding moves to the anchor so the whole li behaves as link
*/
.poems li{
  display:block;
  padding:0; /* anchor will provide spacing */
  border-bottom:2px dotted var(--border-color);
  background: transparent;
}

/* Make the anchor fill the list item so the whole item is clickable */
.poems li a{
  display:flex;
  align-items:center;
  gap:var(--gap);
  padding:12px 6px;
  color:var(--text);
  text-decoration:none;
  font-weight:500;
  width:100%;
  transition: background-color 200ms ease, color 200ms ease;
  box-sizing:border-box;
  text-transform: uppercase;
}

/* Hover / focus: gentle transition to accent background and light text */
.poems li a:hover,
.poems li a:focus{
  background-color: var(--accent);
  color: #ffffff;
  outline: none;
  text-decoration: none;
}

/* Accessible focus ring */
.poems li a:focus{
  box-shadow: 0 0 0 3px rgba(231,108,14,0.18);
}

/* Number block: now a real element (.num). JS will insert the label text. */
.poems li .num{
  font-weight:300;
  font-size: 0.6em;
  color:var(--text);
  display:inline-block;
  min-width:32px;
  text-align:left;
  /* keep transition so color flips to white when hovered */
  transition: color 200ms ease;
}

/* When the item is hovered/focused, make the number readable on accent */
.poems li a:hover .num,
.poems li a:focus .num{
  color: #ffffff;
}

/* Vertical dotted separator between number and link */
.vsep{
  display:inline-block;
  width:1px;
  height:1.2em;
  border-left:2px dotted var(--border-color);
  margin-left:4px;
  margin-right:8px;
  transition: border-color 200ms ease;
}

/* Adjust separator color on hover/focus so it is visible on accent bg */
.poems li a:hover .vsep,
.poems li a:focus .vsep{
  border-left-color: rgba(255,255,255,0.7);
}

/* Poem title (inside the link) */
.poems a .title{
  flex:1 1 auto;
  text-align:left;
}

/* Accordion list */
.accordion{
  list-style:none;
  padding:0;
  margin:18px 0 0 0;
  border-top: 0;
}

/* Accordion item */
.accordion li{
  border-bottom:2px dotted var(--border-color);
  padding:6px 0;
}

/* Toggle button (accessible) */
.accordion-toggle{
  width:100%;
  text-align:left;
  background:transparent;
  border:0;
  padding:10px 6px;
  font-family:inherit;
  font-size:1rem;
  color:var(--text);
  display:flex;
  justify-content:space-between;
  align-items:center;
  cursor:pointer;
  text-transform: uppercase;
}
.accordion-toggle:focus{
  outline:2px solid rgba(231,108,14,0.2);
  outline-offset:2px;
}

/* Caret */
.caret{
  display:inline-block;
  width:12px;
  height:12px;
  margin-left:12px;
  border-right:2px solid var(--border-color);
  border-bottom:2px solid var(--border-color);
  transform:rotate(45deg);
  transition: transform 180ms ease;
  opacity:0.9;
}

/* When expanded, rotate caret */
.accordion-toggle[aria-expanded="true"] .caret{
  transform:rotate(-135deg);
}

/* Panel content */
.panel{
  padding:10px 6px 18px 6px;
  color:var(--text);
  line-height:1.5;
  transition: max-height 200ms ease;
}

/* Apply to links inside paragraphs (adjust selector if you use a different pattern/class) */
p a {
  color: var(--accent);
  font-weight: 600;           /* slightly bolder */
  text-decoration: none;      /* no underline by default */
  transition: color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  outline: none;              /* we'll show custom focus */
}

/* Visited state */
p a:visited {
  color: var(--accent-visited);
}

/* Hover and focus (mouse hover or keyboard focus) */
p a:hover,
p a:focus,
p a:focus-visible {
  color: var(--accent-hover);
  text-decoration: none;      /* keep no underline; remove if you prefer underline on hover */
  /* subtle emphasis — small inset shadow to hint interactivity (works like underline without changing layout) */
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.04);
}

/* Strong visible focus for keyboard users */
p a:focus-visible {
  box-shadow: 0 0 0 3px rgba(231,108,14,0.18); /* matches your accent */
  border-radius: 3px;
}

/* Small responsive tweaks */
@media (max-width:520px){
  .container{ width:100%; }
  .logo{ max-width:220px; }
}

/* Poem title */
    .poem-title {
      font-family: "Spectral", Georgia, serif;
      font-size: 1.9rem;
      font-weight: 700;
      color: var(--text);
      text-transform: uppercase;
      text-align: left;
      margin: 0;
      letter-spacing: 0.6px;
    }

    /* Dotted rule used before/after poem and around back link.
       Creates a dotted line and reserves vertical spacing (32px) */
    .dotted-rule {
      border-top: 2px dotted var(--border-color);
      margin: 32px 0;
      position: relative;
      height: 0;
    }

    /* When we need the rule tighter (optional) */
    .dotted-rule.tight {
      margin: 12px 0;
    }

    /* Poem body: preserve line breaks and provide readable line-height */
    .poem-body {
      font-family: "Spectral", Georgia, serif;
      color: var(--text);
      line-height: 1.8;
      font-size: 1rem;
      padding: 0 4px;
      margin: 0;
    }

    .back-link {
      background: var(--bg);
      padding: 6px 10px;
      color: var(--accent);
      font-weight: 700;
      text-decoration: none;
      border-radius: 3px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      text-transform: uppercase;
      font-size: 0.85rem;
      box-shadow: none;
      transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
    }

    .back-link .chev {
      font-size: 1.05rem;
      line-height: 1;
      display: inline-block;
      transform: translateY(-1px);
    }

    .back-link:hover,
    .back-link:focus,
    .back-link:focus-visible {
      background: var(--accent);
      color: #fff;
      text-decoration: none;
      outline: none;
      box-shadow: 0 0 0 3px rgba(231,108,14,0.18);
    }
