/* ===========================================================================
   Taylors Crest HOA — "established, leafy craftsman" theme
   Self-hosted fonts (privacy: no third-party font CDN), warm parchment +
   pine green + muted brass. Refined and trustworthy, built for legibility.
   =========================================================================== */

/* --- Fonts (self-hosted, latin subset) ----------------------------------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/fraunces-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/fraunces-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/hanken-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/hanken-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/hanken-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/hanken-700.woff2') format('woff2');
}

:root {
  --bg: #f4efe4;
  --bg-tint: #efe8d8;
  --surface: #fffdf8;
  --ink: #233029;
  --muted: #6f7b72;
  --line: #e5ddcd;
  --pine: #1e4a3a;
  --pine-dark: #153729;
  --pine-soft: #2c6650;
  --brass: #b08431;
  --brass-dark: #8f6a23;
  --danger: #a23b32;
  --draft: #b07d2a;
  --approved: #1e4a3a;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(28, 40, 33, 0.06);
  --shadow: 0 2px 4px rgba(28, 40, 33, 0.06), 0 10px 28px rgba(28, 40, 33, 0.07);
  --shadow-lg: 0 14px 40px rgba(28, 40, 33, 0.14);
  --display: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 100% -10%, rgba(176, 132, 49, 0.05), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(30, 74, 58, 0.05), transparent 55%);
  background-attachment: fixed;
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

/* --- Header --------------------------------------------------------------- */
.site-header {
  background:
    linear-gradient(180deg, var(--pine-soft) 0%, var(--pine) 55%, var(--pine-dark) 100%);
  border-bottom: 3px solid var(--brass);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
}
.brand:hover { color: #fff; }
.nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-wrap: wrap;
}
.nav a, .nav .linklike {
  position: relative;
  color: #e7efe9;
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 7px;
  font-size: 0.93rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav a:hover, .nav .linklike:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.nav a.active { color: #fff; }
.nav a.active::after {
  content: '';
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.05rem;
  height: 2px;
  border-radius: 2px;
  background: var(--brass);
}
.linklike { background: none; border: none; cursor: pointer; font: inherit; }
.inline-form { display: inline; margin: 0; }

/* --- Layout --------------------------------------------------------------- */
.main { flex: 1 0 auto; padding-top: 2rem; padding-bottom: 3rem; }
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.2rem 0;
}
.site-footer p { margin: 0; }
.footer-disclaimer {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

/* --- Typography ----------------------------------------------------------- */
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.005em;
  margin: 1.9rem 0 0.7rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
a { color: var(--pine); }

/* --- Cards / sections ----------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.auth-card { margin-top: 3rem; }
.auth-card h1 { color: var(--pine-dark); }
.welcome { margin-bottom: 1.4rem; }
.welcome h1 { color: var(--pine-dark); }

/* --- Banner (announcements) ---------------------------------------------- */
.banner {
  position: relative;
  background: #fbf3df;
  border: 1px solid #ecd9a6;
  border-left: 5px solid var(--brass);
  color: #6c531c;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.9rem;
  font-weight: 500;
}

/* --- Flash messages ------------------------------------------------------- */
.flash {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-weight: 500;
}
.flash-success { background: #e7f2ec; border-color: #b8dac8; color: #1c5740; }
.flash-error { background: #f8e8e6; border-color: #e3bdb8; color: #8c2f27; }
.flash-notice { background: #f3eede; border-color: #e2d2a8; color: #6c531c; }

/* --- Tiles ---------------------------------------------------------------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}
.tile {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem 1.4rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.tile::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--brass);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.18s ease;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #d8cdb6;
}
.tile:hover::before { transform: scaleY(1); }
.tile h2 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
  color: var(--pine-dark);
  font-size: 1.2rem;
}
.tile p { margin: 0; color: var(--muted); font-size: 0.93rem; }

/* --- Forms ---------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 0.95rem; }
.stack label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.93rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.95rem; }
input[type="text"], input[type="password"], input[type="url"],
input[type="number"], input[type="date"], input[type="time"],
select, textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pine-soft);
  box-shadow: 0 0 0 3px rgba(44, 102, 80, 0.16);
}
.checkbox { flex-direction: row !important; align-items: center; gap: 0.5rem; font-weight: 400; }
.checkbox input { width: auto; }
input[type="file"] { padding: 0.4rem 0; border: none; }

/* --- Buttons -------------------------------------------------------------- */
.button {
  display: inline-block;
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--pine);
  background: var(--pine);
  color: #fff;
  padding: 0.58rem 1.05rem;
  border-radius: 9px;
  line-height: 1.2;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.button:hover { background: var(--pine-dark); border-color: var(--pine-dark); color: #fff; transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { width: 100%; padding: 0.7rem 1rem; box-shadow: var(--shadow-sm); }
.button.small { padding: 0.38rem 0.72rem; font-size: 0.85rem; border-radius: 8px; }
.button.ghost { background: #fff; color: var(--pine-dark); border-color: var(--line); }
.button.ghost:hover { background: #f1ece0; border-color: #d8cdb6; }
.button.danger { background: #fff; color: var(--danger); border-color: #e3bdb8; }
.button.danger:hover { background: #f8e8e6; border-color: #d9a59e; }

/* --- Document lists ------------------------------------------------------- */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.7rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.doc-row:hover { box-shadow: var(--shadow); border-color: #d8cdb6; }
.doc-main { display: flex; align-items: center; flex-wrap: wrap; gap: 0.55rem; min-width: 0; }
.doc-title { font-weight: 600; }
.doc-sub { color: var(--muted); }
.doc-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

/* --- Badges --------------------------------------------------------------- */
.badge {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
}
.badge-approved { background: var(--approved); }
.badge-draft { background: var(--draft); }
.badge-year { background: var(--pine-dark); }

/* --- Home/login background image (gatehouse) ----------------------------- */
body.home-bg {
  background-image:
    linear-gradient(rgba(244, 239, 228, 0.34), rgba(244, 239, 228, 0.52)),
    url("/static/gatehouse.png");
  background-size: cover;
  background-position: center 30%;
  background-attachment: fixed;
  background-repeat: no-repeat;
}
body.home-bg .welcome {
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
body.home-bg .site-footer { background: transparent; border-top: none; }
body.home-bg .site-footer p { color: var(--ink); text-shadow: 0 1px 2px rgba(255, 253, 248, 0.9); }

/* --- Page-load motion (respects reduced-motion) -------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .main > * { animation: riseIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .main > *:nth-child(1) { animation-delay: 0.02s; }
  .main > *:nth-child(2) { animation-delay: 0.09s; }
  .main > *:nth-child(3) { animation-delay: 0.16s; }
  .main > *:nth-child(4) { animation-delay: 0.23s; }
  .main > *:nth-child(5) { animation-delay: 0.30s; }
  .main > *:nth-child(n+6) { animation-delay: 0.36s; }
  .tiles .tile { animation: riseIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .tiles .tile:nth-child(2) { animation-delay: 0.06s; }
  .tiles .tile:nth-child(3) { animation-delay: 0.12s; }
  .tiles .tile:nth-child(4) { animation-delay: 0.18s; }
  .tiles .tile:nth-child(5) { animation-delay: 0.24s; }
  .tiles .tile:nth-child(6) { animation-delay: 0.30s; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  body.home-bg { background-attachment: scroll; }
}
