/*
Theme Name: Debt Chronicle
Theme URI: https://debtchronicle.com
Author: Anonymous
Author URI: https://debtchronicle.com
Description: A raw, honest anonymous debt repayment journal with live currency conversion, creditor tracking, and daily journaling. Built with a warm craft-paper aesthetic.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: debt-chronicle
*/

/* ========== VARIABLES ========== */
:root {
  --paper: #f6f1e7;
  --paper-dark: #ede6d8;
  --paper-deeper: #ddd5c3;
  --paper-light: #faf7f0;
  --ink: #2b2218;
  --ink-light: #584e3e;
  --ink-faded: #8c806c;
  --red: #c0392b;
  --red-soft: #c0392b1a;
  --red-glow: #c0392b30;
  --green: #1e7a3e;
  --green-soft: #1e7a3e15;
  --amber: #d4a017;
  --amber-soft: #d4a01718;
  --blue: #2c5f8a;
  --blue-soft: #2c5f8a12;
  --tape: #f0e6c8cc;
  --shadow: #2b221810;
  --shadow-md: #2b221818;
  --font-hand: 'Caveat', cursive;
  --font-body: 'Lora', serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  overflow-x: hidden;
}

/* TEXTURE */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999;
}

/* ========== NAV ========== */
nav.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1.5px solid var(--paper-deeper);
  padding: 0.85rem 2.5rem;
  display: flex; justify-content: space-between; align-items: center;
  backdrop-filter: blur(12px);
}
nav.site-nav .logo { font-family: var(--font-hand); font-size: 1.6rem; font-weight: 700; color: var(--red); transform: rotate(-1deg); text-decoration: none; }
nav.site-nav .logo span { color: var(--ink); font-weight: 400; }
nav.site-nav .nav-links { display: flex; gap: 2rem; list-style: none; }
nav.site-nav .nav-links a {
  color: var(--ink-faded); text-decoration: none;
  font-family: var(--font-mono); font-size: 0.62rem;
  letter-spacing: 1.8px; text-transform: uppercase; transition: color 0.3s;
}
nav.site-nav .nav-links a:hover { color: var(--red); }
.hamburger { display: none; flex-direction: column; gap: 4px; cursor: pointer; background: none; border: none; padding: 5px; }
.hamburger span { width: 20px; height: 1.5px; background: var(--ink); }
@media (max-width: 640px) {
  .hamburger { display: flex; }
  nav.site-nav .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); border-bottom: 1.5px solid var(--paper-deeper); flex-direction: column; padding: 1.2rem 2rem; gap: 1rem; }
  nav.site-nav .nav-links.open { display: flex; }
  nav.site-nav { padding: 0.85rem 1.2rem; }
}

/* ========== HERO ========== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  padding: 7rem 2rem 4rem; position: relative;
  background: repeating-linear-gradient(transparent, transparent 31px, var(--paper-deeper) 31px, var(--paper-deeper) 32px);
}
.hero::before { content: ''; position: absolute; left: 80px; top: 0; bottom: 0; width: 1.5px; background: #d4a0a033; }
.hero-tape { background: var(--tape); display: inline-block; padding: 0.35rem 1.5rem; transform: rotate(-2deg); margin-bottom: 2rem; box-shadow: 0 1px 4px var(--shadow); }
.hero-tape span { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 3px; text-transform: uppercase; color: var(--ink-faded); }
.hero h1 { font-family: var(--font-hand); font-size: clamp(2.8rem, 8vw, 6.5rem); font-weight: 700; line-height: 1.08; margin-bottom: 0.5rem; }
.total-amount { font-family: var(--font-mono); font-size: clamp(2.5rem, 7vw, 5rem); font-weight: 700; color: var(--red); display: block; margin: 0.5rem 0 1rem; position: relative; }
.total-amount::after { content: ''; position: absolute; bottom: 4px; left: -8px; right: -8px; height: 14px; background: var(--red-soft); border-radius: 2px; z-index: -1; transform: rotate(-0.3deg); }
.hero-sub { font-size: 1.1rem; color: var(--ink-light); max-width: 500px; font-weight: 400; font-style: italic; margin-bottom: 1rem; }
.hero-creditors-count { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faded); letter-spacing: 1.5px; }
.hero-arrow { margin-top: 2.5rem; color: var(--ink-faded); font-size: 1.5rem; animation: bounce 2s infinite; }

/* ========== DASHBOARD ========== */
.dashboard { padding: 4rem 2rem; max-width: 960px; margin: 0 auto; }
.dash-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.3rem; flex-wrap: wrap; }
.dash-header h2 { font-family: var(--font-hand); font-size: 2.2rem; font-weight: 600; }
.stamp { background: var(--red); color: var(--paper); font-family: var(--font-mono); font-size: 0.55rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; padding: 0.3rem 0.7rem; transform: rotate(-3deg); border-radius: 2px; }
.dash-sub { color: var(--ink-faded); font-style: italic; font-size: 0.9rem; margin-bottom: 2rem; }
.rate-info { font-family: var(--font-mono); font-size: 0.58rem; color: var(--ink-faded); letter-spacing: 1px; margin-bottom: 2rem; padding: 0.6rem 1rem; background: var(--paper-dark); border-radius: 3px; border: 1px solid var(--paper-deeper); }
.rate-info span { color: var(--green); font-weight: 600; }

.total-card { background: var(--paper-light); border: 2px solid var(--red-glow); border-radius: 4px; padding: 2rem 2.5rem; margin-bottom: 2rem; box-shadow: 0 4px 20px var(--shadow-md); position: relative; overflow: hidden; text-align: center; }
.total-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--red); }
.total-card .label { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 3px; text-transform: uppercase; color: var(--ink-faded); margin-bottom: 0.5rem; }
.total-card .value { font-family: var(--font-mono); font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 700; color: var(--red); }
.total-card .creditor-count { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-faded); margin-top: 0.3rem; }

.creditor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); gap: 1.2rem; margin-top: 1.5rem; }
.creditor-card { background: var(--paper-light); border: 1.5px solid var(--paper-deeper); border-radius: 4px; padding: 1.6rem 1.5rem; position: relative; box-shadow: 0 2px 8px var(--shadow); transition: all 0.35s ease; cursor: pointer; overflow: hidden; text-decoration: none; color: inherit; display: block; }
.creditor-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px var(--shadow-md); border-color: var(--red-glow); }
.creditor-card::after { content: ''; position: absolute; top: 10px; right: 10px; width: 40px; height: 14px; background: var(--tape); transform: rotate(2deg); border-radius: 1px; }
.creditor-icon { font-size: 1.6rem; margin-bottom: 0.6rem; }
.creditor-name { font-family: var(--font-hand); font-size: 1.4rem; font-weight: 600; margin-bottom: 0.15rem; line-height: 1.2; }
.creditor-type { font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-faded); margin-bottom: 0.8rem; }
.creditor-amount { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--red); margin-bottom: 0.15rem; }
.creditor-original { font-family: var(--font-mono); font-size: 0.6rem; color: var(--ink-faded); margin-bottom: 0.8rem; }
.creditor-bar-bg { width: 100%; height: 6px; background: var(--paper-deeper); border-radius: 10px; overflow: hidden; }
.creditor-bar-fill { height: 100%; border-radius: 10px; transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1); }
.creditor-bar-fill.unpaid { background: var(--red); width: 100%; }
.creditor-bar-fill.partial { background: linear-gradient(90deg, var(--green), #2ecc71); }
.creditor-pct { font-family: var(--font-mono); font-size: 0.55rem; color: var(--ink-faded); margin-top: 0.3rem; text-align: right; letter-spacing: 1px; }
.click-hint { font-family: var(--font-hand); font-size: 0.85rem; color: var(--blue); margin-top: 0.6rem; opacity: 0; transition: opacity 0.3s; }
.creditor-card:hover .click-hint { opacity: 1; }

/* ========== JOURNAL ========== */
.journal { padding: 5rem 2rem; max-width: 720px; margin: 0 auto; }
.journal-header { margin-bottom: 2.5rem; }
.journal-header h2 { font-family: var(--font-hand); font-size: 2.5rem; font-weight: 700; }
.journal-header p { color: var(--ink-faded); font-style: italic; }

.journal-entry { margin-bottom: 2.5rem; padding: 1.8rem 2rem; background: var(--paper-light); border-left: 3px solid var(--amber); border-radius: 0 4px 4px 0; box-shadow: 0 1px 6px var(--shadow); position: relative; }
.journal-entry.story-entry { border-left-color: var(--blue); }
.journal-entry.life-entry { border-left-color: var(--green); }

.entry-tags { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
.entry-tag { font-family: var(--font-mono); font-size: 0.5rem; letter-spacing: 1.5px; text-transform: uppercase; padding: 0.2rem 0.5rem; border-radius: 2px; }
.tag-daily { background: var(--amber-soft); color: var(--amber); }
.tag-story { background: var(--blue-soft); color: var(--blue); }
.tag-life { background: var(--green-soft); color: var(--green); }

.entry-date { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 2px; color: var(--ink-faded); margin-bottom: 0.6rem; text-transform: uppercase; }
.entry-title { font-family: var(--font-hand); font-size: 1.55rem; margin-bottom: 0.5rem; line-height: 1.2; }
.entry-title a { color: var(--ink); text-decoration: none; }
.entry-title a:hover { color: var(--red); }
.entry-excerpt { color: var(--ink-light); font-size: 0.95rem; line-height: 1.85; }
.entry-excerpt .hl { background: #ffeaa7aa; padding: 0 3px; border-radius: 2px; }
.read-more { display: inline-block; margin-top: 1rem; font-family: var(--font-hand); font-size: 1rem; color: var(--red); text-decoration: none; border-bottom: 1.5px dashed var(--red-soft); transition: border-color 0.3s; }
.read-more:hover { border-color: var(--red); }

/* ========== SINGLE POST ========== */
.single-post { padding: 7rem 2rem 4rem; max-width: 720px; margin: 0 auto; }
.single-post .post-content { font-size: 1.05rem; line-height: 1.9; color: var(--ink-light); }
.single-post .post-content p { margin-bottom: 1.5rem; }
.single-post .post-content h2 { font-family: var(--font-hand); font-size: 1.8rem; margin: 2rem 0 1rem; color: var(--ink); }
.single-post .post-content blockquote { border-left: 3px solid var(--amber); padding: 1rem 1.5rem; background: var(--amber-soft); margin: 1.5rem 0; font-style: italic; border-radius: 0 4px 4px 0; }

/* ========== SERVICES ========== */
.services { padding: 5rem 2rem; background: var(--paper-dark); }
.services-inner { max-width: 900px; margin: 0 auto; }
.services-inner h2 { font-family: var(--font-hand); font-size: 2.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.services-inner > p { color: var(--ink-faded); font-style: italic; max-width: 500px; margin-bottom: 2.5rem; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 1.3rem; }
.svc-card { background: var(--paper-light); padding: 2rem; border: 1.5px solid var(--paper-deeper); border-radius: 4px; box-shadow: 0 2px 8px var(--shadow); transition: all 0.3s; }
.svc-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px var(--shadow-md); }
.svc-icon { font-size: 1.6rem; margin-bottom: 0.8rem; }
.svc-card h3 { font-family: var(--font-hand); font-size: 1.45rem; font-weight: 600; margin-bottom: 0.5rem; }
.svc-card p { color: var(--ink-light); font-size: 0.88rem; line-height: 1.7; }
.svc-tag { display: inline-block; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 1px; color: var(--green); background: var(--green-soft); padding: 0.25rem 0.6rem; border-radius: 2px; font-weight: 600; }
.svc-cta { display: inline-block; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--red); text-decoration: none; font-weight: 600; letter-spacing: 0.5px; transition: color 0.2s; }
.svc-cta:hover { color: var(--ink); }

/* ========== NEWSLETTER ========== */
.newsletter { padding: 4rem 2rem; text-align: center; max-width: 620px; margin: 0 auto; }
.newsletter-card { background: var(--paper-light); border: 1px dashed var(--paper-deeper); border-radius: 6px; padding: 2.5rem; }
.newsletter-card h2 { font-family: var(--font-hand); font-size: 2rem; margin-bottom: 0.5rem; }
.newsletter-card p { color: var(--ink-light); font-size: 0.95rem; margin-bottom: 1.5rem; }
.nl-form { display: flex; gap: 0.5rem; max-width: 420px; margin: 0 auto; }
.nl-input { flex: 1; padding: 0.7rem 1rem; border: 1px solid var(--paper-deeper); border-radius: 3px; background: var(--paper); font-family: var(--font-body); font-size: 0.9rem; color: var(--ink); outline: none; }
.nl-input:focus { border-color: var(--red); }
.nl-input::placeholder { color: var(--ink-faded); }
.nl-btn { padding: 0.7rem 1.2rem; background: var(--red); color: #fff; border: none; border-radius: 3px; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.5px; font-weight: 600; cursor: pointer; transition: background 0.2s; white-space: nowrap; }
.nl-btn:hover { background: var(--ink); }
.nl-fine { margin-top: 0.8rem; font-family: var(--font-mono); font-size: 0.6rem; color: var(--ink-faded); letter-spacing: 0.5px; }
@media (max-width: 500px) { .nl-form { flex-direction: column; } }

/* ========== DONATE ========== */
.donate { padding: 5rem 2rem; text-align: center; max-width: 620px; margin: 0 auto; }
.donate-card { background: #fffef6; border: 1.5px solid var(--paper-deeper); border-radius: 3px; padding: 2.8rem 2.5rem; box-shadow: 0 4px 18px var(--shadow-md); position: relative; transform: rotate(-0.4deg); }
.donate-card::before { content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 65px; height: 18px; background: var(--tape); border-radius: 1px; }
.donate-card h2 { font-family: var(--font-hand); font-size: 2.2rem; font-weight: 700; margin-bottom: 0.8rem; }
.donate-card .txt { color: var(--ink-light); font-size: 0.98rem; max-width: 430px; margin: 0 auto 2rem; line-height: 1.85; font-style: italic; }
.donate-btn { display: inline-block; padding: 1rem 2.5rem; font-family: var(--font-hand); font-size: 1.3rem; font-weight: 600; background: var(--red); color: var(--paper); border: none; border-radius: 4px; cursor: pointer; text-decoration: none; transition: all 0.3s; box-shadow: 0 3px 10px #c0392b33; }
.donate-btn:hover { background: #a93226; transform: translateY(-2px); }
.donate-fine { margin-top: 1rem; font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 1.5px; color: var(--ink-faded); text-transform: uppercase; }

/* ========== FOOTER ========== */
footer.site-footer { padding: 2.5rem 2rem; border-top: 1px dashed var(--paper-deeper); text-align: center; font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 1.5px; color: var(--ink-faded); }
footer.site-footer .heart { color: var(--red); font-style: normal; }
.creditor-donate { display: block; margin-top: 0.6rem; font-family: var(--font-mono); font-size: 0.6rem; color: var(--red); text-decoration: none; font-weight: 600; letter-spacing: 0.5px; transition: color 0.2s; }
.creditor-donate:hover { color: var(--ink); }
.footer-donate { display: inline-block; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.7rem; color: var(--red); text-decoration: none; font-weight: 600; letter-spacing: 0.5px; padding: 0.4rem 1rem; border: 1px solid var(--red); border-radius: 3px; transition: all 0.2s; }
.footer-donate:hover { background: var(--red); color: #fff; }

/* ========== PRIVATE PANEL ========== */
.private-panel { padding: 6rem 2rem 4rem; max-width: 800px; margin: 0 auto; }
.private-panel h1 { font-family: var(--font-hand); font-size: 2.5rem; margin-bottom: 0.5rem; }
.private-panel .panel-sub { color: var(--ink-faded); font-style: italic; margin-bottom: 2rem; }

.panel-section { background: var(--paper-light); border: 1.5px solid var(--paper-deeper); border-radius: 4px; padding: 2rem; margin-bottom: 2rem; box-shadow: 0 2px 8px var(--shadow); }
.panel-section h2 { font-family: var(--font-hand); font-size: 1.6rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }

.creditor-row { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px dashed var(--paper-deeper); flex-wrap: wrap; }
.creditor-row:last-child { border-bottom: none; }
.creditor-row .cr-icon { font-size: 1.3rem; }
.creditor-row .cr-name { font-family: var(--font-hand); font-size: 1.15rem; font-weight: 600; min-width: 130px; }
.creditor-row input[type="number"] {
  font-family: var(--font-mono); font-size: 0.85rem; padding: 0.5rem 0.8rem;
  border: 1.5px solid var(--paper-deeper); border-radius: 3px; background: var(--paper);
  color: var(--ink); width: 140px; transition: border-color 0.3s;
}
.creditor-row input[type="number"]:focus { border-color: var(--red); outline: none; }
.creditor-row .cr-currency { font-family: var(--font-mono); font-size: 0.65rem; color: var(--ink-faded); letter-spacing: 1px; }

.btn-save {
  display: inline-block; padding: 0.8rem 2rem; font-family: var(--font-hand);
  font-size: 1.2rem; font-weight: 600; background: var(--green); color: var(--paper);
  border: none; border-radius: 4px; cursor: pointer; transition: all 0.3s;
  margin-top: 1rem;
}
.btn-save:hover { background: #166b32; transform: translateY(-1px); }

.btn-publish {
  display: inline-block; padding: 0.8rem 2rem; font-family: var(--font-hand);
  font-size: 1.2rem; font-weight: 600; background: var(--blue); color: var(--paper);
  border: none; border-radius: 4px; cursor: pointer; transition: all 0.3s;
  margin-top: 1rem;
}
.btn-publish:hover { background: #234d73; transform: translateY(-1px); }

.panel-textarea {
  width: 100%; min-height: 200px; padding: 1rem; font-family: var(--font-body);
  font-size: 0.95rem; line-height: 1.7; border: 1.5px solid var(--paper-deeper);
  border-radius: 4px; background: var(--paper); color: var(--ink); resize: vertical;
  transition: border-color 0.3s;
}
.panel-textarea:focus { border-color: var(--blue); outline: none; }

.panel-input {
  width: 100%; padding: 0.6rem 1rem; font-family: var(--font-hand);
  font-size: 1.2rem; border: 1.5px solid var(--paper-deeper);
  border-radius: 4px; background: var(--paper); color: var(--ink);
  transition: border-color 0.3s; margin-bottom: 0.8rem;
}
.panel-input:focus { border-color: var(--blue); outline: none; }

.panel-select {
  padding: 0.5rem 1rem; font-family: var(--font-mono); font-size: 0.8rem;
  border: 1.5px solid var(--paper-deeper); border-radius: 3px;
  background: var(--paper); color: var(--ink); margin-bottom: 0.8rem;
}

.panel-toast {
  position: fixed; bottom: 2rem; right: 2rem; padding: 1rem 1.5rem;
  background: var(--green); color: var(--paper); font-family: var(--font-hand);
  font-size: 1.1rem; border-radius: 4px; box-shadow: 0 4px 15px #1e7a3e44;
  transform: translateY(100px); opacity: 0; transition: all 0.4s ease; z-index: 300;
}
.panel-toast.show { transform: translateY(0); opacity: 1; }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.reveal { opacity: 0; transform: translateY(20px); transition: all 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.loading-rates { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--paper-deeper); border-top-color: var(--red); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 0.5rem; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .hero { padding: 6rem 1.5rem 3rem; }
  .hero::before { left: 25px; }
  .dashboard { padding: 3rem 1rem; }
  .creditor-grid { grid-template-columns: 1fr; }
  .journal { padding: 3rem 1.2rem; }
  .journal-entry { padding: 1.4rem 1.2rem; }
  .services { padding: 3rem 1.2rem; }
  .donate { padding: 3rem 1.2rem; }
  .donate-card { padding: 2rem 1.5rem; }
  .private-panel { padding: 5rem 1rem 3rem; }
  .creditor-row { gap: 0.5rem; }
  .creditor-row input[type="number"] { width: 110px; }
}
