:root {
  --bg-margin: #faf6ef;
  --bg-page: #ffffff;
  --text-main: #2b211a;
  --accent-terra: #c2562e;
  --accent-olive: #6b7a3a;
  --frame-color: #2b211a;
  
  --font-sans: system-ui, "Segoe UI", Roboto, sans-serif;
  --ease-kinetic: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-elevation: 4px 4px 0px 0px rgba(43, 33, 26, 0.1);
}

/* Base Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-margin);
  color: var(--text-main);
  line-height: 1.75;
  scroll-behavior: smooth;
}

body {
  padding: 2vw;
  overflow-wrap: anywhere;
  hyphens: auto;
}

/* Frame Layout */
.frame {
  background-color: var(--bg-page);
  border: 1px solid var(--frame-color);
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 96vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 4vw, 3.5rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1.5rem; }

/* Links & Buttons */
a {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  display: inline-block;
  transition: transform 0.2s var(--ease-kinetic), color 0.2s ease;
  font-weight: 600;
}

a:hover {
  transform: scale(1.05);
  color: var(--accent-terra);
}

.btn-primary {
  background-color: var(--accent-terra);
  color: var(--bg-page);
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--frame-color);
  text-decoration: none;
  font-weight: 800;
  display: inline-block;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s var(--ease-kinetic), box-shadow 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--text-main);
  color: var(--bg-margin);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevation);
}

/* Header & Nav */
.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--frame-color);
  background: transparent;
}

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text-main);
}

.brand:hover { transform: none; color: var(--text-main); }

.main-nav {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.main-nav a {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-main);
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--frame-color);
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  filter: contrast(1.2) brightness(0.7) grayscale(0.2);
}

.hero .site-header {
  border-bottom: none;
}

.hero .site-header a, .hero .site-header .mobile-toggle {
  color: var(--bg-page);
}

.hero-content {
  position: relative;
  z-index: 10;
  padding: 2rem;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 2rem;
}

.hero-title-group {
  max-width: 600px;
  color: var(--bg-page);
}

.hero-title-group h1 {
  color: var(--bg-page);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-card {
  background-color: var(--bg-margin);
  border: 1px solid var(--frame-color);
  padding: 2rem;
  width: 100%;
  max-width: 350px;
  color: var(--text-main);
}

.hero-card ul {
  list-style: none;
  margin-top: 1rem;
}

.hero-card li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
  font-weight: 600;
}

.hero-card li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent-terra);
}

/* Bento Layout */
.bento-section {
  padding: 2rem;
  border-bottom: 1px solid var(--frame-color);
}
.bento-section:last-of-type { border-bottom: none; }

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

@media (min-width: 769px) {
  .bento-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(250px, auto);
  }
  .tile-2x2 { grid-column: span 2; grid-row: span 2; }
  .tile-2x1 { grid-column: span 2; grid-row: span 1; }
  .tile-1x1 { grid-column: span 1; grid-row: span 1; }
  .tile-3x1 { grid-column: span 3; grid-row: span 1; }
  .tile-4x1 { grid-column: span 4; grid-row: span 1; }
}

.bento-tile {
  background-color: var(--bg-margin);
  border: 1px solid var(--frame-color);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  transition: transform 0.4s var(--ease-kinetic);
}

.bento-tile:hover {
  box-shadow: var(--shadow-elevation);
}

.tile-img-wrapper {
  position: relative;
  border-bottom: 1px solid var(--frame-color);
  height: 220px;
  flex-shrink: 0;
}

.tile-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge {
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  transform: translateY(50%);
  background-color: var(--accent-terra);
  color: var(--bg-page);
  padding: 0.25rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  border: 1px solid var(--frame-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
}

.badge.olive {
  background-color: var(--accent-olive);
}

.tile-content {
  padding: 2rem 1.5rem 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.tile-content p {
  margin-bottom: 1rem;
  flex-grow: 1;
}

.tile-content .btn-primary {
  align-self: flex-start;
  margin-top: auto;
}

/* Entities & Avatars */
.entity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.entity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-page);
  padding: 0.5rem 1rem 0.5rem 0.5rem;
  border: 1px solid var(--frame-color);
}

.entity-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--frame-color);
  object-fit: cover;
}

.entity-name {
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.2;
}

/* Internal Page Styles */
.page-header {
  padding: 4rem 2rem;
  border-bottom: 1px solid var(--frame-color);
  background-color: var(--bg-margin);
}

.page-content {
  padding: 3rem 2rem;
  max-width: 80ch;
  margin: 0 auto;
  background-color: var(--bg-page);
}

.page-content h2 { margin-top: 2.5rem; }
.page-content ul, .page-content ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.page-content li { margin-bottom: 0.5rem; }

/* Table Wrapper for weighing.html */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 2rem;
  border: 1px solid var(--frame-color);
  background: var(--bg-margin);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  padding: 1rem;
  border: 1px solid var(--frame-color);
  text-align: left;
}

th {
  background-color: var(--accent-olive);
  color: var(--bg-page);
  font-weight: 800;
}

/* Contact Tool Layout */
.contact-tool {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--frame-color);
}

@media (min-width: 769px) {
  .contact-tool { grid-template-columns: 1fr 1fr; }
}

.contact-form-side {
  padding: 2rem;
  background: var(--bg-page);
  border-right: 1px solid var(--frame-color);
}

.contact-preview-side {
  padding: 2rem;
  background: var(--bg-margin);
  display: flex;
  flex-direction: column;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--frame-color);
  background: var(--bg-margin);
  font-family: var(--font-sans);
  color: var(--text-main);
  resize: vertical;
}

.preview-card {
  flex-grow: 1;
  background: var(--bg-page);
  border: 1px solid var(--frame-color);
  padding: 1.5rem;
  font-family: monospace;
  white-space: pre-wrap;
  margin-bottom: 1.5rem;
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* FAQ Accordion */
.faq-item {
  border-bottom: 1px solid var(--frame-color);
}
.faq-item:last-child { border-bottom: none; }

.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1.5rem 0;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-sans);
}

.faq-a {
  padding-bottom: 1.5rem;
  display: none;
}

.faq-a.open {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--frame-color);
  background-color: var(--bg-margin);
  margin-top: auto;
}

.footer-bento {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.footer-tile {
  padding: 2rem;
  border-right: 1px solid var(--frame-color);
  border-bottom: 1px solid var(--frame-color);
}

.footer-tile:last-child { border-right: none; }

.footer-tile h4 { margin-bottom: 1rem; color: var(--accent-terra); }
.footer-tile ul { list-style: none; }
.footer-tile li { margin-bottom: 0.5rem; }
.footer-tile a { text-decoration: none; }
.footer-tile a:hover { text-decoration: underline; }

.copyright-strip {
  padding: 1.5rem 2rem;
  background: var(--bg-page);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Scroll Reveals */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.7s var(--ease-kinetic);
}

.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .mobile-toggle { display: block; }
  
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-margin);
    border-bottom: 1px solid var(--frame-color);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
    z-index: 20;
  }
  
  .main-nav.active { display: flex; }
  
  .hero .site-header { background: var(--bg-margin); }
  .hero .site-header a, .hero .site-header .mobile-toggle { color: var(--text-main); }
  
  .hero-content { align-items: flex-start; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
