/* ============================================================
   DigitalCyn Short Stories — shared stylesheet
   Used by every generated page (hub + every story page) via
   templates/hub.html and templates/story.html. One file, no
   per-story or per-page duplication.

   Palette: DigitalCyn author-brand tokens (not a separate theme).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* User-selected turquoise palette: crisp white canvas with blue/green highlights. */
  --bg:          #FFFFFF;
  --text:        #0D4D6D;
  --blue:        #0D4D6D;
  --blue-soft:   #BFEFF5;
  --surface:     #EAFBFD;
  --aqua:        #40E0D0;
  --aqua-deep:   #18BFB7;
  --border:      rgba(13, 77, 109, 0.16);
  --neutral:     #BFEFF5;

  --card-bg:     #FFFFFF;
  --text-dim:    rgba(13, 77, 109, 0.74);
  --text-faint:  rgba(13, 77, 109, 0.50);
  --shadow:      0 12px 30px rgba(13, 77, 109, 0.08);
  --shadow-hover:0 18px 42px rgba(13, 77, 109, 0.14);
  --radius:      18px;
  --radius-sm:   11px;
}

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(circle at 8% 3%, rgba(64, 224, 208, 0.10), transparent 23rem),
    radial-gradient(circle at 94% 6%, rgba(191, 239, 245, 0.42), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s; }
a:hover { color: #087d85; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }

.eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ── NAV ── */
.nav {
  position: sticky;
  top: 0; z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 2rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-left { display: flex; align-items: center; gap: 0.75rem; }

.nav-home, .nav-hub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(13,77,109,.2);
  color: var(--blue);
  background: rgba(255,255,255,.90);
  transition: all 0.2s;
  flex-shrink: 0;
}
.nav-home { justify-self: start; }
.nav-home:hover, .nav-hub:hover { background: var(--aqua); border-color: var(--aqua); color: var(--blue); transform: translateY(-1px); }

.nav-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  justify-self: center;
}

.nav-spacer { width: 38px; }

/* Hub interface-language toggle: the library shows one language at a time. */
.hub-lang-toggle {
  justify-self: end;
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.22rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 4px 14px rgba(13,77,109,.06);
}
.hub-lang-toggle button {
  min-width: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  background: transparent;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.hub-lang-toggle button.active { background: var(--aqua); color: var(--blue); box-shadow: 0 3px 10px rgba(64,224,208,.25); }
.hub-lang-toggle button:not(.active):hover { background: var(--surface); color: var(--blue); }

/* Story-page language switch */
.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--card-bg);
}
.lang-switch a {
  padding: 0.4rem 0.85rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.lang-switch a.active { background: var(--aqua); color: var(--blue); }
.lang-switch a:not(.active):hover { background: var(--surface); color: var(--text); }

/* ── HERO (hub) ── */
.hero {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 4.7rem 1.5rem 3.2rem;
  text-align: center;
  isolation: isolate;
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(1px);
}
.hero::before { width: 150px; height: 150px; left: 3%; top: 2.3rem; background: rgba(64,224,208,.16); }
.hero::after { width: 115px; height: 115px; right: 7%; top: 4.5rem; background: rgba(191,239,245,.72); }
.hero .seal {
  width: 56px; height: 56px; margin: 0 auto 1.55rem; border-radius: 50%;
  border: 2px solid var(--aqua); display: flex; align-items: center; justify-content: center;
  color: var(--blue); background: #FFFFFF; box-shadow: 0 8px 22px rgba(64,224,208,.16);
}
.hero .seal svg { stroke: var(--blue); }
.hero h1 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600;
  font-size: clamp(2.65rem, 6vw, 4rem); color: var(--text); line-height: 1.04; margin: 0.75rem 0 1rem;
  letter-spacing: -0.025em;
}
.hero > p { color: var(--text-dim); font-size: 1.08rem; max-width: 620px; margin: 0 auto; }
.hero-spark { position: absolute; color: var(--aqua); font-size: 1.15rem; opacity: .75; }
.hero-spark-one { left: 18%; top: 5.2rem; }
.hero-spark-two { right: 18%; top: 2.8rem; color: var(--blue); font-size: .9rem; }

/* ── SEARCH & FILTER BAR (hub) ── */
.library-toolbar { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem 1.5rem; }
.search-row {
  display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center;
  background: rgba(191,239,245,.52); border: 1px solid rgba(13,77,109,.15); border-radius: 20px;
  padding: 1rem 1.15rem; box-shadow: var(--shadow);
}
.search-input-wrap { flex: 1 1 270px; position: relative; }
.search-input-wrap svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--blue); opacity: .58; }
#story-search {
  width: 100%; padding: 0.68rem 0.95rem 0.68rem 2.45rem; border: 1px solid rgba(13,77,109,.16); border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-size: 0.92rem; color: var(--text); background: #FFFFFF;
}
#story-search:focus { outline: 3px solid rgba(64,224,208,.22); border-color: var(--aqua); }
.filter-select {
  padding: 0.68rem 0.9rem; border: 1px solid rgba(13,77,109,.16); border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--text); background: #FFFFFF;
  flex: 0 0 auto;
}
.filter-select:focus { outline: 3px solid rgba(64,224,208,.22); border-color: var(--aqua); }
#clear-filters-btn {
  background: #FFFFFF; border: 1px solid rgba(13,77,109,.22); border-radius: var(--radius-sm);
  padding: 0.68rem 1rem; font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 700; color: var(--blue);
}
#clear-filters-btn:hover { background: var(--aqua); border-color: var(--aqua); color: var(--blue); }

.toolbar-meta {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem;
  margin-top: 1rem;
}
#result-count { font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--text-dim); font-weight: 600; }

.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.94); }
.view-toggle button {
  display: flex; align-items: center; gap: 0.4rem; border: none; background: transparent;
  padding: 0.52rem 0.9rem; font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 700; color: var(--text-dim);
}
.view-toggle button.active { background: var(--blue); color: #fff; }
.view-toggle button:not(.active):hover { background: var(--surface); color: var(--blue); }

.no-results {
  display: none; text-align: center; padding: 3rem 1.5rem; color: var(--text-dim);
  font-family: 'Inter', sans-serif; font-size: 0.95rem;
}
.no-results.visible { display: block; }

/* ── STORY LIBRARY: shared card, two layouts ── */
.stories-section { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem 5rem; }
.stories-grid.view-tile { display: grid; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); gap: 1.45rem; }
.stories-grid.view-list { display: flex; flex-direction: column; gap: 1rem; }

.story-card {
  position: relative;
  background: rgba(255,255,255,.98); border: 1px solid rgba(13,77,109,.13); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s, border-color .2s;
  display: flex; flex-direction: column;
}
.story-card:not(.is-soon):hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: rgba(64,224,208,.88); }
.story-card.is-soon { opacity: 0.78; }
.story-card::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--aqua), #2ACEC6, var(--blue)); opacity: .85; pointer-events: none; }

.story-card-image { display: block; background: var(--surface); overflow: hidden; flex-shrink: 0; }
.story-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.story-card:not(.is-soon):hover .story-card-image img { transform: scale(1.025); }
.story-card-image.placeholder { display: flex; align-items: center; justify-content: center; color: var(--blue); background: linear-gradient(135deg, rgba(191,239,245,.88), rgba(64,224,208,.18)); }

.story-card-body { padding: 1.25rem 1.4rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.story-card h2 a, .story-card h3 a { color: inherit; text-decoration: none; }
.story-card h2 a:hover, .story-card h3 a:hover { color: #087d85; }

.story-genre {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'Inter', sans-serif; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.075em; text-transform: uppercase;
  color: #087d85; margin-bottom: 0.72rem;
}
.story-genre .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 0 3px rgba(64,224,208,.15); }

.story-card h2, .story-card h3 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 650; font-size: 1.28rem; color: var(--text);
  margin-bottom: 0.5rem; line-height: 1.22;
}
.story-card p.hook { color: var(--text-dim); font-size: 0.94rem; line-height: 1.58; flex-grow: 1; }

.story-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1.15rem; }
.version-badge {
  display: inline-flex; align-items: center; min-height: 30px;
  padding: .34rem .7rem; border-radius: 999px;
  background: rgba(191,239,245,.58); color: var(--blue); border: 1px solid rgba(13,77,109,.16);
  font-family: 'Inter', sans-serif; font-size: .66rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase;
}
.read-link {
  display: inline-flex; align-items: center; justify-content: center; min-width: 72px;
  padding: .43rem .88rem; border-radius: 999px; background: var(--aqua); color: var(--blue);
  font-family: 'Inter', sans-serif; font-size: .74rem; font-weight: 800;
  box-shadow: 0 5px 14px rgba(64,224,208,.18);
}
.read-link:hover { background: var(--blue); color: #fff; }

.soon-label {
  font-family: 'Inter', sans-serif; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--blue); text-align: center; margin-top: 1.1rem; padding: 0.5rem 0.5rem;
  border: 1px dashed rgba(64,224,208,.70); border-radius: 999px; background: rgba(191,239,245,.28);
}

/* Tile layout: image on top */
.view-tile .story-card-image { width: 100%; height: 180px; }

/* List layout: image left, content right, denser */
.view-list .story-card { flex-direction: row; align-items: stretch; }
.view-list .story-card-image { width: 150px; height: auto; min-height: 145px; }
.view-list .story-card-body { padding: 1.05rem 1.3rem; }
.view-list .story-card h2, .view-list .story-card h3 { font-size: 1.1rem; }
.view-list .story-card p.hook { -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.view-list .story-card-footer { margin-top: .65rem; }

@media (max-width: 560px) {
  .view-list .story-card { flex-direction: column; }
  .view-list .story-card-image { width: 100%; height: 150px; }
}

/* ── ARTICLE HEADER (story page) ── */
.article-header { max-width: 680px; margin: 0 auto; padding: 3.5rem 1.5rem 2rem; text-align: center; }
.genre-seal {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: 'Inter', sans-serif; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #087d85; margin-bottom: 1.25rem;
}
.genre-seal .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--aqua); }
.article-header h1 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 700; font-size: clamp(2.3rem, 6vw, 3.4rem);
  color: var(--text); line-height: 1.08;
}
.article-header .byline { margin-top: 1rem; font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--text-dim); }
.article-header .byline a { color: var(--blue); font-weight: 600; }

.article-hero-image {
  max-width: 780px; margin: 0 auto 1rem; padding: 0 1.5rem;
}
.article-hero-image img { border-radius: var(--radius); box-shadow: var(--shadow); max-height: 420px; width: 100%; object-fit: cover; }

/* ── STORY BODY ── */
.story-body { max-width: 640px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.story-body p { margin-bottom: 1.4rem; color: var(--text); }
.story-body p:first-of-type::first-letter {
  font-family: 'Fraunces', Georgia, serif; font-weight: 700; font-size: 3.3rem; line-height: 0.8;
  float: left; margin: 0.1rem 0.6rem 0 0; color: var(--blue);
}

/* ── STATS BAR ── */
.stats-bar {
  max-width: 640px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem;
  display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.stat { display: flex; align-items: center; gap: 0.5rem; font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--text-dim); }

#story-like-btn {
  display: flex; align-items: center; gap: 0.5rem; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.5rem 1.1rem; color: var(--text-dim); font-family: 'Inter', sans-serif; font-size: 0.9rem;
}
#story-like-btn:hover { border-color: var(--blue); color: var(--blue); }
#story-like-btn.is-liked { background: rgba(75, 202, 209, 0.14); border-color: var(--aqua); color: var(--blue); }
#story-like-btn svg { transition: transform 0.2s; }
#story-like-btn.is-liked svg { fill: var(--aqua); stroke: var(--blue); transform: scale(1.1); }

/* ── MORE STORIES / COMMENTS ── */
.section-block { max-width: 640px; margin: 0 auto; padding: 3rem 1.5rem; }
.section-block h2 { font-family: 'Fraunces', Georgia, serif; font-size: 1.3rem; font-weight: 600; color: var(--text); margin-bottom: 1.5rem; text-align: center; }

.more-stories { display: flex; flex-direction: column; gap: 0.75rem; }
.more-stories a {
  display: block; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.9rem; background: var(--card-bg);
}
.more-stories a:hover { border-color: var(--blue); background: var(--surface); }

/* ── COMMENTS WIDGET ── */
.comments-list { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 2.5rem; }
.comment { padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.comment-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.5rem; }
.comment-name { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 0.95rem; color: var(--text); }
.comment-date { font-family: 'Inter', sans-serif; font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; }
.comment-body { font-family: 'EB Garamond', Georgia, serif; font-size: 1rem; line-height: 1.6; color: var(--text); }
.no-comments { font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--text-dim); text-align: center; padding: 1.5rem 0; }

#comment-form { display: flex; flex-direction: column; gap: 0.9rem; }
#comment-form label {
  font-family: 'Inter', sans-serif; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 0.35rem; display: block;
}
#comment-form input[type="text"], #comment-form textarea {
  width: 100%; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.7rem 0.9rem; color: var(--text); font-family: 'EB Garamond', Georgia, serif; font-size: 1rem; resize: vertical;
}
#comment-form input[type="text"]:focus, #comment-form textarea:focus { outline: none; border-color: var(--blue); }
#comment-form textarea { min-height: 110px; }

.hp-field { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.cf-turnstile { margin: 0.25rem 0; }

#comment-form button[type="submit"] {
  align-self: flex-start; background: var(--aqua); color: var(--blue); border: none; border-radius: 8px;
  padding: 0.7rem 1.5rem; font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 700;
}
#comment-form button[type="submit"]:hover { background: var(--blue); color: #fff; }
#comment-form button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }

#comment-status { font-family: 'Inter', sans-serif; font-size: 0.85rem; margin-top: 0.25rem; }
#comment-status.success { color: #2E8F6B; }
#comment-status.error { color: #B3402C; }

/* ── FOOTER ── */
.footer { border-top: 1px solid var(--border); padding: 2.5rem 1.5rem; text-align: center; }
.footer a { font-family: 'Inter', sans-serif; font-size: 0.8rem; color: var(--text-dim); margin: 0 0.75rem; }
.footer a:hover { color: var(--blue); }
.footer-copy { margin-top: 1.25rem; font-family: 'Inter', sans-serif; font-size: 0.72rem; color: var(--text-faint); }

@media (max-width: 640px) {
  .nav { padding: 0.8rem 1.25rem; }
  .article-header { padding: 2.5rem 1.25rem 1.5rem; }
  .search-row { flex-direction: column; align-items: stretch; }
  .filter-select { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Blue/green polish: keep the page bright and airy rather than warm. */
.hero { border-bottom: 0; }
.hero h1 { text-shadow: 0 1px 0 rgba(191,239,245,.45); }
.search-row { box-shadow: 0 10px 28px rgba(13,77,109,.08); }
.story-card:not(.is-soon):hover .story-card-title,
.story-card:not(.is-soon):hover [data-card-title] { color: #087f91; }
footer, .footer { background: #FFFFFF; }
