/*
Theme Name: Silent Archive
Theme URI: https://example.com/silent-archive
Author: Eiji Custom
Author URI: https://example.com
Description: A quiet, minimal WordPress theme for writing. No sidebar, no noise, no decoration unless you add it.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.5
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: silent-archive
Tags: blog, one-column, custom-colors, custom-logo, editor-style
*/

/* ==========================================================
   Silent Archive
   Change these variables first when you want to customize.
   ========================================================== */

:root {
  --sa-bg: #fbfaf7;
  --sa-paper: #fbfaf7;
  --sa-text: #242424;
  --sa-muted: #77716a;
  --sa-border: #e7e0d6;
  --sa-accent: #76685b;

  --sa-font-body: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Meiryo", sans-serif;
  --sa-font-serif: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Noto Serif JP", serif;

  --sa-site-width: 720px;
  --sa-home-width: 1040px;
  --sa-wide-width: 920px;

  --sa-font-size: 17px;
  --sa-line-height: 2.05;
  --sa-letter-spacing: 0.02em;

  --sa-space-xs: 0.5rem;
  --sa-space-sm: 0.85rem;
  --sa-space-md: 1.4rem;
  --sa-space-lg: 2.4rem;
  --sa-space-xl: 4rem;
}

/* ==========================================================
   Reset / Base
   ========================================================== */

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

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

body {
  margin: 0;
  background: var(--sa-bg);
  color: var(--sa-text);
  font-family: var(--sa-font-body);
  font-size: var(--sa-font-size);
  line-height: var(--sa-line-height);
  letter-spacing: var(--sa-letter-spacing);
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

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

::selection {
  background: color-mix(in srgb, var(--sa-accent) 20%, transparent);
}

/* ==========================================================
   Layout
   ========================================================== */

.sa-site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sa-container {
  width: min(calc(100% - 2rem), var(--sa-site-width));
  margin-inline: auto;
}

/* Top page can be wider than article pages. */
body.home .sa-container,
body.blog .sa-container {
  width: min(calc(100% - 2rem), var(--sa-home-width));
}

.sa-header {
  padding: 3.2rem 0 1.8rem;
}

.sa-header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--sa-border);
  padding-bottom: 1.2rem;
}

.sa-branding {
  min-width: 0;
}

.sa-logo {
  display: inline-block;
  margin-bottom: 0.4rem;
}

.sa-site-title {
  margin: 0;
  font-family: var(--sa-font-serif);
  font-weight: 500;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.35;
  letter-spacing: 0.06em;
}

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

.sa-site-description {
  margin: 0.25rem 0 0;
  color: var(--sa-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.sa-main {
  flex: 1;
  padding: 2.4rem 0 4rem;
}

.sa-footer {
  padding: 2.5rem 0 3.5rem;
  color: var(--sa-muted);
  font-size: 0.82rem;
}

.sa-footer-inner {
  border-top: 1px solid var(--sa-border);
  padding-top: 1.4rem;
}

/* ==========================================================
   Navigation
   ========================================================== */

.sa-nav {
  font-size: 0.88rem;
  color: var(--sa-muted);
  white-space: nowrap;
}

.sa-menu {
  display: flex;
  gap: 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sa-menu a {
  text-decoration: none;
}

.sa-menu a:hover {
  text-decoration: underline;
}

/* ==========================================================
   Article List
   ========================================================== */

.sa-archive-title {
  margin: 0 0 2.2rem;
  font-family: var(--sa-font-serif);
  font-weight: 500;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  line-height: 1.5;
}

.sa-post-list {
  display: grid;
  gap: 2.4rem;
}

.sa-post-card {
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--sa-border);
}

.sa-post-card:last-child {
  border-bottom: 0;
}

.sa-post-title {
  margin: 0;
  font-family: var(--sa-font-serif);
  font-weight: 500;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.55;
}

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

.sa-post-title a:hover {
  text-decoration: underline;
}

.sa-post-meta {
  margin-top: 0.55rem;
  color: var(--sa-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.sa-post-excerpt {
  margin-top: 1.05rem;
  color: color-mix(in srgb, var(--sa-text) 84%, var(--sa-muted));
  max-width: 760px;
}

.sa-post-excerpt p {
  margin: 0;
}

.sa-read-more {
  display: inline-block;
  margin-top: 0.9rem;
  color: var(--sa-muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.sa-read-more:hover {
  color: var(--sa-accent);
  text-decoration: underline;
}

/* ==========================================================
   Single / Page
   ========================================================== */

.sa-entry-header {
  margin-bottom: 2.6rem;
}

.sa-entry-title {
  margin: 0;
  font-family: var(--sa-font-serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 5vw, 2.55rem);
  line-height: 1.48;
  letter-spacing: 0.04em;
}

.sa-entry-meta {
  margin-top: 0.85rem;
  color: var(--sa-muted);
  font-size: 0.84rem;
}

.sa-entry-content {
  overflow-wrap: break-word;
}

.sa-entry-content > *:first-child {
  margin-top: 0;
}

.sa-entry-content p {
  margin: 0 0 1.65em;
}

.sa-entry-content h2,
.sa-entry-content h3,
.sa-entry-content h4 {
  font-family: var(--sa-font-serif);
  font-weight: 500;
  line-height: 1.55;
  margin: 2.4em 0 0.8em;
}

.sa-entry-content h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  padding-top: 0.4rem;
  border-top: 1px solid var(--sa-border);
}

.sa-entry-content h3 {
  font-size: clamp(1.18rem, 2.4vw, 1.42rem);
}

.sa-entry-content h4 {
  font-size: 1.05rem;
}

.sa-entry-content ul,
.sa-entry-content ol {
  margin: 0 0 1.6em 1.3em;
  padding: 0;
}

.sa-entry-content li + li {
  margin-top: 0.4em;
}

.sa-entry-content blockquote {
  margin: 2rem 0;
  padding: 0.2rem 0 0.2rem 1.4rem;
  border-left: 2px solid var(--sa-accent);
  color: color-mix(in srgb, var(--sa-text) 78%, var(--sa-muted));
  font-family: var(--sa-font-serif);
}

.sa-entry-content pre {
  overflow-x: auto;
  padding: 1.2rem;
  border: 1px solid var(--sa-border);
  background: color-mix(in srgb, var(--sa-text) 4%, transparent);
  line-height: 1.65;
}

.sa-entry-content code {
  font-size: 0.92em;
}

.sa-entry-content hr {
  border: 0;
  border-top: 1px solid var(--sa-border);
  margin: 2.5rem 0;
}

.sa-entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.92rem;
}

.sa-entry-content th,
.sa-entry-content td {
  border-bottom: 1px solid var(--sa-border);
  padding: 0.75rem 0.4rem;
  text-align: left;
}

.sa-entry-content .alignwide {
  width: min(var(--sa-wide-width), calc(100vw - 2rem));
  max-width: min(var(--sa-wide-width), calc(100vw - 2rem));
  margin-left: 50%;
  transform: translateX(-50%);
}

.sa-entry-content .alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* ==========================================================
   Post Navigation / Pagination
   ========================================================== */

.sa-post-nav,
.sa-pagination {
  margin-top: 3.2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sa-border);
  color: var(--sa-muted);
  font-size: 0.88rem;
}

.sa-post-nav-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.sa-post-nav a,
.sa-pagination a {
  color: inherit;
  text-decoration: none;
}

.sa-post-nav a:hover,
.sa-pagination a:hover {
  color: var(--sa-accent);
  text-decoration: underline;
}

.sa-pagination .nav-links {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.sa-pagination .page-numbers.current {
  color: var(--sa-text);
}

/* ==========================================================
   Empty / 404
   ========================================================== */

.sa-empty {
  color: var(--sa-muted);
}

.sa-search-form {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.6rem;
}

.sa-search-form input[type="search"] {
  width: 100%;
  border: 1px solid var(--sa-border);
  background: transparent;
  color: var(--sa-text);
  padding: 0.72rem 0.8rem;
  font: inherit;
}

.sa-search-form button {
  border: 1px solid var(--sa-border);
  background: transparent;
  color: var(--sa-text);
  padding: 0.72rem 1rem;
  font: inherit;
  cursor: pointer;
}

.sa-search-form button:hover {
  border-color: var(--sa-accent);
  color: var(--sa-accent);
}

/* ==========================================================
   WordPress Core
   ========================================================== */

.wp-caption {
  max-width: 100%;
}

.wp-caption-text,
.gallery-caption {
  color: var(--sa-muted);
  font-size: 0.82rem;
  line-height: 1.6;
  margin-top: 0.5rem;
}

.sticky {
  /* Required WordPress class. */
}

.bypostauthor {
  /* Required WordPress class. */
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.alignleft {
  float: left;
  margin: 0.4rem 1.4rem 1rem 0;
}

.alignright {
  float: right;
  margin: 0.4rem 0 1rem 1.4rem;
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 720px) {
  :root {
    --sa-font-size: 16px;
    --sa-line-height: 1.95;
  }

  .sa-header {
    padding-top: 2.1rem;
  }

  .sa-header-inner {
    display: block;
  }

  .sa-nav {
    margin-top: 1rem;
    white-space: normal;
  }

  .sa-menu {
    flex-wrap: wrap;
    gap: 0.7rem 1rem;
  }

  .sa-main {
    padding-top: 1.9rem;
  }

  .sa-post-nav-links {
    display: grid;
    gap: 0.8rem;
  }
}

@media print {
  .sa-nav,
  .sa-footer,
  .sa-post-nav,
  .sa-pagination {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .sa-container {
    width: 100%;
  }
}
