@charset "UTF-8";
@import "reset.css";
@import "variables.css";

/* --- Global & Base Layout (Clean White Background) --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll; /* ページ遷移時のスクロールバー有無による横幅ガタつきを完全に防止 */
}

html, body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans JP', var(--font-main);
  background-color: #ffffff;
  color: var(--color-text);
  line-height: 1.6;
}

::selection {
  background-color: var(--color-accent);
  color: #ffffff;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

/* --- Header / Breadcrumbs (OS Window Titlebar Style) --- */
.header {
  background-color: var(--color-accent);
  border-bottom: 2px solid #cbd5e1;
  padding: 8px 0;
  z-index: 100;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: #ffffff;
}

.breadcrumb-item {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: opacity 0.2s ease;
}

a.breadcrumb-item:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.breadcrumb-sep {
  color: rgba(255, 255, 255, 0.7);
}

/* --- Main Page Container --- */
.main-container {
  padding: 3rem 0;
}

/* --- Hero / Profile Card --- */
.hero-section {
  margin-bottom: 3rem;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.profile-image-wrapper {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid var(--color-accent);
  padding: 3px;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.08);
}

.profile-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-name {
  font-family: var(--font-main);
  font-size: 1.75rem;
  color: #1f2937;
}

/* --- Retro OS Style Card Section (Clean Flat Titlebars) --- */
.retro-card {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 2.5rem;
  overflow: hidden;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.12);
}

/* Retro OS Card Titlebar */
.card-titlebar {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background-color: var(--color-accent);
  border-bottom: 1px solid #cbd5e1;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  user-select: none;
}

.card-title {
  font-family: var(--font-main);
  letter-spacing: 0.5px;
}

/* Card Content Body */
.card-body {
  padding: 1.5rem;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.8;
  text-align: left;
}

/* Collapsed state when _ or x is clicked */
.retro-card.collapsed .card-body {
  display: none;
}

/* --- Blog Section --- */
.blog-desc {
  margin-bottom: 1rem;
}

.blog-action {
  display: flex;
  justify-content: flex-start;
  max-width: 180px;
}

/* --- Learning Section Grid --- */
.learning-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.learning-item {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 1.25rem;
}

.learning-item h4 {
  font-family: var(--font-main);
  color: var(--color-accent);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.learning-item p {
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.6;
}

/* --- Links Section Grid --- */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--color-text);
  text-decoration: none;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.08);
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 1;
  transition: color 0.28s ease, border-color 0.28s ease;
}

.link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 300%;
  height: 350%;
  background-color: var(--color-accent);
  z-index: -1;
  transform: rotate(-25deg) translateY(-180%);
  transition: transform 1.25s cubic-bezier(0.05, 0.95, 0.15, 1);
}

.link-card:hover::before {
  transform: rotate(-25deg) translateY(-65%);
}

.link-card:hover {
  color: #ffffff;
  border-color: var(--color-accent);
}

.link-card svg {
  transition: stroke 0.28s ease;
}

.link-card:hover svg {
  stroke: #ffffff;
}

/* --- Interactive VS Code Style Terminal Card --- */
.terminal-card {
  background-color: #1e1e1e;
  border-color: #334155;
}

.terminal-body {
  background-color: #1e1e1e;
  color: #cccccc;
  font-family: var(--font-mono);
  padding: 1rem 1.25rem;
  height: 320px;
  font-size: 0.9rem;
  line-height: 1.3;
  letter-spacing: 0.2px;
  display: flex;
  flex-direction: column;
  cursor: text;
  box-sizing: border-box;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Terminal Color Theme (Light Mode Option) */
.terminal-body.theme-light {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
.terminal-body.theme-light .terminal-prompt {
  color: #608a8a !important;
}
.terminal-body.theme-light .terminal-inline-input {
  color: #0f172a !important;
}

.terminal-card {
  cursor: text;
}

.terminal-output {
  flex: 1;
  width: 100%;
  height: 100%;
  cursor: text;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.terminal-output::-webkit-scrollbar {
  display: none;
}

.terminal-line {
  margin-bottom: 4px;
  min-height: 1.3em;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}

.terminal-prompt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 4px;
  min-height: 1.3em;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.terminal-prompt {
  color: #3dc9b0;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal-inline-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #d4d4d4;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.terminal-success {
  color: #4ec9b0;
}

.terminal-warn {
  color: #ce9178;
}

.terminal-info {
  color: #569cd6;
}

/* --- Footer (Original Footer Reverted) --- */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-family: var(--font-main);
  background-color: #ffffff;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .profile-image-wrapper {
    width: 120px;
    height: 120px;
  }

  .profile-name {
    font-size: 1.4rem;
  }

  .card-body {
    padding: 1.25rem;
  }

  .terminal-body {
    height: 280px;
    padding: 1rem;
    font-size: 0.78rem;
  }

  .terminal-inline-input {
    font-size: 0.78rem;
  }
}

/* --- Note Posts List & Cards (Homepage & All-Notes Page) --- */
.note-posts-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.note-post-card {
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.note-post-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 14px rgba(96, 138, 138, 0.15);
}

@media (min-width: 640px) {
  .note-post-card.has-image {
    flex-direction: row;
    align-items: stretch;
  }
}

.note-post-image {
  width: 100%;
  height: 180px;
  overflow: hidden;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .note-post-card.has-image .note-post-image {
    width: 240px;
    height: auto;
    min-height: 140px;
  }
}

.note-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.note-post-card:hover .note-post-image img {
  transform: scale(1.05);
}

.note-post-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.note-post-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.note-post-date {
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

.note-post-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  line-height: 1.4;
  margin: 0;
}



/* --- Article Details & Markdown Content --- */
.article-card {
  margin-bottom: 2rem;
}

.article-hero-image {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #cbd5e1;
}

.article-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-header {
  text-align: center;
  margin-bottom: 2rem;
}

.article-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 0.5rem;
  line-height: 1.4;
  text-align: center;
  color: var(--color-text);
}

.article-separator {
  height: 1px;
  background-color: #cbd5e1;
  margin: 2rem 0;
}

.article-content hr {
  border: none;
  border-top: 1px solid #cbd5e1;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.article-content {
  line-height: 1.8;
  font-size: 1rem;
  color: var(--color-text);
}

.article-content > *:first-child {
  margin-top: 0 !important;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  text-align: center;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.article-content h1 {
  font-size: 1.75rem;
}

.article-content h2 {
  font-size: 1.5rem;
}

.article-content h3 {
  font-size: 1.25rem;
}

.article-content h4 {
  font-size: 1.1rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

/* Links inside article */
.article-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: opacity 0.2s ease;
}

.article-content a:hover {
  opacity: 0.7;
}

/* Lists & Tasklist Checkboxes */
.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content ul li input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--color-accent);
  cursor: default;
  vertical-align: middle;
  pointer-events: none;
}

.article-content li:has(input[type="checkbox"]) {
  list-style-type: none;
  margin-left: -1.2rem;
}

/* Images in article content */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 2rem auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #cbd5e1;
}

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}

.article-content th,
.article-content td {
  border: 1px solid #cbd5e1;
  padding: 0.75rem 1rem;
}

.article-content th {
  background-color: #f1f5f9;
  font-weight: 700;
}

/* Blockquotes */
.article-content blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 1rem 1.5rem;
  background-color: #f8fafc;
  margin: 2rem 0;
  font-style: italic;
  color: #64748b;
  border-radius: 0 4px 4px 0;
}

/* Code Blocks & Inline Code */
:not(pre) > code {
  background-color: #f0f2f2;
  color: var(--color-accent);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  margin: 0 0.2rem;
  border: 1px solid #cbd5e1;
  font-family: var(--font-mono) !important;
  font-weight: 400 !important;
}

pre {
  position: relative;
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.3;
  border: 1px solid #334155;
}

pre code {
  font-family: var(--font-mono) !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  color: inherit !important;
}

/* Universal Copy Button (Code Blocks & KaTeX Blocks) */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 26px !important;
  padding: 0 10px !important;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-family: var(--font-main) !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  color: #475569;
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  user-select: none;
  z-index: 10;
  box-sizing: border-box !important;
}

.copy-btn svg {
  width: 13px !important;
  height: 13px !important;
  flex-shrink: 0;
  display: block;
}

.copy-btn span {
  font-family: var(--font-main) !important;
  font-size: 0.75rem !important;
  line-height: 1 !important;
  display: inline-block;
}

/* Dark theme variation for pre code blocks (#1e1e1e background) */
pre .copy-btn {
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #d4d4d4;
  box-shadow: none;
}

pre:hover .copy-btn,
.katex-block-wrapper:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background-color: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: #ffffff !important;
}

.copy-btn.copied {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

/* GitHub Gist Embeds */
.gist {
  margin: 2rem 0;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.gist .blob-code,
.gist .blob-code-inner,
.gist .blob-num,
.gist table,
.gist td {
  font-family: var(--font-mono) !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
}

.gist .gist-file {
  border: none !important;
  margin: 0 !important;
}

.gist .gist-data {
  background-color: #fcfcfc !important;
  border-bottom: 1px solid #cbd5e1 !important;
  font-family: var(--font-mono) !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
}

.gist .gist-meta {
  background-color: #f8fafc !important;
  font-family: var(--font-main) !important;
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  padding: 0.5rem 1rem !important;
  color: #64748b !important;
}

.gist .gist-meta a {
  color: var(--color-accent) !important;
}

/* Footnotes */
.article-content sup {
  top: -0.5em;
  margin-left: 0.2rem;
}

.article-content sup a {
  text-decoration: none;
  font-size: 0.8rem;
  color: var(--color-accent);
}

.article-content sup a::before { content: "["; }
.article-content sup a::after { content: "]"; }

.footnote-definition {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  color: #64748b;
}

.footnote-definition-label {
  position: static;
  font-size: 0.9rem;
  color: var(--color-accent);
  font-weight: 600;
}

.footnote-definition-label::before { content: "["; }
.footnote-definition-label::after { content: "]"; }

.footnote-definition p {
  display: inline;
  margin: 0;
}

.footnote-definition:first-of-type {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #cbd5e1;
}

/* KaTeX Math Styling */
.katex-display {
  font-size: 1.25em;
  margin: 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
}

.katex {
  font-size: 1.05em;
}

/* --- KaTeX Interactive In-Place Grid-Overlay Code Block & Copy Feature --- */
.katex-block-wrapper {
  position: relative;
  margin: 2rem 0;
  min-height: 48px;
  background-color: transparent;
  border: none;
  padding: 0.75rem 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  user-select: none;
}

.katex-block-wrapper:hover {
  background-color: transparent;
  box-shadow: none;
}

/* Both Math & Code occupy the exact same Grid Cell (grid-area: 1 / 1) - Zero Jittering */
.katex-block-wrapper .katex-display,
.katex-code-preview {
  grid-area: 1 / 1;
  width: 100%;
  margin: 0 !important;
}

/* Rendered Math (Visible by default, hidden on hover) */
.katex-block-wrapper .katex-display {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.katex-block-wrapper:hover .katex-display {
  opacity: 0;
  visibility: hidden;
}

/* Code block preview (Hidden by default, shown on hover in exact same spot!) */
.katex-code-preview {
  opacity: 0;
  visibility: hidden;
  text-align: center;
  font-family: var(--font-mono) !important;
  font-size: 0.95rem;
  font-weight: 400 !important;
  color: var(--color-text);
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.katex-code-preview code {
  color: var(--color-text);
  font-family: var(--font-mono) !important;
  font-weight: 400 !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

.katex-block-wrapper:hover .katex-code-preview {
  opacity: 1;
  visibility: visible;
}



/* Article Navigation (50/50 Grid Split) */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
  width: 100%;
}

.nav-prev, .nav-next {
  width: 100%;
  display: flex;
}

.article-nav .nav-item {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  text-decoration: none;
  box-sizing: border-box;
}

.nav-next .nav-item {
  align-items: flex-end;
  text-align: right;
}

.nav-direction {
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
  letter-spacing: 0.5px;
  transition: color 0.28s ease;
}

.link-card:hover .nav-direction {
  color: #ffffff;
}

.nav-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}
