/* ==========================================================================
   base.css – Tiva shared design system
   Used by: styles-organic-mockup.css (Webseite) + styles.css (Studio)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "DM Sans";
  src: url("assets/fonts/DMSans-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("assets/fonts/DMSans-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg:             #f4f1ec;
  --bg-soft:        #f8f5f1;
  --panel-bg:       rgba(246, 242, 236, 0.78);
  --menu-bg:        rgba(246, 242, 236, 0.94);

  /* Typography */
  --ink:            #5e5548;
  --ink-soft:       #7f7564;
  --muted:          #978c79;
  --legal:          #978c79;

  /* Borders & lines */
  --line:           rgba(172, 165, 151, 0.36);

  /* Accent */
  --accent:         #6b8064;
  --accent-soft:    #dce8d6;

  /* Status */
  --warning:        #ae6d56;

  /* Blobs */
  --blob-1:         rgba(201, 185, 160, 0.34);
  --blob-2:         rgba(190, 178, 160, 0.30);
  --blob-3:         rgba(214, 205, 188, 0.32);
  --blob-4:         rgba(220, 213, 198, 0.23);

  /* Buttons – green pill (shared across Webseite + Studio) */
  --btn-green-bg:           rgba(220, 232, 214, 0.62);
  --btn-green-bg-hover:     rgba(220, 232, 214, 0.88);
  --btn-green-border:       rgba(107, 128, 100, 0.70);
  --btn-green-border-strong:rgba(92,  116,  85, 0.90);
  --btn-green-text:         #4f6548;
  --btn-green-text-hover:   #41573a;

  /* Icon filters (Webseite format-cards) */
  --icon-filter:        brightness(0) saturate(100%) invert(49%) sepia(10%) saturate(765%)  hue-rotate(353deg) brightness(89%)  contrast(86%);
  --icon-filter-soft:   brightness(0) saturate(100%) invert(55%) sepia(8%)  saturate(607%)  hue-rotate(352deg) brightness(92%)  contrast(86%);
  --icon-filter-strong: brightness(0) saturate(100%) invert(45%) sepia(12%) saturate(850%)  hue-rotate(352deg) brightness(86%)  contrast(90%);

  /* Layout */
  --header-h:   64px;
  --side-pad:   56px;
  --edge-pad:   18px;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Base typography & body
   -------------------------------------------------------------------------- */
body {
  font-family: "DM Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  overflow-x: hidden;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

a:hover,
a:focus-visible {
  color: var(--ink-soft);
}

a:focus-visible,
summary:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #4f473d;
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
.organic-page {
  position: relative;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Ambient background – blobs + grain
   -------------------------------------------------------------------------- */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ambient-bg::before,
.ambient-bg::after {
  content: "";
  position: absolute;
  inset: -24%;
  border-radius: 42%;
  filter: blur(40px);
  opacity: 0.21;
}

.ambient-bg::before {
  background: radial-gradient(ellipse at 33% 40%, rgba(201, 185, 160, 0.44), transparent 62%);
  animation: tiva-liquid-sweep 108s ease-in-out infinite;
}

.ambient-bg::after {
  background: radial-gradient(ellipse at 72% 42%, rgba(184, 174, 157, 0.35), transparent 60%);
  animation: tiva-liquid-sweep-reverse 128s ease-in-out infinite;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  transform-origin: center;
}

.blob-a {
  width: 48vmax;
  height: 48vmax;
  left: -18vmax;
  top: -10vmax;
  background: var(--blob-1);
  animation: tiva-drift-a 138s ease-in-out infinite;
}

.blob-b {
  width: 42vmax;
  height: 42vmax;
  right: -16vmax;
  top: 18vmax;
  background: var(--blob-2);
  animation: tiva-drift-b 152s ease-in-out infinite;
}

.blob-c {
  width: 40vmax;
  height: 40vmax;
  left: 24vmax;
  bottom: -18vmax;
  background: var(--blob-3);
  animation: tiva-drift-c 146s ease-in-out infinite;
}

.blob-d {
  width: 34vmax;
  height: 34vmax;
  right: 20vmax;
  bottom: -14vmax;
  background: var(--blob-4);
  filter: blur(84px);
  animation: tiva-drift-d 168s ease-in-out infinite;
}

.grain {
  position: absolute;
  inset: -100%;
  opacity: 0.06;
  background-image: radial-gradient(rgba(94, 85, 72, 0.21) 0.45px, transparent 0.45px);
  background-size: 3px 3px;
  animation: tiva-grain-move 18s steps(8) infinite;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 12;
  width: 100%;
  height: var(--header-h);
  backdrop-filter: blur(6px);
  background: rgba(246, 243, 238, 0.67);
  border-bottom: 1px solid rgba(172, 165, 151, 0.16);
  box-shadow: 0 6px 18px rgba(94, 85, 72, 0.05);
  pointer-events: none;
}

.top-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 14px;
  background: linear-gradient(180deg, rgba(246, 243, 238, 0.45) 0%, rgba(246, 243, 238, 0) 100%);
  pointer-events: none;
}

.home-link {
  position: absolute;
  top: 50%;
  left: var(--edge-pad);
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: auto;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.home-link:hover,
.home-link:focus-visible {
  text-decoration: underline;
  color: var(--ink);
}

.lang-switch {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(172, 165, 151, 0.65);
  background: rgba(255, 255, 255, 0.50);
}

.lang-btn {
  min-width: 32px;
  min-height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 26px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.lang-btn.is-active {
  background: rgba(94, 85, 72, 0.14);
  color: var(--accent);
}

.lang-btn:hover,
.lang-btn:focus-visible {
  color: var(--accent);
}

.menu-wrap {
  position: absolute;
  top: 50%;
  right: var(--edge-pad);
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: auto;
  line-height: 0;
}

.menu-button {
  list-style: none;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 26px;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.menu-button::-webkit-details-marker {
  display: none;
}

.menu-button span {
  display: block;
  width: 100%;
  height: 1.4px;
  background: var(--muted);
  border-radius: 1px;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  min-width: 198px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--menu-bg);
  box-shadow: 0 10px 22px rgba(94, 85, 72, 0.08);
  backdrop-filter: blur(6px);
}

.menu-panel a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.96rem;
  line-height: 1.5;
  letter-spacing: 0.004em;
}

.menu-panel a:hover,
.menu-panel a:focus-visible {
  text-decoration: underline;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Buttons – shared pill style
   -------------------------------------------------------------------------- */
button {
  font-family: inherit;
  cursor: pointer;
}

/* Green pill – primary action (used on both Webseite + Studio) */
.format-contact-btn,
.primary-btn,
.cta-btn,
.tiny-btn,
.panel-lock-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--btn-green-border);
  border-radius: 999px;
  background: var(--btn-green-bg);
  color: var(--btn-green-text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}

.format-contact-btn:hover,
.format-contact-btn:focus-visible,
.primary-btn:hover,
.primary-btn:focus-visible,
.cta-btn:hover,
.cta-btn:focus-visible,
.tiny-btn:hover,
.tiny-btn:focus-visible,
.panel-lock-cta:hover,
.panel-lock-cta:focus-visible {
  background: var(--btn-green-bg-hover);
  border-color: var(--btn-green-border-strong);
  color: var(--btn-green-text-hover);
}

/* Ghost button */
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(172, 165, 151, 0.80);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.ghost-btn:hover,
.ghost-btn:focus-visible {
  border-color: rgba(120, 112, 97, 0.95);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Footer – shared base
   -------------------------------------------------------------------------- */
.footer {
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: var(--legal);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--legal);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--ink-soft);
}

.footer-copy {
  margin-top: 18px;
  color: var(--legal);
}

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

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Reveal animation
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: tiva-reveal-up 1.0s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.20s; }
.reveal-3 { animation-delay: 0.35s; }
.reveal-4 { animation-delay: 0.50s; }

/* --------------------------------------------------------------------------
   Video / canvas placeholder (index + studio)
   -------------------------------------------------------------------------- */
.preview-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(172, 165, 151, 0.46);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(236, 228, 215, 0.9), rgba(245, 241, 234, 0.8));
  box-shadow: 0 10px 24px rgba(94, 85, 72, 0.12);
  overflow: hidden;
}

.preview-placeholder video,
.preview-placeholder canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}

/* canvas shown only as fallback when video stream not supported */
.preview-placeholder canvas {
  display: none;
}

/* JS-controlled visibility for canvas/video fallback */
.preview-placeholder video.is-hidden  { display: none;  }
.preview-placeholder canvas.is-visible { display: block; }

.preview-placeholder canvas.preview-canvas-visible {
  display: block;
}

/* --------------------------------------------------------------------------
   Responsive – shared breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  :root {
    --side-pad: 40px;
    --edge-pad: 16px;
  }
}

@media (max-width: 600px) {
  :root {
    --header-h: 54px;
    --side-pad: 24px;
    --edge-pad: 12px;
  }

  .lang-btn {
    min-width: 30px;
    min-height: 24px;
    padding: 0 7px;
    line-height: 24px;
    font-size: 0.72rem;
  }

  .menu-panel {
    min-width: 164px;
    padding: 13px 14px;
    gap: 11px;
  }
}

/* --------------------------------------------------------------------------
   Keyframes (prefixed tiva- to avoid clashes with third-party libs)
   -------------------------------------------------------------------------- */
@keyframes tiva-reveal-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes tiva-drift-a {
  0%,  100% { transform: translate3d(-2.2%, -2.3%, 0) scale(1)     rotate(-1.6deg); }
  25%        { transform: translate3d(-0.8%, -0.6%, 0) scale(1.015) rotate(-0.5deg); }
  50%        { transform: translate3d( 1.6%,  1.4%, 0) scale(1.03)  rotate( 0.8deg); }
  75%        { transform: translate3d( 2.5%,  2.1%, 0) scale(1.04)  rotate( 1.2deg); }
}

@keyframes tiva-drift-b {
  0%,  100% { transform: translate3d( 2.2%,  2.4%, 0) scale(1.04)  rotate( 1.5deg); }
  25%        { transform: translate3d( 1.3%,  1.2%, 0) scale(1.025) rotate( 0.6deg); }
  50%        { transform: translate3d( 0.3%,  0.2%, 0) scale(1.01)  rotate(-0.2deg); }
  75%        { transform: translate3d(-1.2%, -1.1%, 0) scale(1)     rotate(-0.8deg); }
}

@keyframes tiva-drift-c {
  0%,  100% { transform: translate3d(-2.1%,  1.8%, 0) scale(1)     rotate(-0.9deg); }
  25%        { transform: translate3d(-0.9%,  0.7%, 0) scale(1.015) rotate(-0.4deg); }
  50%        { transform: translate3d( 0.8%, -0.9%, 0) scale(1.028) rotate( 0.5deg); }
  75%        { transform: translate3d( 2.1%, -1.9%, 0) scale(1.038) rotate( 0.9deg); }
}

@keyframes tiva-drift-d {
  0%,  100% { transform: translate3d( 2.1%, -1.5%, 0) scale(1.012) rotate( 0.9deg); }
  25%        { transform: translate3d( 0.8%, -0.5%, 0) scale(1.02)  rotate( 0.4deg); }
  50%        { transform: translate3d(-0.9%,  0.9%, 0) scale(1.03)  rotate(-0.4deg); }
  75%        { transform: translate3d( 1.1%,  0.1%, 0) scale(1.02)  rotate( 0.6deg); }
}

@keyframes tiva-liquid-sweep {
  0%,  100% { transform: translate3d(-3.6%, -3.1%, 0) rotate(-1.7deg) scale(1);     }
  25%        { transform: translate3d(-1.4%, -1.1%, 0) rotate(-0.8deg) scale(1.012); }
  50%        { transform: translate3d( 1.2%,  1.1%, 0) rotate( 0.6deg) scale(1.024); }
  75%        { transform: translate3d( 2.8%,  2.4%, 0) rotate( 1.3deg) scale(1.036); }
}

@keyframes tiva-liquid-sweep-reverse {
  0%,  100% { transform: translate3d( 3.2%,  2.8%, 0) rotate( 1.8deg) scale(1.038); }
  25%        { transform: translate3d( 1.8%,  1.6%, 0) rotate( 0.9deg) scale(1.026); }
  50%        { transform: translate3d( 0.4%,  0.6%, 0) rotate(-0.5deg) scale(1.016); }
  75%        { transform: translate3d(-2.2%, -1.7%, 0) rotate(-1.2deg) scale(1.006); }
}

@keyframes tiva-grain-move {
  from { transform: translate3d(0,   0,   0); }
  to   { transform: translate3d(4%, -6%,  0); }
}

@keyframes tiva-logo-breath {
  0%,  100% { transform: scale(1);     }
  50%        { transform: scale(1.006); }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .blob,
  .grain,
  .reveal,
  .ambient-bg::before,
  .ambient-bg::after {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
