/* ============================================================
   CSS VARIABLES — edit to restyle everything
   ============================================================ */
:root {
  --bg:           #0d0c0e;
  --bg-panel:     #111013;
  --bg-hover:     #18161b;
  --border:       #2a2730;
  --border-dim:   #1e1c22;
  --text:         #ccc8c0;
  --text-muted:   #eef6b8;
  --text-dim:     #867d99;
  --accent:       #b4be79;    
  --accent-glow:  rgba(139,111,158,0.12);
  --accent-dim:   rgba(139,111,158,0.04);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'Fragment Mono', monospace;

  --col-side:     190px;
  --col-gap:      0px;
  --max-w:        1040px;
  --radius:       2px;
  --ease:         0.2s ease;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.75;
  min-height: 100vh;
  /* subtle noise grain overlay */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

u {
text-decoration-line: underline;
text-decoration-style: wavy;
}

/* ============================================================
   WRAPPER
   ============================================================ */
.wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 28px 24px 24px;
  display: flex;
  align-items: baseline;
  gap: 20px;
  animation: fadeIn 0.6s ease both;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--text);
}

.site-title em {
  color: var(--accent);
  font-style: normal;
}

.site-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-bottom: 2px;
}

/* ============================================================
   THREE-COLUMN LAYOUT
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: var(--col-side) 1fr var(--col-side);
  min-height: 0;
}

/* ============================================================
   SIDEBARS — shared
   ============================================================ */
.sidebar {
  border-right: 1px solid var(--border-dim);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--border-dim);
}

.sidebar-section-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* ============================================================
   NAV LINKS
   ============================================================ */
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-list li a,
.nav-list li button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 5px 8px;
  border-radius: var(--radius);
  transition: color var(--ease), background var(--ease);
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.nav-list li a:hover,
.nav-list li button:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-list li a.active,
.nav-list li button.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-list li a.active::before,
.nav-list li button.active::before {
  content: '▸ ';
  font-size: 0.6rem;
}

/* external link marker */
.nav-list .ext::after {
  content: ' ↗';
  font-size: 0.6rem;
  opacity: 0.5;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  display: flex;
  flex-direction: column;
  border-left: none;
  min-height: 0;
  animation: fadeIn 0.5s 0.1s ease both;
}

/* top bar inside main */
.main-topbar {
  border-bottom: 1px solid var(--border-dim);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  background: var(--bg-panel);
}

.main-breadcrumb {
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-breadcrumb span {
  color: var(--accent);
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
  white-space: nowrap;
  display: none;
}

.back-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.back-btn.visible { display: block; }

/* ============================================================
   RSS VIEW
   ============================================================ */
#rss-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 40px;
}

#rss-view.hidden { display: none; }

.rss-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.rss-heading {
 font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--text);
}

.rss-heading  em {
  color: var(--accent);
  font-style: normal;
}

.rss-count {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ============================================================
   STATES
   ============================================================ */
.state-msg {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 40px 0;
  text-align: center;
}

.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(3, end) infinite;
}

@keyframes dots {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
  100% { content: ''; }
}

/* ============================================================
   FEED ENTRIES
   ============================================================ */
.post-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feed-entry {
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border-dim);
  animation: fadeIn 0.4s ease both;
}

.feed-entry:first-child { border-top: 1px solid var(--border-dim); }

.feed-entry-header {
  margin-bottom: 20px;
}

.feed-entry-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 6px;
}

.feed-entry-meta {
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.feed-entry-meta .tags {
  color: var(--accent);
  opacity: 0.7;
}

.feed-entry-body {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text);
}

.feed-entry-body p      { margin-bottom: 1.1em; }
.feed-entry-body p:last-child { margin-bottom: 0; }
.feed-entry-body h1,
.feed-entry-body h2,
.feed-entry-body h3     { font-family: var(--font-display); font-weight: 400; font-style: italic; color: var(--text); margin: 1.4em 0 0.5em; }
.feed-entry-body h1     { font-size: 1.3rem; }
.feed-entry-body h2     { font-size: 1.1rem; }
.feed-entry-body h3     { font-size: 1rem; }
.feed-entry-body a      { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; opacity: 0.85; }
.feed-entry-body a:hover{ opacity: 1; }
.feed-entry-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
  margin: 1.2em 0;
  color: var(--text-muted);
  font-style: italic;
}
.feed-entry-body code   { font-family: var(--font-mono); font-size: 0.78em; background: var(--bg-panel); padding: 2px 6px; border-radius: 2px; color: var(--accent); }
.feed-entry-body pre    { background: var(--bg-panel); border: 1px solid var(--border-dim); border-radius: var(--radius); padding: 14px; overflow-x: auto; margin: 1em 0; }
.feed-entry-body pre code { background: none; padding: 0; }
.feed-entry-body img    { max-width: 100%; border-radius: var(--radius); margin: 1em 0; }
.feed-entry-body ul,
.feed-entry-body ol     { padding-left: 1.4em; margin-bottom: 1em; }
.feed-entry-body li     { margin-bottom: 0.25em; }
.feed-entry-body hr     { border: none; border-top: 1px solid var(--border-dim); margin: 1.6em 0; }

.feed-entry-permalink {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  transition: color var(--ease);
}
.feed-entry-permalink:hover { color: var(--accent); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border-dim);
  margin-top: 8px;
  gap: 12px;
}

.pagination:empty { display: none; }

.page-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 5px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}

.page-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

.page-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.page-info {
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ============================================================
   IFRAME VIEW
   ============================================================ */
#iframe-view {
  flex: 1;
  display: none;
  flex-direction: column;
}

#iframe-view.visible {
  display: flex;
}

#embed-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 500px;
}

/* ============================================================
   RIGHT SIDEBAR
   ============================================================ */
.about-blurb {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.about-blurb p + p { margin-top: 10px; }

.divider {
  border: none;
  border-top: 1px solid var(--border-dim);
  margin: 4px 0;
}

.glyph-block {
  font-size: 1.4rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  font-family: var(--font-display);
  font-style: italic;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-dim);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  animation: fadeIn 0.6s 0.2s ease both;
}

.site-footer a { color: var(--accent); transition: opacity var(--ease); }
.site-footer a:hover { opacity: 0.7; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border-dim); flex-direction: row; flex-wrap: wrap; padding: 16px; gap: 20px; }
  .sidebar-right { border-left: none; border-top: 1px solid var(--border-dim); }
  #embed-frame { min-height: 60vh; }
}