/*
Theme Name: tty-portfolio
Theme URI: https://github.com/makoto-kamimura/docker_wordpress
Author: Makoto Kamimura
Author URI: https://github.com/makoto-kamimura
Description: Terminal-minimal monospace portfolio theme. Performance-tuned (Lighthouse 90+), WCAG AA, dark/light auto + manual toggle, OGP + JSON-LD structured data.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: MIT
License URI: https://opensource.org/licenses/MIT
Text Domain: tty-portfolio
Tags: portfolio, dark-mode, custom-post-types, accessibility-ready, translation-ready
*/

/* =========================================================
   Reset (minimal)
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; line-height: 1.6; }
body { margin: 0; }
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* =========================================================
   Color tokens (dark default + light override)
   - prefers-color-scheme は html[data-theme] が無い時のみ効く
   - data-theme="light" / "dark" はユーザートグル
   ========================================================= */
:root {
  --bg:        #0d1117;
  --bg-elev:   #161b22;
  --bg-code:   #1e242c;
  --fg:        #e6edf3;
  --fg-muted:  #8b949e;
  --fg-dim:    #5c6370;
  --rule:      #30363d;

  --accent:    #6ee7b7;  /* prompt green */
  --accent-2:  #61dafb;  /* link cyan    */
  --accent-3:  #f178b6;  /* string magenta */
  --warn:      #ffa657;
  --err:       #ff7b72;

  --focus:     #6ee7b7;
  --selection: #325c45;

  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font-text: "Inter", system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;

  --container:  72rem;
  --gutter:     clamp(1rem, 2.5vw, 2rem);
  --radius:     6px;
  --shadow:     0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.35);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:        #fafaf7;
    --bg-elev:   #ffffff;
    --bg-code:   #f1efe9;
    --fg:        #1c1917;
    --fg-muted:  #57534e;
    --fg-dim:    #a8a29e;
    --rule:      #e7e5e4;

    --accent:    #16a34a;
    --accent-2:  #0891b2;
    --accent-3:  #c026d3;
    --warn:      #b45309;
    --err:       #b91c1c;

    --focus:     #16a34a;
    --selection: #d6f5e0;
    --shadow:    0 1px 0 rgba(0,0,0,0.04) inset, 0 4px 14px rgba(0,0,0,0.06);
  }
}

[data-theme="light"] {
  --bg:        #fafaf7;
  --bg-elev:   #ffffff;
  --bg-code:   #f1efe9;
  --fg:        #1c1917;
  --fg-muted:  #57534e;
  --fg-dim:    #a8a29e;
  --rule:      #e7e5e4;
  --accent:    #16a34a;
  --accent-2:  #0891b2;
  --accent-3:  #c026d3;
  --warn:      #b45309;
  --err:       #b91c1c;
  --focus:     #16a34a;
  --selection: #d6f5e0;
  --shadow:    0 1px 0 rgba(0,0,0,0.04) inset, 0 4px 14px rgba(0,0,0,0.06);
}

[data-theme="dark"] {
  --bg:        #0d1117;
  --bg-elev:   #161b22;
  --bg-code:   #1e242c;
  --fg:        #e6edf3;
  --fg-muted:  #8b949e;
  --fg-dim:    #5c6370;
  --rule:      #30363d;
  --accent:    #6ee7b7;
  --accent-2:  #61dafb;
  --accent-3:  #f178b6;
  --warn:      #ffa657;
  --err:       #ff7b72;
  --focus:     #6ee7b7;
  --selection: #325c45;
  --shadow:    0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.35);
}

::selection { background: var(--selection); color: var(--fg); }

/* =========================================================
   Base
   ========================================================= */
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Page transition ──────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  body {
    animation: page-in 0.35s ease both;
  }
  @keyframes page-in {
    from { opacity: 0; translate: 0 8px; }
    to   { opacity: 1; translate: 0 0;   }
  }
  body.is-leaving {
    transition: opacity 0.13s ease, translate 0.13s ease;
    opacity: 0;
    translate: 0 -5px;
    pointer-events: none;
  }
}
.prose, .entry-content { font-family: var(--font-text); font-size: 16px; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  color: var(--fg);
}

p, ul, ol, pre, figure, blockquote { margin: 0 0 1em; }

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

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

code, kbd, samp {
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}
pre {
  background: var(--bg-code);
  color: var(--fg);
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.55;
}
pre code { background: none; padding: 0; border-radius: 0; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 1rem;
  color: var(--fg-muted);
  background: var(--bg-elev);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* =========================================================
   Accessibility utilities
   ========================================================= */
.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 !important;
  width: 1px;
  word-wrap: normal !important;
}
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 1000;
  background: var(--accent);
  color: #000;
  padding: 0.75rem 1rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
  top: 0;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Layout
   ========================================================= */
.container {
  width: min(100% - calc(var(--gutter) * 2), var(--container));
  margin-inline: auto;
}

.section { padding-block: clamp(3rem, 8vw, 6rem); }
.section + .section { border-top: 1px dashed var(--rule); }

.section-header { margin-bottom: 2rem; }
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.section-eyebrow::before { content: "$"; color: var(--fg-dim); }
.section-title {
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  margin: 0.25em 0 0.3em;
}
.section-title::before {
  content: "// ";
  color: var(--fg-dim);
}
.section-lede {
  color: var(--fg-muted);
  max-width: 60ch;
  font-size: 0.97rem;
}
.section-lede[data-charwrap] {
  white-space: nowrap;
  max-width: none;
}
@media (max-width: 719px) {
  .section-lede[data-charwrap] {
    white-space: normal;
    max-width: 60ch;
  }
}

/* =========================================================
   Site header / footer
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.75rem;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}
.site-brand .brand-prompt { color: var(--accent); }
.site-brand .brand-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--accent);
  vertical-align: -2px;
  margin-inline-start: 2px;
  animation: blink 1.05s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.primary-nav { display: none; }
@media (min-width: 720px) {
  .primary-nav { display: block; }
}
.primary-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.2rem;
}
.primary-nav a {
  text-decoration: none;
  color: var(--fg-muted);
  font-size: 0.93rem;
}
.primary-nav a::before { content: "~/"; color: var(--fg-dim); }
.primary-nav a:hover,
.primary-nav .current-menu-item a { color: var(--fg); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg);
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 2.4rem;
  justify-content: center;
}
.theme-toggle:hover { border-color: var(--fg-muted); }

.site-footer {
  border-top: 1px dashed var(--rule);
  padding-block: 2rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer .prompt { color: var(--fg-dim); }
.site-footer a { color: var(--fg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding-block: clamp(4rem, 10vw, 7rem) clamp(3rem, 6vw, 4rem);
}
.hero-terminal {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  background: color-mix(in srgb, var(--bg-elev) 80%, var(--rule));
  border-bottom: 1px solid var(--rule);
}
.hero-terminal-bar .dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--fg-dim);
  flex: none;
}
.hero-terminal-bar .dot:nth-child(1) { background: #ff5f57; }
.hero-terminal-bar .dot:nth-child(2) { background: #febc2e; }
.hero-terminal-bar .dot:nth-child(3) { background: #28c840; }
.hero-terminal-bar .title {
  margin-inline-start: 0.6rem;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
.hero-terminal-body {
  padding: 1.5rem 1.6rem 1.8rem;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  line-height: 1.85;
}
.hero-line { display: block; }
.hero-prompt { color: var(--accent); margin-right: 0.5em; }
.hero-name {
  display: block;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0.4em 0 0.25em;
  color: var(--fg);
}
.hero-tagline { color: var(--fg-muted); max-width: 60ch; }
.hero-cta {
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.btn::before { content: "["; color: var(--fg-dim); margin-right: -0.2rem; }
.btn::after  { content: " ]"; color: var(--fg-dim); margin-left: -0.2rem; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { border-color: var(--accent); color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* =========================================================
   Grid / Card (Works, Blog)
   ========================================================= */
.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--fg);
  transition: border-color .15s ease, transform .2s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-thumb {
  aspect-ratio: 16 / 10;
  background: color-mix(in srgb, var(--bg-code) 80%, var(--rule));
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.card-title {
  font-size: 1.02rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.card-excerpt { color: var(--fg-muted); font-size: 0.9rem; margin: 0; }
.card-meta { color: var(--fg-dim); font-size: 0.8rem; margin-top: auto; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--fg-muted);
  text-decoration: none;
}
.tag:hover { color: var(--fg); border-color: var(--fg-muted); }

/* =========================================================
   About / Skills
   ========================================================= */
.about-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 720px) {
  .about-grid { grid-template-columns: 1.4fr 1fr; }
}
.skills {
  display: grid;
  gap: 0.45rem;
}
.skill-row { display: grid; gap: 0.3rem; }
.skill-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}
.skill-name { color: var(--fg); }
.skill-level { color: var(--fg-muted); }
.skill-bar {
  height: 6px;
  background: var(--bg-code);
  border-radius: 999px;
  overflow: hidden;
}
.skill-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}

/* =========================================================
   Contact
   ========================================================= */
.contact-links {
  display: grid;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
}
.contact-links a:hover { border-color: var(--accent); }
.contact-links .label { color: var(--fg-dim); margin-right: 0.3rem; }

/* =========================================================
   Article (single / page)
   ========================================================= */
.article {
  padding-block: 3rem;
}
.article-header { margin-bottom: 1.5rem; }
.article-title {
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.4em;
}
.article-meta {
  color: var(--fg-muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.article .entry-content > * { margin-bottom: 1.1em; }
.article .entry-content img { border-radius: var(--radius); border: 1px solid var(--rule); }
.article .entry-content h2 { margin-top: 2em; }
.article .entry-content h3 { margin-top: 1.6em; }

.pagination {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 3rem;
  font-size: 0.9rem;
}
.pagination a {
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--rule);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }

/* Work single — Demo / Repo buttons */
.work-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 2rem;
}

/* =========================================================
   Search form
   ========================================================= */
.search-form {
  display: flex;
  gap: 0.5rem;
}
.search-field {
  flex: 1;
  font: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  color: var(--fg);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
}
.search-field::placeholder { color: var(--fg-dim); }
.search-submit { padding: 0.5rem 0.9rem; }

/* =========================================================
   404
   ========================================================= */
.error-404 {
  padding-block: clamp(4rem, 12vw, 8rem);
  text-align: center;
}
.error-404 pre {
  display: inline-block;
  text-align: left;
  background: var(--bg-elev);
  margin: 0 auto 2rem;
}

/* =========================================================
   Comments
   ========================================================= */
.comment-list { list-style: none; padding: 0; }
.comment {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: var(--bg-elev);
  margin-bottom: 0.8rem;
}
.comment-meta { font-size: 0.85rem; color: var(--fg-muted); margin-bottom: 0.5rem; }
.comment-form input,
.comment-form textarea {
  width: 100%;
  font: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  color: var(--fg);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
}
.comment-form textarea { min-height: 8rem; }

/* ============================================================
   Typewriter cursor (reuses blink keyframe from .brand-cursor)
   ============================================================ */
.nowrap { white-space: nowrap; }
.lede-char {
  display: inline;
  transition: color 0.15s, opacity 0.15s;
}
.lede-char.struck {
  text-decoration: line-through;
  color: var(--fg-dim);
  opacity: 0.45;
}
.typewriter-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: currentColor;
  vertical-align: -2px;
  margin-inline-start: 2px;
  animation: blink 1.05s steps(2, end) infinite;
}

/* ============================================================
   Contact section — inquiry link button
   ============================================================ */
.contact-inquiry-link {
  margin-top: 2rem;
}
.btn-inquiry {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.55rem 1.4rem;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-inquiry:hover {
  background: var(--accent);
  color: #000;
}

/* ============================================================
   Contact Form 7 — inquiry form (/contact/ page)
   ============================================================ */
.contact-form-wrap {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: minmax(0, 60ch) 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 719px) {
  .contact-form-wrap { grid-template-columns: 1fr; }
}
.contact-form-heading {
  margin: 0 0 1.5rem;
}
.contact-translate {
  position: sticky;
  top: calc(3.5rem + 1.5rem);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.contact-translate-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  background: color-mix(in srgb, var(--bg-elev) 80%, var(--rule));
  border-bottom: 1px solid var(--rule);
}
.contact-translate-bar .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex: none;
}
.contact-translate-bar .dot:nth-child(1) { background: #ff5f57; }
.contact-translate-bar .dot:nth-child(2) { background: #febc2e; }
.contact-translate-bar .dot:nth-child(3) { background: #28c840; }
.contact-translate-title {
  margin-inline-start: 0.4rem;
  color: var(--fg-muted);
  font-size: 0.8rem;
}
.mail-preview {
  display: flex;
  flex-direction: column;
  min-height: 20rem;
  padding: 1rem 1.2rem;
  gap: 0;
  font-size: 0.88rem;
}
.mail-cmd {
  line-height: 1.6;
  margin-bottom: 0.35rem;
  word-break: break-all;
}
.mail-prompt { color: var(--accent); margin-right: 0.4em; }
.mail-hline {
  color: var(--fg-muted);
  line-height: 1.6;
  word-break: break-all;
}
.mail-hkey {
  color: var(--fg-dim);
  margin-right: 0.4em;
}
.mail-sep {
  border-top: 1px solid var(--rule);
  margin: 0.6rem 0;
}
.mail-body {
  flex: 1;
  padding-bottom: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  color: var(--fg);
}
.mail-eot {
  color: var(--fg-dim);
}
.mail-preview .is-placeholder { color: var(--fg-dim); }
.mail-preview .is-translating {
  color: var(--fg-dim);
  animation: blink 1.05s steps(2, end) infinite;
}
.wpcf7 .wpcf7-form {
  display: grid;
  gap: 1.2rem;
}
.wpcf7 label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
}
.wpcf7 .required { color: var(--accent-3); margin-left: 2px; }
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 select,
.wpcf7 textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  color: var(--fg);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.wpcf7 select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem;
}
.wpcf7 input:focus,
.wpcf7 select:focus,
.wpcf7 textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.wpcf7 textarea { min-height: 9rem; resize: vertical; }
.wpcf7 input[type="submit"] {
  width: auto;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.6rem 1.8rem;
  font-weight: 700;
  border-radius: 0 0 var(--radius) 0;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.02em;
}
.wpcf7 input[type="submit"]:hover { opacity: 0.82; }
.wpcf7 .wpcf7-not-valid-tip {
  color: var(--accent-3);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}
.wpcf7 .wpcf7-response-output {
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid var(--rule);
}
.wpcf7 .wpcf7-mail-sent-ok {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.wpcf7 .wpcf7-mail-sent-ng,
.wpcf7 .wpcf7-validation-errors {
  border-color: var(--accent-3);
  color: var(--accent-3);
  background: color-mix(in srgb, var(--accent-3) 8%, transparent);
}
.contact-back {
  margin-top: 2rem;
  font-size: 0.9rem;
}
.contact-back a { color: var(--fg-muted); }
.contact-back a:hover { color: var(--fg); }

/* ============================================================
   Quote-reply — trigger button + floating panel
   ============================================================ */

/* Trigger button (appears above selection) */
.quote-sel-btn {
  position: fixed;
  z-index: 300;
  font: 0.75rem/1 var(--font-mono);
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  transition: background 0.1s, color 0.1s;
  display: none;
}
.quote-sel-btn:hover,
.quote-sel-btn:focus-visible {
  background: var(--accent);
  color: var(--bg);
  outline: none;
}
.quote-sel-btn::before { content: '> '; opacity: 0.6; }

/* Floating comment panel */
.quote-panel {
  position: fixed;
  z-index: 310;
  width: min(420px, calc(100vw - 16px));
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.45);
  padding: 0.75rem 0.9rem 0.6rem;
  display: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.quote-panel-quote {
  color: var(--fg-muted);
  border-left: 3px solid var(--accent);
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.quote-panel-quote::before { content: '> '; opacity: 0.6; }
.quote-panel-input-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.quote-panel-prompt {
  color: var(--accent);
  line-height: 1.6;
  flex-shrink: 0;
  user-select: none;
}
.quote-panel-ta {
  flex: 1;
  font: inherit;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  color: var(--fg);
  resize: none;
  outline: none;
  min-height: 1.6em;
  line-height: 1.6;
  padding: 0;
  overflow: hidden;
}
.quote-panel-ta:focus { border-bottom-color: var(--accent); }
.quote-panel-send {
  flex-shrink: 0;
  font: 0.85rem var(--font-mono);
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg-muted);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1.5;
  transition: border-color 0.1s, color 0.1s;
}
.quote-panel-send:hover,
.quote-panel-send:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.quote-panel-send:disabled { opacity: 0.4; cursor: default; }
.quote-panel-hint {
  color: var(--fg-dim);
  font-size: 0.7rem;
  margin-top: 0.45rem;
  user-select: none;
}
.quote-panel-msg {
  font-size: 0.78rem;
  margin-top: 0.35rem;
  min-height: 1em;
}
.quote-panel-msg.is-ok  { color: var(--accent); }
.quote-panel-msg.is-err { color: var(--accent-3, #e06c75); }

/* Quote block inside a comment (rendered from > lines) */
.comment-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0.75rem;
  color: var(--fg-muted);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elev));
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem;
  margin: 0 0 0.6rem;
}
.comment-body blockquote p { margin: 0; }

/* ============================================================
   Inline comment anchors — highlight quoted passage in article
   ============================================================ */
mark.quote-anchor {
  /* inset box-shadow = left accent bar that works on wrapped inline text */
  box-shadow: inset 3px 0 0 var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: inherit;
  border-radius: 0 2px 2px 0;
  cursor: pointer;
  outline: none;
  padding-left: 4px;
  border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
mark.quote-anchor:hover,
mark.quote-anchor:focus-visible {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border-bottom-color: var(--accent);
}

/* "// N" badge — terminal comment style */
.quote-badge {
  font: 600 0.68rem/1 var(--font-mono);
  color: var(--accent);
  margin-inline-start: 0.3em;
  vertical-align: super;
  font-size: 0.65em;
  user-select: none;
  white-space: nowrap;
}
.quote-badge::before { content: '// '; opacity: 0.55; }

/* ============================================================
   Quote popover
   ============================================================ */
.quote-popover {
  position: fixed;
  z-index: 400;
  width: min(340px, calc(100vw - 16px));
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 6px 28px rgba(0,0,0,.45);
  padding: 0.75rem 0.9rem 0.65rem;
  display: none;
  font-size: 0.84rem;
}
/* Arrow pointing up toward highlighted text */
.quote-popover::before {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top: none;
  border-bottom-color: var(--rule);
  pointer-events: none;
}
.quote-popover.is-above::before {
  top: auto;
  bottom: -7px;
  border-top-color: var(--rule);
  border-bottom: none;
}
.qp-meta {
  font: 0.72rem var(--font-mono);
  color: var(--fg-dim);
  margin-bottom: 0.4rem;
}
.qp-body {
  color: var(--fg);
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.qp-sep {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0.6rem 0;
}

/* Matrix overlay styles → assets/css/matrix.css (loaded conditionally by enqueue.php) */

/* =========================================================
   Blog archive — card stagger-in after typewriter finishes
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  /* Cards start hidden; JS adds .is-visible to the grid after typewriter ends */
  [data-blog-grid] .card {
    opacity: 0;
    translate: 0 10px;
  }
  @keyframes card-in {
    from { opacity: 0; translate: 0 10px; }
    to   { opacity: 1; translate: 0 0;    }
  }
  [data-blog-grid].is-visible .card {
    animation: card-in 0.4s ease both;
  }
  /* Stagger each card — covers up to 10 cards per page */
  [data-blog-grid].is-visible .card:nth-child(1)  { animation-delay: 0.00s; }
  [data-blog-grid].is-visible .card:nth-child(2)  { animation-delay: 0.10s; }
  [data-blog-grid].is-visible .card:nth-child(3)  { animation-delay: 0.20s; }
  [data-blog-grid].is-visible .card:nth-child(4)  { animation-delay: 0.30s; }
  [data-blog-grid].is-visible .card:nth-child(5)  { animation-delay: 0.40s; }
  [data-blog-grid].is-visible .card:nth-child(6)  { animation-delay: 0.50s; }
  [data-blog-grid].is-visible .card:nth-child(7)  { animation-delay: 0.60s; }
  [data-blog-grid].is-visible .card:nth-child(8)  { animation-delay: 0.70s; }
  [data-blog-grid].is-visible .card:nth-child(9)  { animation-delay: 0.80s; }
  [data-blog-grid].is-visible .card:nth-child(10) { animation-delay: 0.90s; }
}
/* prefers-reduced-motion: show all cards immediately without animation */
@media (prefers-reduced-motion: reduce) {
  [data-blog-grid] .card { opacity: 1; translate: none; }
}
