/* Due Draghi Design System - Main Styles */
/* Bold, brutalist aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ========================================================================
   CSS RESET & BASE STYLES
   ======================================================================== */

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

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: var(--background-color);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================================================
   TYPOGRAPHY
   ======================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tighter);
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-tighter);
}

h1 {
  font-size: clamp(3rem, 10vw, var(--font-size-6xl));
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tighter);
}

h2 {
  font-size: clamp(1.5rem, 4vw, var(--font-size-3xl));
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}

h3 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
}

p {
  margin-bottom: var(--space-4);
  line-height: var(--line-height-loose);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-speed-base);
}

a:hover {
  color: var(--primary-dark);
}

a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

strong, b {
  font-weight: var(--font-weight-bold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--font-size-sm);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.125rem 0.25rem;
  background-color: var(--gray-100);
  border-radius: var(--radius-xs);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  padding: var(--space-4);
  background-color: var(--gray-100);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  padding: 0;
  background-color: transparent;
}

ul, ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
  line-height: var(--line-height-relaxed);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================================================
   CONTAINERS & LAYOUT
   ======================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-6);
  }
}

/* ========================================================================
   BUTTONS
   ======================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0;
  border: 2px solid var(--border-color);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  background: var(--border-color);
  color: var(--text-inverse);
  cursor: pointer;
  transition: all var(--transition-speed-fast);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  min-height: auto;
}

.btn:hover:not(:disabled) {
  background: var(--background-color);
  color: var(--border-color);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: var(--border-color);
  color: var(--text-inverse);
}

.btn-primary {
  background: var(--border-color);
  color: var(--text-inverse);
  border: 2px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  font-size: var(--font-size-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--background-color);
  color: var(--border-color);
  transform: none;
  box-shadow: none;
}

.btn-primary:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--border-color);
  outline-offset: 3px;
}

.btn-secondary {
  background: var(--background-color);
  color: var(--border-color);
  border: 2px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  font-size: var(--font-size-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
  color: var(--text-inverse);
}

.btn-ghost {
  background: none;
  color: var(--border-color);
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: var(--font-size-xs);
}

.btn-ghost:hover:not(:disabled) {
  background: #f0f0f0;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: var(--font-size-base);
}

.btn-sm,
.btn-small {
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-2xs);
}

/* ========================================================================
   CARDS
   ======================================================================== */

.card {
  background: var(--white);
  border-radius: 0;
  box-shadow: none;
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  border: 2px solid var(--border-color);
  transition: none;
}

.card:hover {
  box-shadow: none;
  transform: none;
  border-color: var(--border-color);
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: var(--space-2);
}

.card-header p {
  color: var(--gray-600);
  font-size: var(--font-size-sm);
}

/* ========================================================================
   FORM ELEMENTS
   ======================================================================== */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
}

.form-input,
.form-select {
  width: 100%;
  border: 2px solid var(--border-color);
  border-radius: 0;
  padding: 1rem;
  font-size: var(--font-size-base);
  font-family: inherit;
  font-weight: var(--font-weight-medium);
  background: var(--background-color);
  color: var(--text-primary);
  line-height: 1.4;
  transition: all var(--transition-speed-base);
}

.form-input::placeholder {
  color: #999;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  background: #f5f5f5;
  border-color: var(--border-color);
  box-shadow: none;
}

.form-help {
  font-size: var(--font-size-sm);
  color: var(--notion-text-light);
  margin-top: var(--space-2);
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--error);
  margin-top: var(--space-2);
  font-weight: var(--font-weight-medium);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.radio-option input[type="radio"] {
  cursor: pointer;
}

.radio-option span {
  font-size: var(--font-size-sm);
  color: var(--notion-text);
}

/* ========================================================================
   HEADER & NAVIGATION
   ======================================================================== */

.header {
  background: var(--background-color);
  color: var(--text-primary);
  padding: 2rem 0;
  text-align: left;
  box-shadow: none;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--border-color);
}

.header::before {
  display: none;
}

.header > * {
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: clamp(2rem, 8vw, var(--font-size-4xl));
  font-weight: var(--font-weight-black);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-tighter);
}

@media (min-width: 768px) {
  .header h1 {
    font-size: clamp(3rem, 10vw, var(--font-size-5xl));
  }
}

.header p {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  opacity: 0.4;
  max-width: 600px;
  margin: var(--space-2) 0 0 0;
}

.notion-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--notion-border);
  background: var(--notion-bg);
}

.notion-nav-container {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.breadcrumb {
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.breadcrumb a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  font-size: var(--font-size-2xs);
  padding: 0.25rem 0.5rem;
  transition: none;
}

.breadcrumb a:hover {
  background: #f0f0f0;
}

.breadcrumb-separator {
  color: var(--text-primary);
  opacity: 0.3;
  font-weight: var(--font-weight-black);
}

/* ========================================================================
   UTILITIES
   ======================================================================== */

.hidden {
  display: none !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.tag {
  display: inline-block;
  background: var(--border-color);
  border: 2px solid var(--border-color);
  padding: var(--space-2) var(--space-3);
  border-radius: 0;
  color: var(--text-inverse);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.flex {
  display: flex;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

/* ========================================================================
   LOADING & OVERLAYS
   ======================================================================== */

.page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  background: rgba(255, 255, 255, 0.8);
  z-index: 1000;
}

.page-overlay.htmx-request {
  display: flex;
}

.page-overlay-inner {
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #ccc;
  border-top-color: var(--border-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================================================
   FORM PANEL & RESULT CARD
   ======================================================================== */

.form-panel {
  background: var(--white);
  border-radius: 0;
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: none;
  border: 2px solid var(--border-color);
}

.form-panel h2 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.result-card {
  background: var(--white);
  border-radius: 0;
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  border: 2px solid var(--border-color);
  box-shadow: none;
  transition: none;
}

.result-card.success {
  border-color: var(--border-color);
  box-shadow: none;
  background: #fafafa;
}

.tile {
  background: var(--white);
  border-radius: 0;
  padding: var(--space-4);
  border: 2px solid var(--border-color);
  transition: none;
}

.tile h3 {
  margin-top: 0;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.tile p {
  margin-bottom: 0;
  color: var(--text-primary);
  opacity: 0.6;
  font-size: var(--font-size-sm);
}

/* ========================================================================
   ACCESSIBILITY
   ======================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

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

:focus:not(:focus-visible) {
  outline: none;
}

/* ========================================================================
   MOBILE & RESPONSIVE
   ======================================================================== */

@media (max-width: 640px) {
  .btn {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 8px 12px !important;
  }

  .breadcrumb {
    flex-wrap: wrap !important;
    gap: var(--space-1) !important;
    font-size: 12px !important;
  }

  .field {
    min-height: 44px !important;
    font-size: 16px !important;
    padding: 10px 12px !important;
  }

  .form-input,
  .form-select {
    min-height: 44px !important;
    font-size: 16px !important;
  }

  .header h1 {
    font-size: var(--font-size-xl) !important;
  }

  .notion-nav-container {
    padding: var(--space-2) var(--space-3) !important;
  }

  .container {
    padding: 0 var(--space-3) !important;
  }

  h1 {
    font-size: var(--font-size-2xl);
  }

  h2 {
    font-size: var(--font-size-xl);
  }

  h3 {
    font-size: var(--font-size-lg);
  }
}

/* ========================================================================
   REDUCED MOTION
   ======================================================================== */

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