/* GLOBAL RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Georgia", serif;
}

body {
    background: #f7f3ec;
    color: #4a3f35;
    line-height: 1.6;
}

html {
  scroll-behavior: smooth;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: #f4efe7;
  border-bottom: 1px solid #e0d8cf;
  font-family: "Georgia", serif;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  flex-direction: column;
  line-height: 1;
  text-decoration: none;
  align-items: center;
}

.logo-main {
  font-size: 28px;
  font-weight: bold;
  color: #a88d68; /* deep red */
  font-family: "Georgia", serif;
}

.logo-sub {
  font-size: 14px;
  color: #4a3f35;
  margin-top: 3px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: "Georgia", serif;
}

.mobile-menu{
  display: none;
}

.nav-right a {
  margin-left: 20px;
  text-decoration: none;
  color: #4a3f35;
  font-size: 18px;
  padding: 8px 14px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.nav-center a {
  margin: 0 14px;
  text-decoration: none;
  color: #4a3f35;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.nav-center a:hover {
  background: #e8dfd6;
}

.nav-right a:hover {
  background: #e8dfd6;
}

.nav-btn {
  background: #b89f7a;
  color: white !important;
  padding: 8px 16px;
  border-radius: 6px;
}

.nav-button:hover {
  background: #a88d68;
}

/* HERO SECTION */
.hero {
    background: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=1600&q=80')
        center/cover no-repeat;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 248, 240, 0.75);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 4rem;
    font-weight: bold;
    color: #3b2f2f;
}

.tagline {
    font-size: 1.5rem;
    margin-top: 0.5rem;
    color: #6b5646;
}

.cta {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.8rem 2rem;
    background: #d8c3a5;
    color: #3b2f2f;
    text-decoration: none;
    border-radius: 6px;
    font-size: 1.2rem;
    transition: 0.3s;
}

.cta:hover {
    background: #c1a98b;
}

/* FEATURED STORIES */
.featured {
    padding: 3rem 2rem;
    text-align: center;
}

.featured h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
}

/* VIEW TOGGLE */
.view-toggle {
    margin-bottom: 1.5rem;
}

.view-toggle button {
    padding: 0.6rem 1.2rem;
    margin: 0 0.3rem;
    border: none;
    background: #e8dcc7;
    color: #4a3f35;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
    font-family: Georgia, serif;
}

.view-toggle button.active {
    background: #d8c3a5;
    font-weight: bold;
}

/* GRID BASE */
.story-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

/* BASE STORY CARD */

.story-card {
    width: 260px;
    height: 480px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: #fffaf3;
    padding: 1.2rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(120, 100, 80, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition:
        transform 0.4s ease,
        box-shadow 0.4s ease,
        background 0.4s ease,
        opacity 0.6s ease;
    position: relative;
}

/* HOVER EFFECT */
.story-card:hover {
    transform: translateY(-10px) scale(1.03);
    background: #fff5e8;
    box-shadow: 0 12px 24px rgba(120, 100, 80, 0.25);
}

.story-card:hover::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: inset -6px 0 12px rgba(0,0,0,0.08);
    pointer-events: none;
}

/* BASE COVER (NO HEIGHT HERE!) */
.cover {
    width: 100%;
    background: #e8dcc7;
    background-size: contain; 
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* THUMBNAIL MODE */
.thumbnail .story-card {
    width: 260px;
    height: 480px;
}

.thumbnail .cover {
    height: 340px;
}

/* FIXED TEXT HEIGHTS */
.thumbnail .story-card h3 {
    height: 72px; /* was 48px */
    overflow: hidden;
}

.thumbnail .story-card p {
    position: relative;
    height: 80px; /* adjust for how many lines you want */
    overflow: hidden;
}

.thumbnail .story-card p::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25px;
    background: linear-gradient(to bottom, transparent, #fffaf3);
}




/* LIST MODE */
.story-grid.list {
    display: block;
}

.story-grid.list .story-card {
    width: 100%;
    max-width: 800px;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 1rem;
    margin: 1rem auto;
}

.story-grid.list .cover {
    width: 140px;
    height: 200px;
    margin-right: 1.5rem;
}

.story-grid.list h3 {
    margin: 0;
}

.story-grid.list p {
    margin: 0.5rem 0;
}

/* form section for story submission */
.story-create {
  max-width: 600px;
  margin: 40px auto;
  padding: 30px;
  background: #faf7f2;
  border: 1px solid #e2dcd2;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-family: "Georgia", serif;
}

.story-create h2 {
  margin-bottom: 20px;
  font-size: 28px;
  color: #4a3f35;
  text-align: center;
}

.story-create label {
  display: block;
  margin-top: 15px;
  margin-bottom: 6px;
  font-weight: bold;
  color: #5a4c42;
}

.story-create input,
.story-create textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d6cfc7;
  border-radius: 8px;
  background: #fffdf9;
  font-size: 16px;
  font-family: "Georgia", serif;
  transition: border 0.2s ease;
}

.story-create input:focus,
.story-create textarea:focus {
  border-color: #b89f7a;
  outline: none;
}

.story-create textarea {
  min-height: 120px;
  resize: vertical;
}

.story-create button {
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  background: #b89f7a;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.story-create button:hover {
  background: #a88d68;
}

#status {
  margin-top: 15px;
  font-size: 16px;
  text-align: center;
  color: #4a3f35;
}


/* FOOTER */
footer {
    text-align: center;
    padding: 1.5rem;
    background: #efe6d9;
    margin-top: 3rem;
    font-size: 0.9rem;
}

/* createChapter.html */
.chapter-form {
  max-width: 700px;
  margin: 40px auto;
  padding: 20px;
  background: #faf7f2;
  border-radius: 12px;
  border: 1px solid #e2dcd2;
}

.chapter-form input,
.chapter-form textarea {
  width: 100%;
  margin-bottom: 15px;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #d6cfc4;
  border-radius: 8px;
}

.chapter-form button {
  padding: 12px 20px;
  background: #4a3f35;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.button {
  display: inline-block;
  padding: 12px 20px;
  background: #4a6cff;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
}

.button:hover {
  background: #3a56d4;
}

/* story reader */
.chapter-link {
  font-size: 18px;
  color: #4a3f35;
  text-decoration: none;
}

.chapter-link:hover {
  text-decoration: underline;
}
/* --- Story Layout --- */
.story-view {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
  color: #3a2f2a;
  font-family: "Georgia", serif;
}

/* --- Header with cover + text --- */
.story-header {
  display: flex;
  gap: 25px;
  margin-bottom: 30px;
}

.story-cover {
  width: 200px;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* --- Title + description --- */
.story-view h1 {
  font-size: 36px;
  margin: 0 0 10px 0;
}

.story-view p {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* --- Add Chapter button --- */
.button {
  display: inline-block;
  padding: 10px 18px;
  background: #b89f7a;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
}

.button:hover {
  background: #a88d68;
}

/* --- Chapter list (simple text links) --- */
.chapter-title {
  margin-top: 40px;
  font-size: 28px;
}

.chapter-list a {
  display: block;
  padding: 6px 0;
  font-size: 18px;
  color: #4a3f35;
  text-decoration: none;
}

.chapter-list a:hover {
  text-decoration: underline;
}
.chapter-view {
  max-width: 800px;
  margin: 40px auto;
  padding: 20px;
  font-family: "Georgia", serif;
  color: #3a2f2a;
}

.chapter-view h1 {
  font-size: 32px;
  margin-bottom: 20px;
}

.chapter-view p {
  font-size: 18px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.back-link {
  display: inline-block;
  background: #b89f7a;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 16px;
  margin-bottom: 15px;
  transition: background 0.2s ease;
}

.back-link:hover {
  background: #a88d68;
}

.chapter-form textarea {
  width: 100%;
  height: 300px;        /* Increase height */
  padding: 15px;
  font-size: 18px;
  line-height: 1.6;
  border-radius: 8px;
  border: 1px solid #c8b79e;
  background: #faf7f2;
  resize: vertical;     /* Allow user to stretch it */
  box-sizing: border-box;
}
/* ============================
   LIST VIEW — CLEAN + MODERN
   ============================ */

.story-grid.list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
  padding: 0 1rem;
}

/* List mode card */
.story-grid.list .story-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.2rem;

  padding: 1rem;
  border-radius: 10px;
  background: #fffaf3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);

  width: 100%;
  max-width: 900px;
  margin: 0 auto;

  transition: transform .2s ease, box-shadow .2s ease;
  height: auto; /* override thumbnail height */
}

/* Hover polish */
.story-grid.list .story-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Cover image (list mode uses .story-cover, not .cover) */
.story-grid.list .story-cover {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

/* Text block wrapper */
.story-grid.list .story-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Title */
.story-grid.list .story-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #4a3f35;
}

/* Description */
.story-grid.list .story-desc {
  margin-top: .4rem;
  color: #555;
  line-height: 1.4;

  /* Clamp to 2 lines */
  line-clamp: 2;              /* standard (not supported yet) */
  display: -webkit-box;
  -webkit-line-clamp: 2;      /* actual working version */
  -webkit-box-orient: vertical;

  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-list {
  margin: 30px 0;
  padding: 15px;
  background: #faf7f2;
  border: 1px solid #d8c7ad;
  border-radius: 8px;
}

.branch-list h3 {
  margin-top: 0;
  color: #4a3f35;
}

.branch-list ul {
  max-height: 200px;   /* shows ~4 items */
  overflow-y: auto;
  padding-right: 6px;  /* avoids scrollbar overlap */
}


.branch-list li {
  margin: 6px 0;
}

.branch-list a {
  color: #6b4f2a;
  text-decoration: none;
}

.branch-list a:hover {
  text-decoration: underline;
}

.no-branches {
  color: #7a6a58;
  font-style: italic;
}

.about-section {
  max-width: 800px;
  margin: 60px auto;
  padding: 40px;
  background: #faf7f2;
  border: 1px solid #e2dcd2;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-family: "Georgia", serif;
}

.about-section h2 {
  font-size: 28px;
  color: #4a3f35;
  margin-bottom: 15px;
}

.about-section p {
  margin-bottom: 16px;
  color: #5a4c42;
  line-height: 1.6;
}

.section-divider {
  margin: 30px 0;
  border: none;
  border-top: 1px solid #d6cfc7;
}

.terms-list {
  margin-top: 10px;
  padding-left: 20px;
  color: #4a3f35;
  line-height: 1.6;
}

.terms-list li {
  margin-bottom: 8px;
}
/* chapter styling */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
}
#chapterContent {
  position: relative;
  z-index: 1;
  margin-bottom: 60px; /* pushes content above nav */
}

.chapter-nav {
  position: relative;
  z-index: 10; /* ensures nav sits ABOVE content */
}
#chapterContent {
  margin-bottom: 80px; /* pushes content up */
  position: relative;
  z-index: 1;
}

.chapter-nav {
  position: relative;
  z-index: 10; /* ensures nav is above content */
}

.view-count {
  font-size: 14px;
  color: #777;
  margin-bottom: 20px;
}

.view-count {
  font-size: 14px;
  color: #777;
  margin: 10px 0 20px 0;
}

/* signin login */
/* Container */
.auth-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  min-height: 100vh;
}

/* Box */
.auth-box {
  background: #ffffff;
  padding: 30px 25px;
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Title */
.auth-box h2 {
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.8rem;
}

/* Form */
#signinForm label {
  display: block;
  margin-top: 15px;
  font-weight: 600;
}

#signupForm label {
  display: block;
  margin-top: 15px;
  font-weight: 600;
}

#signinForm input {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

#signupForm input {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

/* Button */
.auth-btn {
  width: 100%;
  margin-top: 25px;
  padding: 12px;
  background: #4a6cff;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.2s;
}

.auth-btn:hover {
  background: #3d5ae0;
}

/* Switch link */
.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 0.95rem;
}

.auth-switch a {
  color: #4a6cff;
  font-weight: 600;
}

/* Message */
.auth-message {
  margin-top: 15px;
  text-align: center;
  color: #d33;
  font-size: 0.9rem;
}