/* built-in-functions.html — Holografik Fonksiyon Osiloskobu (doc-hfo) */

.doc-hfo {
  --hfo-ink: rgba(210, 220, 245, 0.92);
  --hfo-muted: rgba(150, 165, 205, 0.78);
  --hfo-line: rgba(130, 150, 210, 0.16);
  --hfo-glass: rgba(10, 12, 26, 0.62);
  --hfo-accent: #7ec8ff;
  --hfo-accent-soft: rgba(126, 200, 255, 0.16);
  margin: 1.15rem 0 1.35rem;
  border-radius: 18px;
  border: 1px solid rgba(120, 160, 220, 0.22);
  background:
    linear-gradient(145deg, rgba(16, 20, 38, 0.94) 0%, rgba(7, 9, 18, 0.9) 55%, rgba(12, 16, 30, 0.92) 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45) inset,
    0 18px 48px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.doc-hfo[data-hfo-tone="wave"] {
  --hfo-accent: #7ec8ff;
  --hfo-accent-soft: rgba(126, 200, 255, 0.16);
}
.doc-hfo[data-hfo-tone="cut"] {
  --hfo-accent: #f0f4ff;
  --hfo-accent-soft: rgba(240, 244, 255, 0.12);
}
.doc-hfo[data-hfo-tone="ramp"] {
  --hfo-accent: #9b8cff;
  --hfo-accent-soft: rgba(155, 140, 255, 0.16);
}
.doc-hfo[data-hfo-tone="saw"] {
  --hfo-accent: #ff6b9d;
  --hfo-accent-soft: rgba(255, 107, 157, 0.14);
}
.doc-hfo[data-hfo-tone="blend"] {
  --hfo-accent: #2ee7f2;
  --hfo-accent-soft: rgba(46, 231, 242, 0.14);
}

.doc-hfo__top {
  padding: 0.8rem 0.95rem 0.95rem;
  background:
    radial-gradient(90% 70% at 50% -10%, color-mix(in srgb, var(--hfo-accent) 18%, transparent) 0%, transparent 58%),
    rgba(4, 6, 14, 0.55);
  border-bottom: 1px solid var(--hfo-line);
}

.doc-hfo__stage {
  position: relative;
  margin: 0 auto;
  max-width: min(100%, 1180px);
  height: clamp(380px, 54vmin, 580px);
  min-height: 360px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--hfo-accent) 28%, transparent);
  overflow: hidden;
  background:
    radial-gradient(ellipse 65% 48% at 50% 40%, color-mix(in srgb, var(--hfo-accent) 10%, transparent) 0%, transparent 58%),
    rgba(4, 6, 14, 0.72);
  touch-action: none;
  cursor: grab;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: border-color 0.35s ease;
}

.doc-hfo__stage:active {
  cursor: grabbing;
}

.doc-hfo__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.doc-hfo__hud {
  position: absolute;
  left: 0.7rem;
  top: 0.7rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  pointer-events: none;
}

.doc-hfo__badge,
.doc-hfo__chip {
  padding: 0.34rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--hfo-accent) 35%, transparent);
  background: linear-gradient(
    165deg,
    rgba(14, 18, 34, 0.72) 0%,
    rgba(6, 8, 18, 0.82) 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--hfo-ink);
  box-shadow: 0 0 20px color-mix(in srgb, var(--hfo-accent) 12%, transparent);
}

.doc-hfo__chip {
  font-weight: 600;
  color: color-mix(in srgb, var(--hfo-accent) 70%, #cfe8ff);
  border-color: rgba(120, 160, 210, 0.2);
  box-shadow: none;
}

.doc-hfo__code-float {
  position: absolute;
  right: 0.7rem;
  top: 0.7rem;
  z-index: 2;
  max-width: min(52%, 340px);
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--hfo-accent) 32%, transparent);
  background: rgba(5, 8, 18, 0.88);
  backdrop-filter: blur(12px);
  pointer-events: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.doc-hfo__code-float pre {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  line-height: 1.5;
  color: rgba(220, 230, 255, 0.95);
  white-space: pre-wrap;
}

.doc-hfo__error {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 90, 120, 0.35);
  background: rgba(80, 16, 28, 0.45);
  font-size: 0.82rem;
  color: rgba(255, 200, 210, 0.95);
}

.doc-hfo__desc {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--hfo-line);
  border-left: 3px solid var(--hfo-accent);
  background: linear-gradient(90deg, var(--hfo-accent-soft), rgba(8, 10, 22, 0.45));
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--hfo-ink);
  transition: border-color 0.35s ease, background 0.35s ease;
}

.doc-hfo__bottom {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 0.9fr;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem 0.95rem;
  background:
    linear-gradient(180deg, rgba(8, 10, 20, 0.35) 0%, rgba(6, 8, 16, 0.55) 100%);
  border-bottom: 1px solid var(--hfo-line);
}

.doc-hfo__panel {
  border-radius: 14px;
  border: 1px solid var(--hfo-line);
  background:
    linear-gradient(165deg, rgba(14, 18, 34, 0.72) 0%, rgba(8, 10, 22, 0.55) 100%);
  padding: 0.75rem 0.8rem 0.8rem;
  min-width: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.doc-hfo__panel--console {
  border-color: color-mix(in srgb, var(--hfo-accent) 22%, var(--hfo-line));
}

.doc-hfo__h {
  margin: 0 0 0.65rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(175, 190, 230, 0.78);
}

/* —— Fonksiyon konsolu kartları —— */
.doc-hfo__fns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.doc-hfo__fn {
  --fn-tone: #7ec8ff;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  min-height: 4.6rem;
  padding: 0.55rem 0.55rem 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(120, 150, 200, 0.14);
  background:
    linear-gradient(160deg, rgba(12, 16, 30, 0.9) 0%, rgba(8, 10, 20, 0.75) 100%);
  color: rgba(165, 180, 220, 0.72);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.22s ease,
    background 0.22s ease,
    color 0.22s ease,
    transform 0.22s ease,
    box-shadow 0.22s ease;
  overflow: hidden;
}

.doc-hfo__fn::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--fn-tone), transparent);
  opacity: 0.25;
  transition: opacity 0.22s ease;
}

.doc-hfo__fn:hover {
  border-color: color-mix(in srgb, var(--fn-tone) 40%, transparent);
  color: rgba(220, 230, 255, 0.92);
  transform: translateY(-1px);
}

.doc-hfo__fn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--fn-tone) 70%, white);
  outline-offset: 2px;
}

.doc-hfo__fn[data-hfo-tone="wave"] { --fn-tone: #7ec8ff; }
.doc-hfo__fn[data-hfo-tone="cut"] { --fn-tone: #e8eef8; }
.doc-hfo__fn[data-hfo-tone="ramp"] { --fn-tone: #a894ff; }
.doc-hfo__fn[data-hfo-tone="saw"] { --fn-tone: #ff6b9d; }
.doc-hfo__fn[data-hfo-tone="blend"] { --fn-tone: #2ee7f2; }

.doc-hfo__fn.is-active {
  border-color: color-mix(in srgb, var(--fn-tone) 55%, transparent);
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, var(--fn-tone) 18%, rgba(10, 14, 28, 0.95)) 0%,
      rgba(8, 12, 24, 0.88) 100%
    );
  color: #f4f7ff;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--fn-tone) 20%, transparent) inset,
    0 8px 22px color-mix(in srgb, var(--fn-tone) 18%, transparent);
}

.doc-hfo__fn.is-active::before {
  opacity: 1;
  height: 2px;
  background: var(--fn-tone);
  box-shadow: 0 0 12px var(--fn-tone);
}

.doc-hfo__fn-glyph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 1.15rem;
  color: color-mix(in srgb, var(--fn-tone) 75%, #9ab0d0);
  opacity: 0.85;
}

.doc-hfo__fn.is-active .doc-hfo__fn-glyph {
  color: var(--fn-tone);
  opacity: 1;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--fn-tone) 45%, transparent));
}

.doc-hfo__fn-glyph svg {
  display: block;
  width: 100%;
  max-width: 2.6rem;
  height: auto;
}

.doc-hfo__fn-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  width: 100%;
}

.doc-hfo__fn-name {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.doc-hfo__fn-sig {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(140, 160, 200, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-hfo__fn.is-active .doc-hfo__fn-sig {
  color: color-mix(in srgb, var(--fn-tone) 55%, #c8d4ef);
}

/* —— Parametreler —— */
.doc-hfo__sliders {
  display: grid;
  gap: 0.55rem;
  min-height: 2.6rem;
}

.doc-hfo__row {
  display: grid;
  grid-template-columns: 3.4rem 1fr 2.5rem;
  gap: 0.45rem;
  align-items: center;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  background: rgba(4, 8, 16, 0.35);
  border: 1px solid rgba(120, 150, 200, 0.08);
}

.doc-hfo__row[hidden] {
  display: none;
}

.doc-hfo__row label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(180, 195, 240, 0.88);
}

.doc-hfo__row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--hfo-accent) 55%, #1a2238),
    rgba(40, 50, 80, 0.9)
  );
  outline: none;
}

.doc-hfo__row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f2f7ff;
  border: 2px solid var(--hfo-accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--hfo-accent) 55%, transparent);
  cursor: pointer;
}

.doc-hfo__row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f2f7ff;
  border: 2px solid var(--hfo-accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--hfo-accent) 55%, transparent);
  cursor: pointer;
}

.doc-hfo__row output {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--hfo-accent);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.doc-hfo__chk {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
  padding: 0.4rem 0.45rem;
  border-radius: 10px;
  border: 1px solid rgba(120, 150, 200, 0.1);
  background: rgba(4, 8, 16, 0.28);
  font-size: 0.76rem;
  color: rgba(175, 190, 230, 0.9);
  cursor: pointer;
}

.doc-hfo__chk input {
  accent-color: var(--hfo-accent);
}

.doc-hfo__hint {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--hfo-muted);
}

.doc-hfo__hint code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.9em;
  color: color-mix(in srgb, var(--hfo-accent) 70%, #d0dcff);
}

.doc-hfo__live {
  margin: 0;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--hfo-accent) 22%, transparent);
  background:
    linear-gradient(180deg, rgba(6, 10, 20, 0.85) 0%, rgba(4, 6, 14, 0.7) 100%);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  line-height: 1.55;
  color: rgba(220, 230, 255, 0.95);
  white-space: pre-wrap;
  min-height: 5.8rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.doc-hfo__caption {
  margin: 0;
  padding: 0.75rem 1rem 0.9rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(165, 180, 215, 0.88);
  background: rgba(4, 6, 12, 0.35);
}

.doc-hfo__caption strong {
  color: rgba(230, 235, 255, 0.96);
}

.doc-hfo__caption code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78em;
}

@media (max-width: 980px) {
  .doc-hfo__bottom {
    grid-template-columns: 1fr;
  }

  .doc-hfo__fns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .doc-hfo__code-float {
    max-width: min(58%, 260px);
  }
}

@media (max-width: 560px) {
  .doc-hfo__fns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-hfo__fn {
    min-height: 4.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .doc-hfo__fn,
  .doc-hfo__stage,
  .doc-hfo__desc {
    transition: none;
  }
}
