/* Global styles */

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

:root {
  --accent:        #b4532a;   /* text, icons, borders */
  --accent-dark:   #8f3f1f;
  --accent-tint:   rgba(180, 83, 42, 0.10);
  --accent-shadow: rgba(180, 83, 42, 0.14);
  --btn-bg:        #b4532a;   /* backgrounds behind white text */
  --btn-bg-hover:  #8f3f1f;
  --charcoal:      #1f1c18;   /* dark bands in both themes */
  --black:         #1c1915;
  --gray-900:      #24201b;
  --gray-800:      #2f2a24;
  --gray-200:      #e6e0d6;
  --gray-100:      #f6f3ee;
  --white:         #ffffff;
  --text:          #2a2621;
  --text-muted:    #6f675d;
  --radius:        10px;
  --shadow:        0 4px 24px rgba(28, 25, 21, 0.10);
  --rivet:         #cfc6ba;
  --plate:         rgba(28, 25, 21, 0.035);
  --selection:     rgba(180, 83, 42, 0.22);
}

/* Tool line art, tinted with color */
.tool {
  display: inline-block;
  width: var(--tool-size, 48px);
  height: var(--tool-size, 48px);
  background-color: currentColor;
  -webkit-mask: var(--tool-img) center / contain no-repeat;
  mask: var(--tool-img) center / contain no-repeat;
}
.tool-gear   { --tool-img: url('/img/tools/gear.svg'); }
.tool-wrench { --tool-img: url('/img/tools/wrench.svg'); }
.tool-impact { --tool-img: url('/img/tools/impact.svg'); }
.tool-drill  { --tool-img: url('/img/tools/drill.svg'); }

/* Inline line icons */
.ico {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--gray-100);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:root {
  accent-color: var(--btn-bg);
}

a {
  color: var(--accent);
}

::selection {
  background: var(--selection);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Home Page */

.home-body {
  background: var(--white);
}

.home-nav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 0;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
}

.home-logo,
.footer-logo,
.topbar-logo,
.auth-logo {
  display: inline-flex;
  align-items: center;
}

.home-logo::before,
.footer-logo::before,
.topbar-logo::before,
.auth-logo::before {
  content: '';
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  margin-right: 0.4rem;
  background-color: var(--accent);
  -webkit-mask: url('/img/tools/gear.svg') center / contain no-repeat;
  mask: url('/img/tools/gear.svg') center / contain no-repeat;
}

.nav-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.hero {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
  text-align: center;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  background-color: var(--accent);
  opacity: 0.07;
  pointer-events: none;
}

.hero::before {
  width: 260px;
  height: 260px;
  top: 2rem;
  right: 1.5rem;
  -webkit-mask: url('/img/tools/gear.svg') center / contain no-repeat;
  mask: url('/img/tools/gear.svg') center / contain no-repeat;
}

.hero::after {
  width: 200px;
  height: 200px;
  bottom: 2rem;
  left: 1.5rem;
  -webkit-mask: url('/img/tools/wrench.svg') center / contain no-repeat;
  mask: url('/img/tools/wrench.svg') center / contain no-repeat;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}

.hero-eyebrow,
.section-eyebrow {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: var(--accent);
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-headline {
  font-family: 'DM Serif Display', serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--black);
  letter-spacing: -0.02em;
}

.hero-headline em {
  font-style: italic;
  display: block;
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.hero-rule {
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 2rem auto 0;
}

/* Sections */

.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-inner.center {
  text-align: center;
}

.mission {
  background: var(--gray-100);
  padding: 4rem 1.5rem;
}

.mission-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
}

.mission-label {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--black);
}

.mission-label::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  margin-top: 0.75rem;
  background: var(--accent);
}

.mission-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mission-body p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

/* Features */

.features {
  padding: 4rem 1.5rem;
  background-image:
    repeating-linear-gradient(45deg, var(--plate) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(-45deg, var(--plate) 0 2px, transparent 2px 14px);
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--black);
  text-align: center;
  margin-bottom: 3rem;
}

.features-head {
  text-align: center;
  margin-bottom: 3rem;
}

.features-head .section-title {
  margin: 0.75rem 0 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.feat-card {
  position: relative;
  background-color: var(--white);
  background-image:
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.5px),
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.5px),
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.5px),
    radial-gradient(circle, var(--rivet) 0 2px, transparent 2.5px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  background-position: 10px 10px, calc(100% - 10px) 10px, 10px calc(100% - 10px), calc(100% - 10px) calc(100% - 10px);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.feat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 32px var(--accent-shadow);
  transform: translateY(-2px);
}

.feat-no {
  position: absolute;
  top: 1.6rem;
  right: 1.75rem;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.feat-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.feat-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feat-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--black);
}

.feat-card p {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .feat-card {
    transition: none;
  }

  .feat-card:hover {
    transform: none;
  }
}

/* Bottom CTA */

.bottom-cta {
  position: relative;
  overflow: hidden;
  background-color: var(--charcoal);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px);
  color: #f3eee7;
  padding: 4.5rem 1.5rem;
  text-align: center;
}

.bottom-cta::after {
  content: '';
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  width: 180px;
  height: 180px;
  background-color: #e08a58;
  opacity: 0.08;
  -webkit-mask: url('/img/tools/gear.svg') center / contain no-repeat;
  mask: url('/img/tools/gear.svg') center / contain no-repeat;
  pointer-events: none;
}

.bottom-cta .section-inner {
  position: relative;
  z-index: 1;
}

.bottom-cta .tool {
  --tool-size: 56px;
  color: #e08a58;
  margin-bottom: 1rem;
}

.bottom-cta h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.bottom-cta p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Footer */

.home-footer {
  background: var(--gray-100);
  border-top: 1px solid var(--gray-200);
  padding: 2rem 1.5rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo {
  font-size: 1.25rem;
  font-weight: 700;
}

.footer-copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Auth pages */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background-color: var(--charcoal);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px);
  padding: 1.5rem;
}

.auth-wrapper::before,
.auth-wrapper::after {
  content: '';
  position: absolute;
  background-color: #e08a58;
  opacity: 0.08;
  pointer-events: none;
}

.auth-wrapper::before {
  width: 320px;
  height: 320px;
  top: 2rem;
  right: 2rem;
  -webkit-mask: url('/img/tools/gear.svg') center / contain no-repeat;
  mask: url('/img/tools/gear.svg') center / contain no-repeat;
}

.auth-wrapper::after {
  width: 260px;
  height: 260px;
  bottom: 2rem;
  left: 2rem;
  -webkit-mask: url('/img/tools/impact.svg') center / contain no-repeat;
  mask: url('/img/tools/impact.svg') center / contain no-repeat;
}

.auth-card {
  position: relative;
  z-index: 1;
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  justify-content: center;
  width: 100%;
}

.logo-v {
  color: var(--accent);
}

.auth-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* Forms */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.turnstile-box:empty {
  display: none;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
}

.form-group input,
.form-group textarea {
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}

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

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--btn-bg);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--btn-bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--text-muted);
}

.btn-ghost:hover {
  background: var(--gray-100);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.4);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1.5px solid #fca5a5;
}

.btn-danger:hover {
  background: #fecaca;
  border-color: #f87171;
}

.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
}

/* Messages */

.message-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.message-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.message-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.auth-footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Dashboard */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gray-100);
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.topbar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.logo-mark {
  color: var(--accent);
  font-weight: 800;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.role-badge {
  display: inline-block;
  padding: 0.4rem 0.875rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.role-owner {
  background: var(--accent-tint);
  color: var(--accent);
}

.role-manager {
  background: #fef3c7;
  color: #92400e;
}

.role-technician {
  background: #dcfce7;
  color: #166534;
}

.topbar-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-width: 180px;
}

.topbar-right form {
  margin: 0;
}

.dashboard-main {
  flex: 1;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.dashboard-main > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.welcome-card {
  background-color: var(--charcoal);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px);
  color: #f3eee7;
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.welcome-icon {
  --tool-size: 44px;
  color: #e08a58;
  margin-bottom: 0.5rem;
}

.welcome-card h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.welcome-sub {
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  margin: 0;
}

.widget-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.widget {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: inherit;
}

a.widget:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-shadow);
}

.widget-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.widget-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

.section-header {
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

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

.feature-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.feature-card:not(.coming-soon):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.feature-card .feat-icon {
  margin-bottom: 0.25rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  background: var(--gray-100);
  color: var(--text-muted);
  border: 1px solid var(--gray-200);
  width: fit-content;
}

.coming-soon {
  opacity: 0.6;
}

/* Responsive */

@media (max-width: 768px) {
  .hero::before,
  .hero::after,
  .bottom-cta::after {
    display: none;
  }

  .hero-headline {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .mission-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .topbar-right {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .topbar-email {
    min-width: auto;
    font-size: 0.75rem;
  }

  .widget-row {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode */

html[data-theme="dark"] {
  --white:         #1f1c19;   /* card / surface backgrounds */
  --gray-100:      #141210;   /* page background */
  --gray-200:      #36302a;   /* borders */
  --black:         #f3eee7;   /* heading / strong text */
  --text:          #e7e1d8;
  --text-muted:    #a59d92;
  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --accent:        #e08a58;
  --accent-dark:   #f0a479;
  --accent-tint:   rgba(224, 138, 88, 0.14);
  --accent-shadow: rgba(0, 0, 0, 0.45);
  --btn-bg:        #b4532a;
  --btn-bg-hover:  #c8602f;
  --charcoal:      #0e0c0a;
  --rivet:         #4a423a;
  --plate:         rgba(255, 255, 255, 0.03);
  --selection:     rgba(224, 138, 88, 0.35);
}

html[data-theme="dark"] .welcome-card {
  border: 1px solid var(--gray-200);
}

/* Text set via color:var(--white) on coloured backgrounds */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-small,
html[data-theme="dark"] .badge-small { color: #ffffff; }

html[data-theme="dark"] .history-dot { border-color: var(--white); }

/* Override browser white defaults on form controls */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: var(--white);
  color: var(--text);
  border-color: var(--gray-200);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--text-muted); }

/* Message boxes (hardcoded light colours) */
html[data-theme="dark"] .error-message {
  background: #3b0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}
html[data-theme="dark"] .message-error {
  background: #3b0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}
html[data-theme="dark"] .message-success {
  background: #052e16;
  color: #86efac;
  border-color: #14532d;
}
html[data-theme="dark"] .message-warning {
  background: #1c1003;
  color: #fde68a;
  border-color: #78350f;
}
html[data-theme="dark"] .job-closed-banner {
  background: #1c1003;
  color: #fde68a;
  border-color: #78350f;
}
