/*
Theme Name: Storytown
Theme URI: https://example.com/storytown
Author: OpenCode
Author URI: https://example.com
Description: Whimsical, handcrafted blog theme inspired by a pastel illustrated layout.
Version: 1.0.6
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
Text Domain: storytown
*/

:root {
  --bg: #f2f2f2;
  --ink: #253042;
  --muted: #4a5a73;
  --line: #d9d9d9;
  --blue-soft: #e8f6ff;
  --blue-deep: #1d7acc;
  --orange: #f58e2f;
  --orange-deep: #e56d14;
  --card: #ffffff;
  --footer: #122745;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  line-height: 1.45;
}

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

.site-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  padding-top: 24px;
}

.brand-area {
  text-align: center;
  margin-bottom: 16px;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.brand-link {
  display: inline-block;
}

.brand-wordmark {
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(4rem, 6vw, 8rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.012em;
}

.brand-bird {
  width: clamp(58px, 8.5vw, 115px);
  height: auto;
  margin-right: 4px;
  transform: translateY(3px);
}

.brand-p,
.brand-story {
  color: #232d41;
}

.brand-ta {
  color: #f48b36;
}

.brand-q {
  color: #2f81de;
}

.brand-logo {
  display: block;
  width: min(560px, 90vw);
  height: auto;
  object-fit: contain;
  margin-inline: auto;
}

.brand-subtitle {
  display: block;
  width: auto;
  max-width: min(680px, 90vw);
  max-height: clamp(128px, 5vw, 42px);
  object-fit: contain;
  margin: 8px auto 0;
}

.brand-tagline {
  margin: 18px 0 0;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(1.2rem, 1.5vw, 1.7rem);
  font-weight: 600;
  line-height: 1;
  color: #1f293b;
}

.primary-nav {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  margin-bottom: 16px;
}

.primary-nav ul {
  margin: 0;
  margin-top: 12px;
  padding: 12px 0 14px;
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.primary-nav li {
  position: relative;
}

.primary-nav a {
  display: inline-block;
  padding-bottom: 2px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.4rem);
  font-weight: 500;
  line-height: 1;
  color: #1f293b;
  letter-spacing: -0.005em;
  transition: color 0.2s ease;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: #2c3547;
}

.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a,
.primary-nav .current-menu-ancestor > a,
.primary-nav .current-page-ancestor > a {
  color: #f18f3d;
}

.primary-nav .current-menu-item > a::after,
.primary-nav .current_page_item > a::after,
.primary-nav .current-menu-ancestor > a::after,
.primary-nav .current-page-ancestor > a::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -5px;
  height: 4px;
  border-radius: 4px;
  background: #f4e886;
}

.primary-nav a:focus-visible,
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a {
  outline: none;
}

.hero-banner {
  overflow: hidden;
  border-radius: 0;
  margin-bottom: 22px;
  background: transparent;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.hero-banner img,
.hero-art {
  display: block;
  width: 100%;  
  object-fit: cover;  
}

.hero-art {
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 67% 20%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #b7e8ff 0%, #96d1ef 58%, #7cc3ea 100%);
}

.stories-panel {
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 67% 20%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 85% 45%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 40%),
    url('assets/sky-with-birds-bg.png'),
    linear-gradient(180deg, #b7e8ff 0%, #96d1ef 58%, #7cc3ea 100%);
  background-size: auto, auto, auto, 400px 400px, auto;
  background-repeat: repeat;
  border-radius: 0;
  padding: 22px 28px 24px;
  position: relative;
}

main.single-post .stories-panel {
  background: none;
  padding: 0;
}

.section-title {
  margin: 0 0 20px;
  text-align: center;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(2.5rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
  color: #24324b;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.story-card {
  list-style: none;
}

.story-card > a {
  display: block;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(36, 68, 102, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}

.story-card > a:hover,
.story-card > a:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(33, 63, 96, 0.2);
}

.story-card img,
.story-thumb {
  width: 100%;
  height: 156px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.story-thumb.fallback {
  background:
    linear-gradient(135deg, rgba(43, 146, 223, 0.52), rgba(246, 147, 67, 0.4)),
    linear-gradient(45deg, #8dd2f4, #bce8ff);
}

.story-copy {
  margin-top: 12px;
}

.story-copy h2 {
  margin: 0 0 6px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: 2rem;
  line-height: 1;
  color: #2a3347;
}

.story-copy p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 1.08rem;
}

.story-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffaf4b, var(--orange-deep));
  color: #fff;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: 1.1rem;
  line-height: 1;
  padding: 9px 18px 10px;
}

.story-card:nth-child(3n) .story-button {
  background: linear-gradient(180deg, #3ca5f0, var(--blue-deep));
}

.more-stories-wrap {
  text-align: center;
  margin: 18px 0 2px;
}

.story-dots {
  text-align: center;
  margin-top: 18px;
}

.story-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin: 0 5px;
  background: #95c9ec;
}

.story-dots span:nth-child(2) {
  background: #44acef;
}

.story-dots span:nth-child(3) {
  background: #f7a038;
}

.ptak-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.ptak-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(36, 68, 102, 0.14);
}

.ptak-thumb-wrap {
  flex-shrink: 0;
}

.ptak-thumb,
.ptak-card .fallback {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.ptak-card .fallback {
  background:
    linear-gradient(135deg, rgba(43, 146, 223, 0.52), rgba(246, 147, 67, 0.4)),
    linear-gradient(45deg, #8dd2f4, #bce8ff);
}

.ptak-info h2 {
  margin: 0 0 8px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: 1.8rem;
  line-height: 1.1;
  color: #2a3347;
}

.ptak-info p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.about-blog {
  background:
    radial-gradient(circle at 15% 30%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 35%),
    radial-gradient(circle at 75% 25%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, #b7e8ff 0%, #96d1ef 58%, #7cc3ea 100%);
  padding: 22px 26px 28px;
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 18px;
}

.about-brand {
  display: flex;
  justify-content: center;
}

.about-mark {
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #2f8de3 0 38%, transparent 39%),
    radial-gradient(circle at 63% 80%, #f58e2f 0 38%, transparent 39%),
    radial-gradient(circle at 54% 50%, #21314d 0 36%, transparent 37%),
    #d8ecfb;
}

.about-copy h2 {
  margin: 0 0 4px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(2.4rem, 3.4vw, 3rem);
  line-height: 1;
}

.about-copy p {
  margin: 0 0 14px;
  max-width: 740px;
  color: #324663;
  font-size: 1.1rem;
}

.pagination {
  text-align: center;
  padding: 24px 0 30px;
}

.pagination .page-numbers {
  display: inline-block;
  margin: 0 4px;
  padding: 5px 10px;
  border: 1px solid #bdd7e8;
  background: #fff;
  color: #35516f;
}

.pagination .page-numbers.current {
  border-color: #57afe8;
  color: #1c84ce;
}

.site-footer {
  margin-top: 0;
  padding: 24px 40px 24px;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.09) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 40%, rgba(255, 255, 255, 0.09) 0 1px, transparent 2px),
    linear-gradient(180deg, #20395f 0%, #132844 100%);
  background-size: 130px 90px, 170px 130px, auto;
  color: #e6f3ff;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.footer-logo {
  display: block;
  width: clamp(28px, 3vw, 44px);
  height: auto;
}

.footer-wordmark {
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(1.9rem, 3.2vw, 2.5rem);
  line-height: 1;
}

.wordmark-p {
  color: #3f9beb;
}

.wordmark-taq {
  color: #eecf58;
}

.wordmark-story {
  color: #87c3f3;
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: #d8ebff;
  font-size: 0.86rem;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 12px 0 4px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #d8ebff;
  transition: background 0.2s, color 0.2s;
}

.social-link:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.social-icon {
  width: 18px;
  height: 18px;
}

.copyright {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #91b3d4;
}

.empty-state {
  text-align: center;
  margin: 24px 0 40px;
  color: #4d6883;
}

main.single-post {
  max-width: 1100px;
  margin: 32px auto;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 6px 14px rgba(20, 39, 62, 0.09);
}

main.single-post h1 {
  margin-top: 0;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(2.1rem, 4vw, 2.8rem);
  line-height: 1;
}

main.single-post .meta {
  color: #6080a3;
}

main.single-post .back-link {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

main.single-post .btn-back {
  display: inline-block;
  padding: 10px 22px;
  background: linear-gradient(180deg, #f58e2f, var(--orange-deep));
  color: #fff;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 50px;
  box-shadow: 0 3px 8px rgba(229, 109, 20, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

main.single-post .btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(229, 109, 20, 0.45);
}

/* ── Article content media ─────────────────────────── */

main.single-post .content video,
main.single-post .content .wp-video,
main.single-post .content .wp-video video {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  margin-inline: auto;
}

main.single-post .content .wp-video {
  width: 100% !important;
}

main.single-post .content iframe {
  max-width: 100%;
  display: block;
  margin-inline: auto;
}

/* ── Comments ──────────────────────────────────────── */

.comments-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 2px solid var(--line);
}

.comments-title,
.comment-reply-title {
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 20px;
}

.comment-list {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
}

.comment-list li {
  margin-bottom: 12px;
}

.comment-body {
  background: var(--blue-soft);
  border-radius: 12px;
  padding: 14px 18px;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.comment-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-avatar {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.comment-author-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.comment-author-name a {
  color: var(--ink);
  text-decoration: none;
}

.comment-date {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.comment-text p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
  font-size: 0.95rem;
}

.comment-actions {
  margin-top: 8px;
  text-align: right;
}

.comment-reply-link {
  font-size: 0.82rem;
  color: var(--blue-deep);
  font-weight: 600;
  text-decoration: none;
}

.comment-reply-link:hover {
  text-decoration: underline;
}

.comment-list .children {
  list-style: none;
  padding-left: 28px;
  margin-top: 10px;
}

/* ── Comment form ──────────────────────────────────── */

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
}

.comment-form-field label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
}

.comment-form-field input[type="text"],
.comment-form-field input[type="email"],
.comment-form-field textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--card);
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.comment-form-field input:focus,
.comment-form-field textarea:focus {
  outline: none;
  border-color: var(--blue-deep);
}

.comment-form-field textarea {
  resize: vertical;
  min-height: 110px;
}

.btn-comment-submit {
  align-self: flex-start;
  padding: 10px 28px;
  background: linear-gradient(180deg, var(--blue-deep), #1565b0);
  color: #fff;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(29, 122, 204, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-comment-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(29, 122, 204, 0.45);
}

.logged-in-as {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}

.logged-in-as a {
  color: var(--blue-deep);
}

/* ── Search widget ─────────────────────────────────── */

.primary-nav {
  position: relative;
}

.search-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
  z-index: 1;
}

.search-toggle:hover,
.search-toggle:focus-visible {
  background: var(--blue-soft);
  border-color: var(--blue-deep);
  outline: none;
}

.search-toggle svg {
  width: 16px;
  height: 16px;
}

.search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  transition: background 0.2s ease;
}

.search-close:hover,
.search-close:focus-visible {
  background: var(--blue-soft);
  outline: none;
}

.search-close svg {
  width: 14px;
  height: 14px;
}

.search-bar {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  z-index: 2;
}

.primary-nav.search-open .search-bar {
  display: flex;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-input-wrap input[type="search"] {
  width: 100%;
  padding: 7px 32px 7px 14px;
  border: 2px solid var(--blue-deep);
  border-radius: 999px;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  color: var(--ink);
  background: var(--bg);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-input-wrap input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.search-input-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}

.search-input-clear:hover {
  background: var(--ink);
}

.search-input-clear svg {
  width: 10px;
  height: 10px;
}

.search-bar button[type="submit"] {
  padding: 7px 20px 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffaf4b, var(--orange-deep));
  color: #fff;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.primary-nav.search-open > ul,
.primary-nav.search-open > .menu {
  visibility: hidden;
}

.primary-nav.search-open .search-toggle {
  visibility: hidden;
}

.search-count {
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  margin: -8px 0 18px;
}

@media (max-width: 980px) {
  .site-shell {
    padding: 0 14px;
  }


  .primary-nav a {
    font-size: clamp(0.8rem, 1.75vw, 1.35rem);
  }

  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-blog {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .site-shell {
    padding: 0 10px;
  }


  .primary-nav ul {
    gap: 16px;
    padding: 10px 0;
  }

  .primary-nav a {
    font-size: clamp(0.95rem, 3.8vw, 1.1rem);
  }

  .brand-wordmark {
    font-size: clamp(2.8rem, 13vw, 4.6rem);
  }

  .brand-bird {
    width: clamp(42px, 11vw, 70px);
  }

  .brand-tagline {
    font-size: clamp(1.35rem, 6.2vw, 2rem);
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .stories-panel {
    padding: 20px 14px;
  }

  .about-blog {
    padding: 20px 14px 24px;
  }

  .comment-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .comment-list .children {
    padding-left: 16px;
  }
}
