/*
Theme Name: BrightRakugaki
Theme URI: https://rakugaki.co/
Author: Rakugaki
Author URI: https://rakugaki.co/
Description: A cozy, Japanese-inspired classic theme for Rakugaki Knitwear. Soft pink, aqua and lavender palette with Space Grotesk headings, ink-drip card accents, a sticky translucent header and WooCommerce support held in reserve for later.
Version: 1.0.4
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bright-rakugaki
Tags: blog, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, editor-style, wide-blocks, e-commerce
*/

:root {
  --primary: #f8a5c2;
  --accent: #8ed4d8;
  --purple: #c3b4ff;
  --bg: #f9f4f0;
  --light: #fffaf5;
  --ink: #1a1a1a;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --shadow: 0 10px 30px rgba(26, 26, 26, .1);
  --container: 72rem;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img, video, iframe, svg { max-width: 100%; height: auto; }
img { display: block; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 .6em;
  color: var(--ink);
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin: 0 0 1.25em; }

a { color: var(--ink); text-decoration-color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }

/* Visible focus */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 6px var(--accent);
}

/* Accessibility helpers */
.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  height: 1px; margin: -1px; overflow: hidden; padding: 0;
  position: absolute; width: 1px; word-wrap: normal !important;
}
.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 1000;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 0 0 12px 12px;
  font-family: var(--font-head); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0; color: #fff; }

/* Layout */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.site-main { display: block; }
.section { padding: 70px 0; }

/* H1 ink underline accent */
h1.entry-title, .page-title, .hero h1 { position: relative; display: inline-block; padding-bottom: .25em; }
h1.entry-title::after, .page-title::after, .hero h1::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 55%; height: 6px; background: var(--ink);
  border-radius: 50px 80px 40px 70px / 6px 4px 6px 5px;
  transform: rotate(-.6deg);
}
.hero h1::after { left: 50%; width: 40%; transform: translateX(-50%) rotate(-.6deg); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(249, 244, 240, .95);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--ink);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding-top: 14px; padding-bottom: 14px;
}
.site-branding { display: flex; align-items: center; gap: 12px; }
.site-title, .logo {
  font-family: var(--font-head); font-weight: 700; font-size: 2.8rem;
  letter-spacing: -0.03em; line-height: 1; margin: 0; padding: 0;
}
.site-title a, .logo a { color: var(--ink); text-decoration: none; }
.site-title a:hover { color: var(--ink); text-shadow: 3px 3px 0 var(--primary); }
.custom-logo-link img, .site-logo { height: 56px; width: auto; max-width: 100%; display: block; }
.site-logo-link, .custom-logo-link { display: inline-block; line-height: 0; }
.site-logo-link:hover, .site-logo-link:focus-visible { text-shadow: none; }
.site-title.logo { line-height: 0; }

.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px 28px; flex-wrap: wrap; }
.main-navigation a {
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
  color: var(--ink); text-decoration: none; padding: 6px 2px; position: relative;
}
.main-navigation a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 3px;
  background: var(--primary); transition: right .25s ease; border-radius: 3px;
}
.main-navigation a:hover::after,
.main-navigation .current-menu-item > a::after,
.main-navigation .current_page_item > a::after { right: 0; }

.menu-toggle {
  display: none; background: var(--primary); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 12px; padding: 8px 14px; cursor: pointer;
  font-family: var(--font-head); font-weight: 600; font-size: 1rem; line-height: 1;
}
.menu-toggle .bars { display: inline-block; width: 18px; height: 2px; background: var(--ink); position: relative; vertical-align: middle; margin-right: 8px; }
.menu-toggle .bars::before, .menu-toggle .bars::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink); }
.menu-toggle .bars::before { top: -6px; }
.menu-toggle .bars::after { top: 6px; }

@media (max-width: 768px) {
  .custom-logo-link img, .site-logo { height: 44px; }
  .header-inner { flex-wrap: nowrap; padding-top: 10px; padding-bottom: 10px; }
  .menu-toggle { display: inline-flex; align-items: center; flex-shrink: 0; }
  .main-navigation { width: auto; }
  .main-navigation ul {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 3px);
    flex-direction: column; align-items: stretch; gap: 0; padding: 6px 20px 12px;
    background: var(--bg); border-bottom: 3px solid var(--ink);
    box-shadow: 0 14px 24px rgba(26, 26, 26, .12);
  }
  .main-navigation.toggled ul { display: flex; }
  .main-navigation li { border-bottom: 1px solid rgba(26,26,26,.1); }
  .main-navigation li:last-child { border-bottom: 0; }
  .main-navigation a { display: block; padding: 14px 4px; font-size: 1.15rem; }
  .main-navigation a::after { display: none; }
}

/* ---------- Buttons ---------- */
.btn, .button, button[type="submit"], input[type="submit"], .wp-block-button__link, .wp-element-button {
  display: inline-block; cursor: pointer;
  background: var(--primary); color: var(--ink);
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; line-height: 1.3;
  padding: 14px 32px; border: 0; border-radius: 50px; text-decoration: none;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:hover, .button:hover, button[type="submit"]:hover, input[type="submit"]:hover,
.wp-block-button__link:hover, .wp-element-button:hover {
  background: var(--accent); color: var(--ink); transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26,26,26,.15);
}
.btn-outline { background: transparent; box-shadow: inset 0 0 0 3px var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  position: relative; z-index: 0; isolation: isolate; text-align: center; overflow: hidden;
  background: linear-gradient(135deg, #f9f4f0 0%, #f0f7f7 100%);
  padding: 120px 20px 80px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 20% 30%, rgba(26,26,26,.05) 0, transparent 45%),
              radial-gradient(circle at 80% 70%, rgba(26,26,26,.04) 0, transparent 40%);
}
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); margin-bottom: .5em; }
.hero p.hero-sub { font-size: 1.3rem; max-width: 36rem; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Cards / grid ---------- */
.section-head { text-align: center; margin-bottom: 40px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 32px; }

.card, .product, .post-card {
  position: relative; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow); transition: transform .3s ease, box-shadow .3s ease;
  display: flex; flex-direction: column;
}
.card:hover, .post-card:hover { transform: translateY(-12px); box-shadow: 0 18px 40px rgba(26,26,26,.14); }
.card::after {
  content: ""; position: absolute; left: 28px; bottom: -4px;
  width: 14px; height: 0; background: var(--ink);
  border-radius: 0 0 14px 14px; transition: height .35s ease;
}
.card:hover::after, .card:focus-within::after { height: 22px; }

.card-thumb { display: block; border-radius: 20px 20px 0 0; overflow: hidden; background: linear-gradient(135deg, var(--primary), var(--purple)); aspect-ratio: 4 / 3; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-thumb img { transform: scale(1.04); }
.card-thumb.placeholder { display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 3rem; color: #fff; }
.card-body { padding: 24px 26px 34px; display: flex; flex-direction: column; flex: 1; }
.card-meta { font-size: .9rem; color: #555; margin-bottom: 8px; }
.card-title { font-size: 1.45rem; margin-bottom: .4em; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-decoration-color: var(--primary); }
.card-excerpt { font-size: 1rem; line-height: 1.65; margin-bottom: 1rem; }
.card-excerpt p:last-child { margin-bottom: 0; }
.card-link { margin-top: auto; font-family: var(--font-head); font-weight: 600; }

.center { text-align: center; }
.more-link-wrap { margin-top: 48px; text-align: center; }

/* ---------- Page headers ---------- */
.page-header, .entry-header { text-align: center; padding: 70px 20px 30px; }
.page-header .archive-description { max-width: 40rem; margin: 10px auto 0; }
.entry-meta { font-size: .95rem; color: #555; margin-top: 8px; }
.entry-featured { max-width: 760px; margin: 0 auto 32px; padding: 0 20px; }
.entry-featured img { width: 100%; border-radius: 16px; box-shadow: var(--shadow); }

/* ---------- Entry content card ---------- */
.entry-content {
  background: #fff; max-width: 760px; margin: 0 auto 60px;
  padding: 48px 44px; border-radius: 16px; box-shadow: var(--shadow);
  overflow-wrap: break-word;
}
.entry-content > *:first-child { margin-top: 0; }
.entry-content > *:last-child { margin-bottom: 0; }
.entry-content h2, .entry-content h3, .entry-content h4 { margin-top: 1.6em; }
.entry-content img { border-radius: 12px; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; margin: 0 0 1.25em; }
.entry-content li { margin-bottom: .35em; }
.entry-content blockquote {
  margin: 1.6em 0; padding: 18px 24px; background: var(--light);
  border-left: 6px solid var(--primary); border-radius: 0 12px 12px 0; font-style: italic;
}
.entry-content hr { border: 0; height: 3px; background: var(--ink); opacity: .15; margin: 2em 0; border-radius: 3px; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.entry-content th, .entry-content td { border: 1px solid rgba(26,26,26,.15); padding: 10px 12px; text-align: left; }
.entry-content th { background: var(--light); font-family: var(--font-head); }
/* Opening definition (core/preformatted) plus verse, code and their variants: light warm grey, never dark. */
.entry-content pre,
.entry-content .wp-block-preformatted,
.entry-content .wp-block-verse,
.entry-content .wp-block-code,
.entry-content pre.has-background,
.entry-content .wp-block-preformatted.has-background,
.entry-content .wp-block-verse.has-background,
.entry-content .wp-block-code.has-background {
  background: #f1ece7 !important;
  color: var(--ink) !important;
  border: 0;
  border-left: 5px solid var(--purple);
  border-radius: 14px;
  padding: 22px 26px;
  margin: 0 0 1.6em;
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow: auto;
}
.entry-content .wp-block-code, .entry-content .wp-block-code code, .entry-content pre.wp-block-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem; }
.entry-content pre:first-line, .entry-content .wp-block-preformatted:first-line { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; }
.entry-content code { background: var(--light); padding: 2px 6px; border-radius: 6px; font-size: .95em; }
.entry-content pre code { background: none !important; color: inherit !important; padding: 0; }
.entry-content .alignwide { max-width: 100%; }
/* Pages built with Jetpack Layout Grid (About) need more room than the 760px reading card. */
.entry-content:has(.wp-block-jetpack-layout-grid) { max-width: 1000px; }
.entry-content .alignfull { margin-left: 0; margin-right: 0; max-width: 100%; }
.entry-content .alignleft { float: left; margin: 0 1.5em 1em 0; }
.entry-content .alignright { float: right; margin: 0 0 1em 1.5em; }
.entry-content .aligncenter { margin-left: auto; margin-right: auto; }
.entry-content::after { content: ""; display: table; clear: both; }
.wp-caption, figure { margin: 0 0 1.25em; max-width: 100%; }
figcaption, .wp-caption-text { font-size: .9rem; color: #555; text-align: center; margin-top: 8px; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.page-links { margin-top: 1.5em; font-weight: 600; }

.post-navigation { max-width: 760px; margin: 0 auto 60px; padding: 0 20px; }
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.post-navigation a { font-family: var(--font-head); font-weight: 600; }

.pagination, .navigation.pagination { margin-top: 48px; text-align: center; }
.pagination .nav-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.page-numbers { display: inline-block; min-width: 44px; padding: 10px 14px; background: #fff; border-radius: 50px; text-decoration: none; font-family: var(--font-head); font-weight: 600; box-shadow: 0 4px 12px rgba(26,26,26,.08); }
.page-numbers.current, a.page-numbers:hover { background: var(--primary); }

.tag-list { margin-top: 1.5em; font-size: .95rem; }
.tag-list a { display: inline-block; background: var(--light); padding: 2px 12px; border-radius: 50px; margin: 0 6px 6px 0; text-decoration: none; border: 1px solid rgba(26,26,26,.12); }

/* ---------- Comments ---------- */
.comments-area { max-width: 760px; margin: 0 auto 60px; padding: 36px 44px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); }
.comments-title { font-size: 1.5rem; }
.comment-list { list-style: none; margin: 0 0 2em; padding: 0; }
.comment-list .children { list-style: none; padding-left: 24px; border-left: 3px solid var(--primary); margin-left: 8px; }
.comment-body { padding: 16px 0; border-bottom: 1px dashed rgba(26,26,26,.2); font-size: 1rem; }
.comment-author { font-family: var(--font-head); font-weight: 600; }
.comment-author img { display: inline-block; border-radius: 50%; margin-right: 10px; vertical-align: middle; }
.comment-metadata { font-size: .85rem; color: #555; }
.comment-metadata a { color: inherit; }
.comment-reply-link { font-family: var(--font-head); font-weight: 600; font-size: .9rem; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.comment-form p { margin-bottom: 1em; }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="password"], textarea, select {
  width: 100%; font: inherit; font-size: 1rem; padding: 12px 16px; background: var(--light);
  border: 2px solid rgba(26,26,26,.25); border-radius: 12px; color: var(--ink);
}
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--ink); }

/* Search form */
.search-form { display: flex; gap: 10px; max-width: 480px; margin: 20px auto 0; }
.search-form label { flex: 1; }
.search-form .search-submit { padding: 12px 24px; }

/* 404 */
.error-404 { text-align: center; padding: 100px 20px; }
.error-404 .big { font-family: var(--font-head); font-weight: 700; font-size: clamp(5rem, 18vw, 10rem); letter-spacing: -0.05em; line-height: 1; color: var(--primary); text-shadow: 4px 4px 0 var(--ink); margin-bottom: 20px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: #ddd;
  padding: 80px 20px 40px; text-align: center; margin-top: 40px;
}
.site-footer a { color: #fff; text-decoration-color: var(--primary); }
.site-footer a:hover { color: var(--accent); }
.footer-logo { font-family: var(--font-head); font-weight: 700; font-size: 2.2rem; letter-spacing: -0.03em; color: #fff; margin: 0 0 18px; line-height: 1; }
.footer-logo a { display: inline-block; line-height: 0; text-decoration: none; }
.footer-logo-img { height: 64px; width: auto; display: inline-block; }
.footer-nav ul { list-style: none; margin: 0 0 20px; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 28px; }
.footer-nav a { font-family: var(--font-head); font-weight: 500; text-decoration: none; }
.footer-social { margin-bottom: 28px; }
.footer-social a { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 600; text-decoration: none; padding: 8px 18px; border: 2px solid #555; border-radius: 50px; }
.footer-social a:hover { border-color: var(--accent); }
.footer-social svg { width: 18px; height: 18px; fill: currentColor; }
.site-footer :focus-visible { outline-color: #fff; box-shadow: 0 0 0 6px var(--purple); }
.copyright { font-size: .95rem; margin: 0; color: #bbb; }

/* ---------- WooCommerce (held in reserve) ---------- */
.woocommerce-page .site-main, .woocommerce .site-main { padding: 50px 0; }
.woocommerce ul.products { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px; }
.woocommerce ul.products li.product { padding: 0 0 24px; text-align: center; overflow: hidden; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: 1.2rem; padding: 12px 16px 0; }
.woocommerce .price { font-weight: 600; }
.woocommerce a.button, .woocommerce button.button, .woocommerce #respond input#submit { background: var(--primary); color: var(--ink); border-radius: 50px; padding: 14px 32px; font-family: var(--font-head); font-weight: 600; }
.woocommerce a.button:hover, .woocommerce button.button:hover { background: var(--accent); color: var(--ink); }

@media (max-width: 600px) {
  .entry-content, .comments-area { padding: 28px 22px; border-radius: 14px; margin-left: 12px; margin-right: 12px; }
  .hero { padding: 80px 20px 60px; }
  .page-header, .entry-header { padding-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover, .post-card:hover { transform: none; }
}
