:root {
  --bg: #f4ecd8;
  --bg-2: #ede2c4;
  --ink: #1a1a1a;
  --ink-soft: #3a3a3a;
  --paper: #fbf6e9;
  --accent: #d13411;     /* tomato red */
  --accent-2: #2d5d8f;   /* dusty blue */
  --accent-3: #f0c14b;   /* mustard */
  --accent-4: #4a7c4e;   /* moss green */
  --pink: #e8a4c4;
  --line: #1a1a1a;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Fraunces', serif;
  font-variation-settings: "SOFT" 30, "WONK" 1;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(232, 74, 39, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(45, 93, 143, 0.04) 0%, transparent 50%);
}

/* Paper grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

/* ===== NAV ===== */
nav {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
  z-index: 100;
  padding: 14px 0;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-variation-settings: "WONK" 1;
}

.nav-links {
  display: flex;
  gap: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding: 4px 2px;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ===== HERO ===== */
.hero {
  padding: 64px 0 72px;
  position: relative;
  background: var(--bg-2);
  border-bottom: 2px solid var(--ink);
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}

@media (min-width: 900px) {
  .hero-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  }
}

.hero-text {
  max-width: 760px;
}

.hero-text h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-variation-settings: "WONK" 1, "SOFT" 100;
  font-size: clamp(42px, 6.5vw, 84px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.hero-text h1 .squiggle {
  display: inline-block;
  color: var(--accent);
  font-style: italic;
  position: relative;
}

.hero-text h1 .squiggle::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 6 Q 25 0, 50 6 T 100 6 T 150 6 T 198 6' stroke='%23e84a27' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.about-text p .underline {
  background-image: linear-gradient(transparent 60%, var(--accent-3) 60%);
  padding: 0 2px;
}

.hero-cta {
  margin-top: 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.hero-aside .hero-cta .btn {
  flex: 1;
  justify-content: center;
}

.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  padding: 14px 24px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border-radius: 4px;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn-primary {
  background: var(--accent);
  color: var(--paper);
}

/* ===== SECTION BASE ===== */
section {
  padding: 80px 0;
  position: relative;
}

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  display: inline-block;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-variation-settings: "WONK" 1;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 40px;
  max-width: 800px;
}

.section-title em {
  font-style: italic;
  color: var(--accent);
  font-family: 'Fraunces', serif;
}

.about-text p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 14px;
  color: var(--ink-soft);
  max-width: 600px;
}

.about-text .intro-lede {
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.55;
}

.about-text p strong {
  color: var(--ink);
  font-weight: 700;
}

.stack-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 24px;
  box-shadow: var(--shadow);
  border-radius: 8px;
  transform: rotate(1deg);
  align-self: start;
  margin-top: 0;
  width: 100%;
}

.stack-card h3 {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  margin-bottom: 16px;
  color: var(--accent);
}

.stack-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-list li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  padding: 5px 10px;
  border-radius: 999px;
  transition: all 0.2s;
  cursor: default;
}

.stack-list li:hover {
  background: var(--accent);
  color: var(--paper);
  transform: translateY(-2px);
}

/* ===== PROJECTS ===== */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 700px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.project-card {
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.project-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--ink);
}

.project-card:nth-child(2) { transform: rotate(-0.5deg); }
.project-card:nth-child(3) { transform: rotate(0.5deg); }
.project-card:nth-child(2):hover { transform: rotate(-0.5deg) translate(-3px, -3px); }
.project-card:nth-child(3):hover { transform: rotate(0.5deg) translate(-3px, -3px); }

.project-num {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 56px;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.8;
}

.project-card h3 {
  font-family: 'Fraunces', serif;
  font-weight: 800;
  font-size: 24px;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.project-card p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.project-tags span {
  background: var(--bg-2);
  border: 1px solid var(--ink);
  padding: 3px 8px;
  border-radius: 4px;
}

/* ===== TOOLS ===== */
.tools {
  background: var(--ink);
  color: var(--paper);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.tools .section-label { color: var(--accent-3); }
.tools .section-title { color: var(--paper); }
.tools .section-title em { color: var(--accent-3); }

.tools-intro {
  font-size: 17px;
  line-height: 1.6;
  color: rgba(251, 246, 233, 0.7);
  max-width: 540px;
  margin-bottom: 40px;
}

.tool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
  border-bottom: 2px solid rgba(251, 246, 233, 0.15);
  padding-bottom: 0;
}

.tool-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-bottom: none;
  background: transparent;
  color: rgba(251, 246, 233, 0.6);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.tool-tab:hover { color: var(--paper); }

.tool-tab.active {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.tool-panel {
  display: none;
  background: var(--paper);
  color: var(--ink);
  padding: 32px;
  border-radius: 0 8px 8px 8px;
  border: 2px solid var(--paper);
  min-height: 300px;
}

.tool-panel.active { display: block; }

.tool-panel h3 {
  font-family: 'Fraunces', serif;
  font-weight: 800;
  font-size: 24px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.tool-panel .tool-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.tool-input,
.tool-textarea {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  border-radius: 6px;
  outline: none;
  transition: box-shadow 0.15s;
}

.tool-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: 'JetBrains Mono', monospace;
}

.tool-input:focus,
.tool-textarea:focus {
  box-shadow: 3px 3px 0 var(--accent);
}

.tool-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tool-row .tool-input { flex: 1; min-width: 200px; }

.tool-output {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-2);
  border: 2px dashed var(--ink);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
  min-height: 50px;
}

.tool-output:empty::before {
  content: 'output will appear here…';
  color: var(--ink-soft);
  opacity: 0.5;
}

#qr-output {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: var(--paper);
}

#qr-output:empty::before {
  content: 'enter a url above to generate a qr code';
  color: var(--ink-soft);
  opacity: 0.5;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

#qr-output img,
#qr-output canvas {
  max-width: 100%;
  height: auto !important;
}

.pw-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.pw-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.pw-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.pw-length-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.pw-length-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.pw-length-display {
  background: var(--ink);
  color: var(--paper);
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}

.bg-removal-area {
  border: 2px dashed var(--ink);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  background: var(--bg);
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.bg-removal-area.dragover {
  background: var(--accent-3);
  border-color: var(--accent);
}

.bg-removal-area p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.bg-result {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

@media (min-width: 600px) {
  .bg-result.has-result { grid-template-columns: 1fr 1fr; }
}

.bg-result-box {
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 12px;
  background:
    repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 50% / 20px 20px;
  text-align: center;
}

.bg-result-box img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.bg-result-box .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--paper);
  display: inline-block;
  padding: 3px 8px;
  margin-bottom: 8px;
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.bg-loading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-align: center;
  margin-top: 16px;
  color: var(--accent);
}

/* ===== CONTACT ===== */
.contact {
  background: var(--accent);
  color: var(--paper);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
}

.contact .section-label { color: var(--ink); }

.contact-content {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.contact h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-variation-settings: "WONK" 1;
  font-size: clamp(40px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.contact h2 em {
  font-style: italic;
  color: var(--ink);
}

.contact p {
  font-size: 19px;
  line-height: 1.5;
  margin-bottom: 36px;
  opacity: 0.95;
}

.contact-form {
  text-align: left;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  border-radius: 12px;
  padding: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 600px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}

.form-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.form-field input,
.form-field textarea {
  width: 100%;
  font-family: 'Fraunces', serif;
  font-size: 16px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  border-radius: 6px;
  outline: none;
  transition: box-shadow 0.15s;
}

.form-field textarea {
  resize: vertical;
  min-height: 120px;
}

.form-field input:focus,
.form-field textarea:focus {
  box-shadow: 3px 3px 0 var(--accent);
}

.contact-links {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--paper);
  text-decoration: none;
  border: 2px solid var(--paper);
  padding: 10px 18px;
  border-radius: 999px;
  transition: all 0.2s;
}

.contact-link:hover {
  background: var(--paper);
  color: var(--accent);
}

/* ===== FOOTER ===== */
footer {
  padding: 32px 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
}

footer .heart {
  color: var(--accent);
  display: inline-block;
  animation: beat 1.4s ease-in-out infinite;
}

@keyframes beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE TWEAKS ===== */
@media (max-width: 700px) {
  .nav-links { gap: 14px; font-size: 12px; }
  .nav-links a { padding: 4px 0; }
  .hero { padding: 44px 0 56px; }
  .hero-layout { gap: 28px; }
  .hero-text h1 { margin-bottom: 20px; }
  .hero-aside .hero-cta { flex-direction: column; }
  .hero-aside .hero-cta .btn { flex-basis: 100%; }
  .stack-card {
    box-shadow: var(--shadow-sm);
    transform: none;
  }
  section { padding: 60px 0; }
  .tool-panel { padding: 20px; }
  .contact-form { padding: 20px; }
  .nav-inner { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .nav-links a:first-child { display: none; }
}
