/* ============================================================
   DOOKUN AI — UNIVERSAL DESIGN SYSTEM
   Canonical stylesheet for:
   ai.dookun.com
   localai.dookun.com
   and future Dookun AI tools.

   Do not redefine core typography/colors per product.
   Product CSS may extend this file, not replace it.
   ============================================================ */

:root {
  /* Typography */
  --dai-font:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  --dai-weight-regular: 400;
  --dai-weight-medium: 600;
  --dai-weight-bold: 700;
  --dai-weight-heavy: 800;

  /* Brand */
  --dai-text: #271a3b;
  --dai-muted: #70667c;
  --dai-purple: #7c3aed;
  --dai-purple-dark: #6330cf;
  --dai-purple-soft: #f2ebff;

  /* Surfaces */
  --dai-bg: #fffaf4;
  --dai-panel: #ffffff;
  --dai-border: #e8ddf8;
  --dai-shadow: 0 18px 48px rgba(92,52,132,.09);

  /* Geometry */
  --dai-radius-sm: 10px;
  --dai-radius-md: 16px;
  --dai-radius-lg: 24px;
  --dai-shell: 1180px;
}

/* ------------------------------------------------------------
   TYPOGRAPHY — same everywhere
   ------------------------------------------------------------ */

html,
body,
button,
input,
select,
textarea {
  font-family: var(--dai-font);
}

body {
  color: var(--dai-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--dai-font);
  color: var(--dai-text);
}

h1 {
  font-weight: var(--dai-weight-heavy);
  letter-spacing: -0.055em;
}

h2,
h3 {
  font-weight: var(--dai-weight-bold);
  letter-spacing: -0.035em;
}

p {
  color: var(--dai-muted);
}

/* The canonical Dookun AI hero treatment — matches LocalAI */
.dai-hero-title,
.hero h1,
.compact-intro h1 {
  font-family: var(--dai-font) !important;
  font-weight: 800 !important;
  letter-spacing: -0.055em !important;
  line-height: 1 !important;
}

/* ------------------------------------------------------------
   COMMON COMPONENTS
   ------------------------------------------------------------ */

.dai-shell {
  width: min(calc(100% - 40px), var(--dai-shell));
  margin-inline: auto;
}

.dai-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid #dfcff7;
  border-radius: 999px;
  background: var(--dai-purple-soft);
  color: #6d42d8;
  font-size: .76rem;
  font-weight: 800;
}

.dai-card {
  background: var(--dai-panel);
  border: 1px solid var(--dai-border);
  border-radius: var(--dai-radius-lg);
  box-shadow: var(--dai-shadow);
}

.dai-button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #9258ff, #7137e8);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(124,58,237,.20);
}

.dai-button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--dai-border);
  border-radius: 13px;
  padding: 11px 15px;
  background: #fff;
  color: #62556f;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.dai-language-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e2d7eb;
  border-radius: 999px;
  padding: 6px 9px;
  background: #fff;
}

.dai-coming-soon {
  opacity: .58;
  filter: grayscale(.12);
  pointer-events: none;
}

/* ------------------------------------------------------------
   Existing app compatibility
   ------------------------------------------------------------ */

/* AI portal */
body .hero h1 {
  font-family: var(--dai-font) !important;
}

/* LocalAI */
body .compact-intro h1,
body .fit-summary h2,
body .result-empty-explainer h2 {
  font-family: var(--dai-font) !important;
}

/* Shared flags */
.language-switch button,
.ai-language-switch button {
  font-family: var(--dai-font);
}

/* ------------------------------------------------------------
   Responsive foundation
   ------------------------------------------------------------ */

@media (max-width: 780px) {
  .dai-shell {
    width: min(calc(100% - 24px), var(--dai-shell));
  }
}

/* AI portal hero alignment with LocalAI */
body .hero h1 {
  font-size: clamp(2rem, 4vw, 3.4rem) !important;
  line-height: 1 !important;
  letter-spacing: -0.055em !important;
  font-weight: 800 !important;
}


/* ============================================================
   DOOKUN AI — CANONICAL FAMILY SHELL
   Reference implementation: words.dookun.com
   ============================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  background: rgba(255, 250, 246, 0.94);
  border-bottom: 1px solid rgba(57, 36, 71, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .header-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  min-width: 0;
  color: var(--dai-text);
  text-decoration: none;
}

.site-header .brand-logo {
  display: block;
  width: 132px;
  max-width: 132px;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.site-header .brand-product {
  color: var(--dai-text);
  font-size: .95rem;
  font-weight: 800;
  white-space: nowrap;
}

.site-header .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.3rem;
}

.site-header .site-nav {
  display: flex;
  align-items: center;
  gap: 1.3rem;
}

.site-header .site-nav a {
  color: #352440;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 700;
}

.site-header .site-nav a:hover,
.site-header .site-nav a:focus-visible,
.site-header .site-nav a.is-active {
  color: var(--dai-purple);
}

.site-header .language-switch,
.site-header .dai-language-switch {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-left: .4rem;
  padding: .25rem .4rem;
  border: 1px solid rgba(78, 48, 96, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.site-header .language-switch button,
.site-header .dai-language-switch button {
  min-width: 34px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.site-header .language-switch button.is-active,
.site-header .language-switch button[aria-pressed="true"],
.site-header .dai-language-switch button.is-active,
.site-header .dai-language-switch button[aria-pressed="true"] {
  background: #f1e5ff;
}


/* Shared family footer */

.site-footer {
  border-top: 1px solid var(--dai-border);
  background: rgba(255, 255, 255, .55);
}

.site-footer .footer-inner {
  min-height: 120px;
  padding-block: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-footer .footer-brand p,
.site-footer .footer-inner p {
  margin: .35rem 0 0;
  color: #766a7b;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
}

.site-footer .footer-links a {
  color: #573276;
  font-weight: 700;
  text-decoration: none;
}


/* Canonical family-shell mobile behaviour */

@media (max-width: 780px) {
  .site-header .header-inner {
    min-height: 66px;
    gap: .65rem;
  }

  .site-header .brand-logo {
    width: 105px;
    max-width: 105px;
  }

  .site-header .brand-product {
    font-size: .82rem;
  }

  .site-header .site-nav {
    display: none;
  }

  .site-header .header-actions {
    margin-left: auto;
    gap: .5rem;
  }

  .site-header .language-switch,
  .site-header .dai-language-switch {
    margin-left: auto;
  }

  .site-footer .footer-inner {
    display: grid;
    align-items: start;
  }
}

/* === DOOKUN FAMILY SHELL START === */

/* ============================================================
   DOOKUN AI — CANONICAL FAMILY SHELL
   Layout reference: words.dookun.com
   ============================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  background: rgba(255, 250, 246, 0.94);
  border-bottom: 1px solid rgba(57, 36, 71, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .header-inner {
  min-height: 74px !important;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  min-width: 0;
  color: var(--dai-text, #271a3b);
  text-decoration: none;
}

.site-header .brand-logo {
  display: block;
  width: 132px !important;
  max-width: 132px !important;
  height: auto !important;
  object-fit: contain;
  object-position: left center;
  border-radius: 0 !important;
}

.site-header .brand-product {
  color: var(--dai-text, #271a3b);
  font-size: .95rem;
  font-weight: 800;
  white-space: nowrap;
}

.site-header .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.3rem;
}

.site-header .site-nav {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  margin-left: 0;
}

.site-header .site-nav a {
  color: #352440;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 700;
}

.site-header .site-nav a:hover,
.site-header .site-nav a:focus-visible {
  color: #7c3aed;
}

.site-header .language-switch,
.site-header .dai-language-switch {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: 0;
  padding: .25rem .4rem;
  border: 1px solid rgba(78,48,96,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  box-shadow: none;
}

.site-header .language-switch button,
.site-header .dai-language-switch button {
  appearance: none;
  min-width: 34px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  opacity: 1;
  font-size: initial;
  transform: none;
}

.site-header .language-switch button.is-active,
.site-header .language-switch button[aria-pressed="true"],
.site-header .dai-language-switch button.is-active,
.site-header .dai-language-switch button[aria-pressed="true"] {
  background: #f1e5ff;
}


/* ============================================================
   CANONICAL FAMILY FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid #e8ddf8;
  background: rgba(255,255,255,.55);
}

.site-footer .footer-inner {
  min-height: 120px;
  padding-block: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-footer .footer-brand strong {
  color: #271a3b;
  font-weight: 800;
}

.site-footer .footer-brand p {
  margin: .35rem 0 0;
  color: #766a7b;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .7rem 1.15rem;
}

.site-footer .footer-links a {
  color: #573276;
  font-weight: 700;
  text-decoration: none;
}

.site-footer .footer-links a:hover {
  color: #7c3aed;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 780px) {

  .site-header .header-inner {
    min-height: 66px !important;
    gap: .65rem;
  }

  .site-header .brand-logo {
    width: 105px !important;
    max-width: 105px !important;
  }

  .site-header .brand-product {
    font-size: .82rem;
  }

  .site-header .site-nav {
    display: none !important;
  }

  .site-header .header-actions {
    margin-left: auto;
    gap: .5rem;
  }

  .site-footer .footer-inner {
    display: grid;
    align-items: start;
  }

  .site-footer .footer-links {
    justify-content: flex-start;
  }
}

/* === DOOKUN FAMILY SHELL END === */

/* ============================================================
   DOOKUN AI — CANONICAL FAMILY FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid #e8ddf8;
  background: rgba(255,255,255,.55);
}

.site-footer .footer-inner {
  min-height: 160px;
  padding-block: 2rem;

  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: start;

  gap: 3rem;
}

.footer-left {
  display: grid;
  gap: .8rem;
}

.site-footer .footer-brand strong {
  color: #271a3b;
  font-size: 1rem;
  font-weight: 800;
}

.site-footer .footer-brand p {
  max-width: 440px;
  margin: .35rem 0 0;

  color: #766a7b;

  font-size: .9rem;
  line-height: 1.5;
}

.dai-footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;

  gap: .4rem;

  color: #94899d;

  font-size: .82rem;
}

.dai-footer-legal a {
  color: #573276;

  font-weight: 700;
  text-decoration: none;
}

.dai-footer-legal a:hover,
.dai-footer-legal a:focus-visible {
  color: #7c3aed;
}

.dai-footer-copyright {
  color: #94899d;

  font-size: .8rem;
}

.dai-footer-products {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, auto));

  gap: 2.5rem;
}

.dai-footer-group {
  display: grid;
  align-content: start;

  gap: .45rem;
}

.dai-footer-group strong {
  margin-bottom: .1rem;

  color: #7c3aed;

  font-size: .72rem;
  font-weight: 900;

  letter-spacing: .08em;
  text-transform: uppercase;
}

.dai-footer-group a {
  color: #573276;

  font-size: .9rem;
  font-weight: 700;

  line-height: 1.35;

  text-decoration: none;
}

.dai-footer-group a:hover,
.dai-footer-group a:focus-visible {
  color: #7c3aed;
}


/* ------------------------------------------------------------
   Footer responsive
   ------------------------------------------------------------ */

@media (max-width: 780px) {

  .site-footer .footer-inner {
    grid-template-columns: 1fr;

    gap: 1.7rem;
  }

  .dai-footer-products {
    grid-template-columns: repeat(3, 1fr);

    gap: 1rem;
  }
}

@media (max-width: 520px) {

  .dai-footer-products {
    grid-template-columns: 1fr;

    gap: 1.25rem;
  }
}

/* ============================================================
   DOOKUN AI — LEGAL MODALS
   ============================================================ */

html.dai-legal-open,
html.dai-legal-open body {
  overflow: hidden;
}

.dai-legal-modal[hidden] {
  display: none !important;
}

.dai-legal-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;

  display: grid;
  place-items: center;

  padding: 24px;
}

.dai-legal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(38,25,50,.58);

  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.dai-legal-dialog {
  position: relative;
  z-index: 1;

  width: min(760px,100%);
  max-height: min(82vh,900px);

  overflow: hidden;

  border: 1px solid #e7dcf1;
  border-radius: 22px;

  background: #fff;

  box-shadow:
    0 30px 90px rgba(44,24,61,.24);
}

.dai-legal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;

  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  border: 1px solid #e5daed;
  border-radius: 999px;

  background: #fff;

  color: #4c375d;

  font-size: 1.45rem;
  line-height: 1;

  cursor: pointer;
}

.dai-legal-close:hover {
  background: #f6efff;
  color: #7c3aed;
}

.dai-legal-content {
  max-height: min(82vh,900px);

  overflow-y: auto;

  padding:
    34px
    54px
    46px;
}

.dai-legal-content h2 {
  margin:
    0
    48px
    1.1rem
    0;

  color: #271a3b;

  font-size: clamp(1.8rem,4vw,2.45rem);
  font-weight: 800;

  letter-spacing: -.045em;
}

.dai-legal-content h3 {
  margin:
    1.6rem
    0
    .45rem;

  color: #352440;

  font-size: 1rem;
  font-weight: 800;
}

.dai-legal-content p {
  margin: 0 0 .95rem;

  color: #665b70;

  font-size: .94rem;
  line-height: 1.68;
}

.dai-legal-content a {
  color: #6d42d8;
  font-weight: 700;
}

@media (max-width: 640px) {

  .dai-legal-modal {
    padding: 12px;
  }

  .dai-legal-dialog {
    max-height: 90vh;
    border-radius: 18px;
  }

  .dai-legal-content {
    max-height: 90vh;

    padding:
      28px
      24px
      34px;
  }
}
