@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700&display=swap');

:root {
  --ink: #527894;
  /* Mamekwoko Blue Refined */
  --ink-soft: rgba(82, 120, 148, 0.78);
  --accent-sand: #fefcf5;
  --accent-rose: #fdf2f0;
  --accent-mint: #f0f7f4;
  --accent-mint-dark: #e0ece6;
  --border-soft: rgba(84, 124, 152, 0.15);
  --card-shadow: 2px 2px 0px rgba(84, 124, 152, 0.1);

  /* Backgrounds */
  --bg-page: #fffaf0;
  --bg-card: #ffffff;
  --bg-code: #232a31;

  --text-body: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eb526b;
    /* Night Pink Refined */
    --ink-soft: rgba(255, 250, 240, 0.72);
    /* Latte-ish muted */
    --accent-sand: #16213e;
    /* Dark accent */
    --accent-rose: #2e1a25;
    /* Darker rose/pinkish bg */
    --accent-mint: #16213e;
    /* Dark accent */
    --accent-mint-dark: #0f3460;
    --border-soft: rgba(235, 82, 107, 0.2);
    --card-shadow: 2px 2px 0px rgba(235, 82, 107, 0.2);

    --bg-page: #1a1a2e;
    /* Night Bg */
    --bg-card: #16213e;
    /* Night Accent as card bg? or slightly lighter */
    --bg-code: #0f3460;

    --text-body: #fffaf0;
    /* Off-white for body text */
  }
}

body.page {
  font-family: "Zen Maru Gothic", sans-serif;
  margin: 0;
  color: var(--text-body);
  background: var(--bg-page);
  /* Mamekoko Base */
  min-height: 100vh;
  padding-bottom: 4rem;
}

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

 .page .site-header {
   max-width: 960px;
   margin: 0 auto;
   padding: 1.25rem 1.5rem 0.5rem;
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 1rem;
 }
 
 .page .site-header.site-header--compact {
   padding-top: 1rem;
 }
 
 .page .brand {
   font-weight: 700;
   font-size: 1.25rem;
   color: var(--text-body);
   text-decoration: none;
   display: flex;
   align-items: center;
   gap: 0.5rem;
 }
 
 .page .brand-icon {
   font-size: 1.4rem;
 }
 
 .page .header-nav {
   display: flex;
   flex-wrap: wrap;
   gap: 1.25rem;
 }
 
 .page .header-link {
   text-decoration: none;
   color: var(--ink-soft);
   font-size: 0.95rem;
   font-weight: 600;
   display: inline-flex;
   align-items: center;
   gap: 0.4rem;
   transition: color 0.2s;
 }
 
 .page .header-link:hover {
   color: var(--ink);
 }

 .page .site-footer {
   max-width: 960px;
   margin: 3rem auto 0;
   padding: 2rem 1.5rem;
   color: var(--ink-soft);
 }
 
 .page .site-footer nav {
   display: flex;
   flex-wrap: wrap;
   gap: 1.25rem;
   justify-content: flex-start;
   align-items: center;
 }
 
 .page .site-footer a {
   color: inherit;
   text-decoration: none;
   font-weight: 600;
 }
 
 .page .site-footer a:hover {
   color: var(--ink);
 }
 
 .page .site-footer small {
   display: block;
   margin-top: 1rem;
   font-size: 0.85rem;
   letter-spacing: 0.02em;
 }

 .articles-header,
 .article-detail-header,
 .contact-header {
   max-width: 960px;
   margin: 0 auto;
   padding: 2.5rem 1.5rem 1.5rem;
}

.header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  transition: color 0.2s ease;
}

.header-back:hover {
  color: var(--ink);
}

.articles-header h1,
.article-detail-header h1,
.contact-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0.2rem 0;
}

.lede {
  color: var(--ink-soft);
  line-height: 1.7;
  margin-top: 0.5rem;
}

.eyebrow {
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0;
}

.articles-list {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.articles-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.articles-list li article {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 1.5rem;
  border: 2px solid var(--border-soft);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.articles-list li article:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px rgba(84, 124, 152, 0.15);
  border-color: var(--ink-soft);
}

.articles-list h2 {
  margin: 0.3rem 0 0.5rem;
  font-size: 1.35rem;
  color: var(--ink);
}

.date {
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 500;
}

.summary {
  margin: 0;
  line-height: 1.6;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
}

.tags li {
  background: var(--accent-mint);
  border-radius: 999px;
  padding: 0.2rem 0.85rem;
  font-size: 0.85rem;
  border: 1px solid rgba(47, 39, 33, 0.08);
}

.badge-soon {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--accent-mint);
  border: 1px solid rgba(47, 39, 33, 0.08);
  vertical-align: middle;
}

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 3rem 1rem;
  font-size: 1.1rem;
}

.coming-soon {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1.5rem;
}

.coming-soon img {
  width: 100%;
  max-width: 720px;
  border-radius: 24px;
  border: 2px solid var(--border-soft);
  box-shadow: var(--card-shadow);
}

.page--guides .articles-list li article {
  background: var(--accent-sand);
  border-color: rgba(47, 39, 33, 0.08);
}

.page--guides .tags li {
  background: var(--accent-rose);
}

.page--tags-all .articles-list li article {
  background: var(--accent-mint);
  border-color: rgba(47, 39, 33, 0.08);
}

.page--tag .articles-list li article {
  background: var(--accent-rose);
  border-color: rgba(47, 39, 33, 0.08);
}

.articles-controls {
  background: var(--bg-card);
  border-radius: 24px;
  border: 2px solid var(--border-soft);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}

.controls-toggle {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  border: 2px solid var(--border-soft);
  border-radius: 16px;
  background: var(--accent-sand);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.page--guides .controls-toggle {
  background: var(--accent-mint);
}

.controls-toggle__icon {
  display: inline-flex;
  transform-origin: center;
  transition: transform 0.2s ease;
}

.controls-toggle__icon--rotated {
  transform: rotate(180deg);
}

.controls-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.controls-field {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.controls-field select {
  appearance: none;
  border: 2px solid var(--border-soft);
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--accent-sand);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.page--guides .controls-field select {
  background: var(--accent-mint);
}

.controls-field select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(82, 120, 148, 0.15);
  outline: none;
}

.controls-row--actions {
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
}

.controls-submit {
  border: none;
  background: var(--ink);
  color: white;
  font-weight: 700;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(82, 120, 148, 0.25);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.controls-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.control-reset {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: underline;
}

.controls-note {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.controls-note__tag {
  font-weight: 600;
  color: var(--ink);
}

.controls-enhanced .controls-toggle {
  display: inline-flex;
}

.controls-enhanced .controls-form {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease;
}

.controls-enhanced .controls-form.controls-form--open {
  max-height: 640px;
  opacity: 1;
  pointer-events: auto;
}

.controls-enhanced .controls-form.controls-form--open {
  margin-top: 0.5rem;
}

.htmx-indicator {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  display: none;
}

.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator {
  display: inline-block;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-soft);
}

.pagination a {
  font-weight: 600;
  color: var(--ink);
}

.pagination-status {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.article-detail-main {
  max-width: 720px;
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
  background: var(--bg-card);
  border-radius: 30px;
  border: 2px solid var(--border-soft);
  box-shadow: var(--card-shadow);
}

.article-meta {
  padding: 2rem 2rem 0;
}

.article-meta .date {
  display: block;
  margin-bottom: 0.6rem;
}

.article-content {
  padding: 0 2rem 2.5rem;
  line-height: 1.9;
  font-size: 1.02rem;
}

/* --- Typography Enhancements --- */

.article-content h2 {
  font-size: 1.6rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed var(--border-soft);
  color: var(--ink);
  position: relative;
}

.article-content h3 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  padding-left: 0.8rem;
  border-left: 5px solid var(--accent-mint-dark);
}

.page--guides .article-content h3 {
  border-left-color: var(--accent-rose);
}

.article-content h4 {
  font-size: 1.15rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.article-content p {
  margin: 1rem 0;
}

.article-content a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-soft);
}

.article-content a:hover {
  text-decoration-color: var(--ink);
  opacity: 0.8;
}

/* Lists */
.article-content ul,
.article-content ol {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

.article-content ul li {
  list-style-type: none;
  position: relative;
  margin-bottom: 0.5rem;
}

.article-content ul li::before {
  content: '';
  position: absolute;
  left: -1.2rem;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--ink-soft);
}

.article-content ol li {
  margin-bottom: 0.5rem;
  color: var(--text-body);
}

/* Callout Box */
.callout {
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 16px;
  background: var(--accent-mint);
  border: 1px solid rgba(84, 124, 152, 0.1);
}

.page--guides .callout {
  background: var(--accent-rose);
  border-color: rgba(220, 100, 100, 0.1);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-content img,
.article-content figure {
  width: 100%;
  border-radius: 16px;
  margin: 2rem 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.article-content blockquote {
  border-left: 4px solid var(--accent-rose);
  padding-left: 1.2rem;
  color: var(--ink-soft);
  margin: 2rem 0;
  font-style: italic;
  background: rgba(253, 242, 240, 0.3);
  padding: 1rem 1.2rem;
  border-radius: 0 8px 8px 0;
}

.article-content pre {
  background: var(--bg-code);
  color: #f7f3ef;
  padding: 1.2rem;
  border-radius: 14px;
  overflow-x: auto;
  margin: 2rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Product Card (Amazon Link) --- */
.product-card {
  display: flex;
  background: var(--bg-card);
  border: 2px solid var(--border-soft);
  border-radius: 20px;
  padding: 1.5rem;
  margin: 3rem 0;
  gap: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
  text-decoration: none !important;
  /* Force no underline */
  color: inherit !important;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink-soft);
  box-shadow: 4px 4px 0px rgba(84, 124, 152, 0.15);
}

.product-image {
  flex-shrink: 0;
  width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
  margin: 0;
  /* Override article img margin */
  box-shadow: none;
  /* Override article img shadow */
  border-radius: 0;
}

.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.product-desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.product-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: white !important;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: 99px;
  font-size: 0.9rem;
  align-self: flex-start;
  transition: opacity 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-btn:hover {
  opacity: 0.9;
}

.product-btn .icon {
  margin-left: 0.4rem;
  font-size: 1.1em;
  line-height: 1;
}

/* --- Share Buttons --- */

.article-footer {
  margin-top: 4rem;
  margin-bottom: 2rem;
  padding-top: 2rem;
  border-top: 2px dashed var(--border-soft);
}

.share-area {
  text-align: center;
}

.share-label {
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  display: block;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.share-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-mint);
  color: var(--ink);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 1.2rem;
}

.share-btn:hover {
  transform: scale(1.15) rotate(5deg);
  background: var(--ink);
  color: white;
}

/* Contact Page Styles */
.page--contact .contact-card {
  max-width: 720px;
  margin: 0 auto 4rem;
  padding: 2rem;
  border-radius: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  box-shadow: var(--card-shadow);
}

.contact-card iframe {
  width: 100%;
  border: none;
  border-radius: 16px;
  min-height: 720px;
  background: var(--bg-card);
}

.contact-card .placeholder {
  background: var(--accent-sand);
  border-radius: 16px;
  padding: 1.5rem;
}

.contact-card .placeholder p {
  margin: 0;
  line-height: 1.7;
}

.page--notfound .notfound-main {
  max-width: 960px;
  margin: 0 auto 4rem;
  padding: 0 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.page--notfound .notfound-image {
  width: min(560px, 100%);
  height: auto;
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  border: 2px solid var(--border-soft);
  background: var(--bg-card);
}

.page--notfound .notfound-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  box-shadow: var(--card-shadow);
  border: 2px solid rgba(47, 39, 33, 0.08);
}

.page--notfound .notfound-home:hover {
  opacity: 0.9;
}

@media (max-width: 640px) {

  .page--news .news-header-oshirase {
    display: none;
  }

  .articles-list li article,
  .article-detail-main,
  .contact-card {
    border-radius: 18px;
    padding: 1.25rem;
  }

  .article-meta,
  .article-content {
    padding: 0 1rem 1.5rem;
  }

  .contact-card iframe {
    min-height: 640px;
  }

  /* Mobile Product Card */
  .product-card {
    flex-direction: column;
    padding: 1.25rem;
    gap: 1rem;
  }

  .product-image {
    width: 100%;
    height: 180px;
  }

  .product-image img {
    height: 100%;
    width: auto;
  }

  .product-button {
    align-self: stretch;
  }

  .controls-enhanced .controls-form.controls-form--open {
    max-height: 1000px;
  }
}

/* --- Controls & Tag Pills --- */
.controls-field input[type="search"],
.controls-field input[type="text"] {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.5rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.controls-field input[type="search"]::placeholder,
.controls-field input[type="text"]::placeholder {
  color: var(--ink-soft);
  opacity: 0.7;
}

.controls-field input[type="search"]:focus,
.controls-field input[type="text"]:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(82, 120, 148, 0.15);
  outline: none;
}

@media (prefers-color-scheme: dark) {
  .controls-field input[type="search"],
  .controls-field input[type="text"] {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
  }
  .controls-field input[type="search"]:focus,
  .controls-field input[type="text"]:focus {
    box-shadow: 0 0 0 3px rgba(235, 82, 107, 0.25);
    border-color: var(--ink);
  }
}

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  background-color: var(--accent-mint);
  color: var(--text-body);
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-soft);
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.tag-pill:hover {
  background-color: var(--accent-mint-dark);
  transform: translateY(-1px);
}

.tag-pill.active {
  background-color: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tag-pill input[type="radio"] {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .tag-pill {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
  }
  .tag-pill:hover {
    background-color: rgba(255, 255, 255, 0.12);
  }
  .tag-pill.active {
    background-color: var(--ink);
    border-color: var(--ink);
  }
}

.controls-row--tags {
  flex-basis: 100%;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-soft);
}

/* --- AdSense Containers --- */
.ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 2.5rem 0;
  background: transparent;
  border-radius: 12px;
  border: 1px dashed transparent;
  padding: 0.5rem;
  transition: all 0.3s ease;
}

.ad-container.ad-loaded {
  border-color: var(--border-soft);
  background: var(--bg-card);
  padding: 1rem;
}

.ad-article-top {
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.ad-article-bottom {
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.ad-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-align: center;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ad-container.ad-loaded .ad-label {
  opacity: 1;
}

/* --- Breadcrumb --- */
.breadcrumb {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.breadcrumb-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
  content: '›';
  margin-left: 0.5rem;
  color: var(--ink-soft);
}

.breadcrumb-item a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
  color: var(--ink);
}

.breadcrumb-item--current {
  color: var(--ink);
  font-weight: 600;
}