/*
Theme Name: Minimal Mobile Blog
Theme URI: https://example.com/minimal-mobile-blog
Author: AI Assistant
Author URI: https://example.com
Description: Minimalistic blog theme focused on clean reading and convenient mobile publishing.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: minimal-mobile-blog
*/

:root {
  --bg: #ffffff;
  --surface: #f8f8f8;
  --text: #1d1d1f;
  --muted: #70757a;
  --line: #e8eaed;
  --accent: #0f62fe;
  --radius: 12px;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  /* Desktop aims at ~90% viewport, but with a sane max width */
  --container-max: 1400px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  text-wrap: pretty;
}

a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* Post card cover images: consistent 16:9 preview */
article.post-card a > img,
article.post-card img.wp-post-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  height: auto;
  max-height: 260px;
}

/* Images inside a single post: keep them reasonable */
article.single-post .post-content img {
  width: min(100%, 860px);
  display: block;
  margin: 0.5rem auto;
  max-height: 380px;
  object-fit: contain;
}

.site-header,
.site-footer {
  border-bottom: 1px solid var(--line);
}

.site-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  margin-top: var(--space-xl);
}

.wrapper {
  width: min(90vw, var(--container-max));
  margin-inline: auto;
}

.site-header .wrapper,
.site-footer .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  flex-wrap: wrap;
}

.site-header .wrapper {
  flex-direction: column;
  gap: 0.9rem;
  align-items: stretch;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-footer .wrapper {
  justify-content: center;
  text-align: center;
}

.site-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}

.site-title a {
  text-decoration: none;
}

.site-title a {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.01em;
}

.terminal-prefix {
  color: var(--muted);
}

.terminal-cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1.05em;
  margin-left: 0.2ch;
  border-radius: 2px;
  background: var(--text);
  transform: translateY(0.12em);
  animation: terminalBlink 1s steps(1, end) infinite;
}

@keyframes terminalBlink {
  50% {
    opacity: 0;
  }
}

.site-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.header-tools {
  width: 100%;
  display: flex;
  justify-content: center;
}

.menu {
  margin: 0;
  padding: 0;
  display: flex;
  list-style: none;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.menu li {
  position: relative;
}

.menu > li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.header-main-nav,
.header-brand {
  width: 100%;
}

.header-brand,
.header-main-nav,
.header-tools {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.72rem 0.85rem;
  box-shadow: none;
}

.menu a {
  display: inline-block;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  text-decoration: none;
}

.mobile-menu-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.mobile-menu-toggle-label {
  font-weight: 650;
  color: var(--text);
}

.mobile-menu-toggle-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  position: relative;
}

.mobile-menu-toggle-icon::before,
.mobile-menu-toggle-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 12px;
  height: 1.5px;
  background: var(--text);
  transform: translateX(-50%);
}

.mobile-menu-toggle-icon::before {
  top: 10px;
}

.mobile-menu-toggle-icon::after {
  top: 16px;
}

.menu .sub-menu {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.35rem);
  transform: translateX(-50%);
  min-width: 220px;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: none;
  z-index: 20;
}

/* wp_page_menu fallback uses .children for submenus */
.menu .children {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.35rem);
  transform: translateX(-50%);
  min-width: 220px;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: none;
  z-index: 20;
}

.menu .sub-menu a {
  display: block;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

.menu .children a {
  display: block;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

.menu li:hover > .sub-menu,
.menu li:focus-within > .sub-menu,
.menu li.is-open > .sub-menu {
  display: block;
}

.menu li:hover > .children,
.menu li:focus-within > .children,
.menu li.is-open > .children {
  display: block;
}

.submenu-toggle {
  display: none;
  margin-left: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  cursor: pointer;
}

.submenu-toggle::before {
  content: "⌄";
  display: inline-block;
  line-height: 1;
}

.header-search-form {
  width: min(100%, 580px);
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
}

.header-search-form input[type="search"] {
  flex: 1;
  min-width: 0;
}

.header-login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0.66rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.header-login-link:hover,
.header-login-link:focus-visible {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, white);
  background: #fff;
}

.menu a:hover,
.menu a:focus-visible {
  background: var(--surface);
}

main.site-main {
  padding: var(--space-lg) 0 var(--space-xl);
}

article.post-card,
article.single-post {
  padding: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  max-width: var(--container);
  margin-inline: auto;
  text-align: center;
}

article.post-card + article.post-card {
  margin-top: var(--space-md);
}

.post-title {
  margin: 0 0 0.2rem;
  line-height: 1.3;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
}

.post-title a {
  text-decoration: none;
}

.post-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
}

.post-excerpt p,
.post-content p {
  margin-top: 0;
}

.press-release-label {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.read-more {
  display: inline-block;
  margin-top: var(--space-xs);
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
}

.post-tags {
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
}

.post-categories {
  margin-top: 0.75rem;
  margin-bottom: 0.2rem;
}

.post-categories a {
  display: inline-block;
  margin: 0.2rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.post-categories a:hover,
.post-categories a:focus-visible {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, white);
}

.post-tags a {
  display: inline-block;
  margin: 0.2rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.post-tags a:hover,
.post-tags a:focus-visible {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, white);
}

.pagination {
  margin-top: var(--space-lg);
  display: flex;
  justify-content: center;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  min-height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  padding: 0 0.75rem;
}

.pagination .page-numbers.current {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.wp-block-quote,
blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

pre {
  overflow-x: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: var(--space-sm);
  border-radius: 10px;
}

.comments-area {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
  text-align: left;
}

input,
textarea,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="email"],
input[type="url"],
textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  outline-offset: 2px;
}

button,
.button,
input[type="submit"] {
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.screen-reader-text {
  position: absolute;
  left: -9999px;
}

.scroll-top-button {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: 1.1rem;
  z-index: 30;
  width: 2.7rem;
  height: 2.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: none;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, color 0.2s ease;
}

.scroll-top-button.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-button:hover,
.scroll-top-button:focus-visible {
  color: var(--accent);
}

@media (max-width: 680px) {
  .wrapper {
    width: min(100% - 1rem, var(--container-max));
  }

  .site-header .wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .site-footer .wrapper {
    flex-direction: column;
  }

  article.post-card,
  article.single-post {
    padding: 1rem;
  }

  .menu a {
    padding: 0.6rem 0.75rem;
  }

  .menu {
    justify-content: flex-start;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  /* Mobile: menu drops down vertically */
  .header-main-nav .menu,
  .header-main-nav #mmb-primary-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.6rem;
  }

  .header-main-nav.is-open .menu,
  .header-main-nav.is-open #mmb-primary-menu {
    display: flex;
  }

  .menu > li {
    width: 100%;
  }

  .menu > li > a {
    flex: 1;
  }

  .menu .sub-menu {
    position: static;
    transform: none;
    min-width: 0;
    width: 100%;
    margin-top: 0.35rem;
  }

  .menu .children {
    position: static;
    transform: none;
    min-width: 0;
    width: 100%;
    margin-top: 0.35rem;
  }

  .submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* On mobile: open/close only via the button (avoid sticky :focus-within). */
  .menu li:focus-within > .sub-menu,
  .menu li:focus-within > .children {
    display: none;
  }

  .post-meta {
    font-size: 0.9rem;
  }

  .header-search-form {
    flex-direction: column;
    width: 100%;
  }

  .header-search-form button,
  .header-search-form input[type="search"],
  .header-login-link {
    width: 100%;
  }

  .scroll-top-button {
    right: max(0.8rem, env(safe-area-inset-right));
    bottom: max(0.8rem, env(safe-area-inset-bottom));
  }
}

@media (min-width: 681px) and (max-width: 1024px) {
  .wrapper {
    width: min(100% - 2rem, 820px);
  }

  .site-title {
    font-size: 1.25rem;
  }
}

@media (min-width: 1025px) {
  main.site-main {
    padding-top: 2.25rem;
  }
}
