
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:ital,wght@0,400;0,700;1,400;1,700&family=Tajawal:wght@400;500;700&display=swap');

/* Main colors */

:root {
  --paper: #ffffff;
  --ink: #222222;
  --background: #ffffff;
  --muted: #777777;
  --border: #e8e8e8;
  --accent: #ef7627;
  --font-size: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: "Tajawal", Arial, sans-serif;
  transition: background .2s, color .2s;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */

header,
.bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 15px max(18px, calc((100% - 840px) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--background);
  font-family: "Tajawal", sans-serif;
}

header a,
.bottom a {
  font-family: "Noto Naskh Arabic", serif;
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
}

header a:hover,
.bottom a:hover {
  color: var(--accent);
}

/* Reading controls */

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.controls button,
button {
  font-family: "Tajawal", sans-serif;
  font-size: 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 15px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.controls button:hover,
button:hover {
  background: rgba(128,128,128,.08);
  border-color: var(--accent);
}

button:focus-visible,
nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Main reading area */

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 35px 24px 70px;
}

/* Chapter heading */

main h1 {
  font-family: "Noto Naskh Arabic", serif;
  font-size: clamp(29px, 4vw, 39px);
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  margin: 12px 0 48px;
}

/* Chapter text */

article {
  font-family: "Noto Naskh Arabic", serif;
  font-size: var(--font-size);
  line-height: 1.85;
  text-align: right;
  overflow-wrap: break-word;
}

article p {
  font-family: "Noto Naskh Arabic", serif;
  font-size: inherit;
  font-weight: 400;
  line-height: 1.85;
  text-align: right;
  margin: 0 0 13px;
  white-space: normal;
  overflow-wrap: break-word;
}

article strong {
  font-weight: 700;
}

/* Inner thoughts: Italic */

article em,
article i {
  font-family: "Noto Naskh Arabic", serif;
  font-style: italic;
  font-weight: 400;
}

/* Scene breaks */

article .scene-break,
article p.scene-break {
  display: block;
  text-align: center;
  margin: 42px 0;
  line-height: 1.5;
  letter-spacing: 5px;
  font-size: 20px;
  color: var(--muted);
}

/* Chapter navigation */

main nav {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 50px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  font-family: "Tajawal", sans-serif;
}

main nav a {
  background: #f6f6f6;
  color: #222222;
  border: 1px solid #e8e8e8;
  border-radius: 7px;
  padding: 13px 17px;
  font-size: 14px;
  transition: background .2s;
}

main nav a:hover {
  background: #eeeeee;
}

main nav a.disabled {
  opacity: .45;
  pointer-events: none;
}

/* Night mode */

body.dark {
  --paper: #191919;
  --ink: #e8e8e8;
  --background: #191919;
  --muted: #aaaaaa;
  --border: #383838;
}

body.dark main nav a {
  background: #292929;
  color: #e8e8e8;
  border-color: #404040;
}

body.dark main nav a:hover {
  background: #363636;
}

/* Mobile */

@media (max-width: 700px) {

  header,
  .bottom {
    padding: 13px 18px;
    justify-content: center;
  }

  header a,
  .bottom a {
    font-size: 21px;
  }

  main {
    padding: 25px 20px 55px;
  }

  main h1 {
    font-size: 30px;
    margin-bottom: 35px;
  }

  .controls button {
    font-size: 13px;
    padding: 9px 12px;
  }

  article,
  article p {
    line-height: 1.8;
  }

  article p {
    margin-bottom: 12px;
  }

  article .scene-break,
  article p.scene-break {
    margin: 35px 0;
  }

  main nav {
    justify-content: center;
    margin-top: 40px;
  }

  main nav a {
    text-align: center;
  }
}
