/* ============================================================
   Gwisin — A minimalist Hugo theme
   Light: warm gray  |  Dark: near-black
   ============================================================ */

/* --- Custom Properties --- */

:root {
  --bg:          #f6f5f3;
  --bg-alt:      #eeedea;
  --text:        #1a1917;
  --text-muted:  #706e69;
  --accent:      #555250;
  --accent-soft: #807d7a;
  --border:      #d8d6d2;
  --code-bg:     #eceae6;
  --shadow:      rgba(26, 25, 23, 0.07);

  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --width:    660px;
  --radius:   3px;
  --leading:  1.75;
}

[data-theme="dark"] {
  --bg:          #111110;
  --bg-alt:      #1c1b1a;
  --text:        #e6e4e1;
  --text-muted:  #908e8a;
  --accent:      #b0aeaa;
  --accent-soft: #c8c6c2;
  --border:      #2e2d2b;
  --code-bg:     #181716;
  --shadow:      rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #111110;
    --bg-alt:      #1c1b1a;
    --text:        #e6e4e1;
    --text-muted:  #908e8a;
    --accent:      #b0aeaa;
    --accent-soft: #c8c6c2;
    --border:      #2e2d2b;
    --code-bg:     #181716;
    --shadow:      rgba(0, 0, 0, 0.4);
  }
}

/* --- Reset --- */

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

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: var(--leading);
  margin: 0;
  padding: 0;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */

.container {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Site Header --- */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0 1rem;
}

.site-header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.site-title:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
}

/* --- Theme Toggle --- */

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font-body);
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Main Content --- */

main {
  padding: 2.5rem 0 3rem;
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* --- Typography --- */

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.6rem;
}

h1 { font-size: 1.75rem; margin-top: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem;  }
h4 { font-size: 1rem; font-weight: 600; }

p {
  margin: 0 0 1.1rem;
}

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

a:hover {
  color: var(--accent-soft);
}

strong { font-weight: 600; }
em     { font-style: italic; }

/* --- Article Header --- */

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

.article-header h1 {
  margin-bottom: 0.35rem;
}

.article-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 0;
}

/* --- Post List --- */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list-item:last-child {
  border-bottom: none;
}

.post-list-item h2 {
  font-size: 1.05rem;
  margin: 0 0 0.2rem;
}

.post-list-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-list-item h2 a:hover {
  color: var(--accent);
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: block;
}

.post-summary {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

.post-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
  line-height: 1.45;
}

/* --- Home Intro --- */

.home-intro {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.home-intro h1 {
  font-size: 1.5rem;
}

/* --- Section / Taxonomy --- */

.page-title {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.page-description {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* --- Tags --- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.tag {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.15rem 0.5rem;
}

.tag a {
  color: var(--text-muted);
  text-decoration: none;
}

.tag a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.tag-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

/* --- Code --- */

code {
  background: var(--code-bg);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.15em 0.35em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  overflow-x: auto;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* --- Blockquote --- */

blockquote {
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* --- Tables --- */

table {
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1.5rem 0;
  width: 100%;
}

th {
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
}

tr:last-child td {
  border-bottom: none;
}

/* --- Lists --- */

ul, ol {
  margin: 0.5rem 0 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.25rem;
}

/* --- Horizontal Rule --- */

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

/* --- Images --- */

img {
  border-radius: var(--radius);
  height: auto;
  max-width: 100%;
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* --- Taxonomy List (tag term page) --- */

.term-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.term-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

.term-list li:last-child {
  border-bottom: none;
}

.term-list a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.97rem;
}

.term-list a:hover {
  color: var(--accent);
}

.term-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Pagination --- */

.pagination {
  display: flex;
  gap: 0.5rem;
  margin-top: 2.5rem;
  font-size: 0.85rem;
}

.pagination a,
.pagination span {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  text-decoration: none;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .current {
  background: var(--bg-alt);
  color: var(--text);
}

/* --- Gallery Grid --- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.gallery-item {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-alt);
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  transition: opacity 0.2s ease;
}

.gallery-item img:hover {
  opacity: 0.9;
}

.gallery-item figcaption {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
}

/* --- Lightbox --- */

#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

#lightbox.active {
  display: flex;
}

#lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  cursor: default;
}

/* --- Responsive --- */

@media (max-width: 720px) {
  html { font-size: 16px; }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-nav {
    gap: 1rem;
  }
}
