/* ============================================================
   PORTABLE LABS — "The Engineered Archive"
   Signature styles. Tailwind handles layout; this file owns
   the tonal carving, editorial type, and motion that define
   the brand. Tokens mirror the Tailwind config in index.html.
   ============================================================ */

:root {
    --bg:               #131313;
    --surface-lowest:   #0e0e0e;
    --surface-low:      #1c1b1b;
    --surface:          #201f1f;
    --surface-high:     #2a2a2a;
    --surface-highest:  #353534;

    --on-surface:       #e5e2e1;
    --on-variant:       #e5beb2;

    --primary:          #ffb59c;      /* "Primary" — machined metal highlight */
    --primary-container:#ff5704;      /* "Forge" — the accent */
    --on-primary-ctr:   #501500;
    --on-primary-fxd:   #380c00;
    --outline-variant:  #5c4037;

    --ease-snap:        cubic-bezier(0.2, 1, 0.3, 1);
    --ease-smooth:      cubic-bezier(0.4, 0, 0.2, 1);

    --max:              1440px;
}

/* ------------- Base ------------- */
html { scroll-behavior: smooth; }
html, body { background: var(--bg); color: var(--on-surface); }
body {
    font-family: 'Inter', system-ui, sans-serif;
    font-feature-settings: "ss01", "cv11";
    letter-spacing: -0.01em;
    overflow-x: hidden;
}

::selection { background: var(--primary-container); color: var(--on-primary-ctr); }

h1, h2, h3, h4, .display {
    font-family: 'Epilogue', sans-serif;
    letter-spacing: -0.04em;
    line-height: 1.00;
    font-weight: 900;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; }

.label-tech {
    font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 10px;
    font-weight: 600;
}

/* ------------- Signature gradient: "Machined Metal" ------------- */
.sheen {
    background: linear-gradient(135deg, var(--primary-container) 0%, #ff7a2a 45%, var(--primary) 100%);
    color: var(--on-primary-fxd);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.sheen::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.18) 50%, transparent 80%);
    transform: translateX(-120%);
    transition: transform 700ms var(--ease-snap);
    z-index: -1;
}
.sheen:hover::after { transform: translateX(120%); }

/* ------------- Actuator buttons ------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 4px;
    padding: 14px 28px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.005em;
    transition: transform 220ms var(--ease-snap), background-color 220ms var(--ease-snap), color 220ms var(--ease-snap), filter 220ms var(--ease-snap);
    cursor: pointer;
    border: none;
    will-change: transform;
}
.btn:hover   { transform: scale(1.04); filter: brightness(1.06); }
.btn:active  { transform: scale(0.98); }
.btn-ghost   { background: transparent; color: var(--on-surface); box-shadow: inset 0 0 0 1px rgba(92,64,55,0.35); }
.btn-ghost:hover { background: var(--surface-low); box-shadow: inset 0 0 0 1px rgba(255,181,156,0.35); }

.btn-xl { padding: 18px 36px; font-size: 17px; }

/* ------------- Tonal carving: panels without borders ------------- */
.carve-low    { background: var(--surface-low); }
.carve-lowest { background: var(--surface-lowest); }
.carve-high   { background: var(--surface-high); }
.carve-highest{ background: var(--surface-highest); }

/* "Ghost border" — felt, not seen. Used only where data density demands it. */
.ghost-border { box-shadow: inset 0 0 0 1px rgba(92, 64, 55, 0.15); }

/* Ambient shadow — soft screen-glow, not drop shadow */
.ambient {
    box-shadow: 0 0 48px rgba(229, 226, 225, 0.04);
}

/* ------------- "Curator Node" — signature AI component ------------- */
.curator-node {
    background: var(--surface-highest);
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 181, 156, 0.20);
}
.curator-node::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    background: radial-gradient(120% 60% at 100% 0%, rgba(255, 87, 4, 0.12), transparent 60%);
    pointer-events: none;
}

/* ------------- Inputs ------------- */
input.field, textarea.field, select.field {
    width: 100%;
    background-color: transparent !important;
    background-image: none !important;
    color: var(--on-surface);
    font: inherit;
    padding: 14px 2px;
    border: none !important;
    border-bottom: 2px solid var(--outline-variant) !important;
    transition: border-color 220ms var(--ease-snap), background-color 220ms var(--ease-snap);
    border-radius: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none;
            appearance: none;
}
.field::placeholder { color: rgba(229, 190, 178, 0.45); }
input.field:focus, textarea.field:focus {
    outline: none !important;
    border-bottom-color: var(--primary) !important;
    background: linear-gradient(to top, rgba(255, 181, 156, 0.06), transparent 40%) !important;
    --tw-ring-shadow: 0 0 #0000;
    box-shadow: none !important;
}
input.field[aria-invalid="true"], textarea.field[aria-invalid="true"] { border-bottom-color: #ff6b5b !important; }
input.field:-webkit-autofill, textarea.field:-webkit-autofill {
    -webkit-text-fill-color: var(--on-surface);
    box-shadow: 0 0 0 1000px var(--surface-low) inset !important;
    transition: background-color 9999s ease;
}
.field-error {
    display: none;
    color: #ff8a7d;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 6px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.field-error[data-visible="true"] { display: block; }

/* ------------- Scroll reveal ------------- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 900ms var(--ease-smooth), transform 900ms var(--ease-smooth);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 80ms;  }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
.reveal[data-delay="4"] { transition-delay: 320ms; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
}

/* ------------- Nav ------------- */
.nav-root {
    transition: background-color 280ms var(--ease-smooth), backdrop-filter 280ms var(--ease-smooth);
    background: rgba(19,19,19,0.55);
    backdrop-filter: blur(10px);
}
.nav-root.is-scrolled {
    background: rgba(14,14,14,0.88);
    backdrop-filter: blur(20px);
}
.nav-link {
    position: relative;
    color: var(--on-variant);
    padding: 6px 2px;
    transition: color 220ms var(--ease-snap);
}
.nav-link::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: -2px;
    height: 2px; background: var(--primary-container);
    transform: scaleX(0); transform-origin: left;
    transition: transform 260ms var(--ease-snap);
}
.nav-link:hover, .nav-link.is-active { color: var(--primary); }
.nav-link.is-active::after { transform: scaleX(1); }

/* ------------- Hero signal visualization ------------- */
.signal-grid {
    position: relative;
    aspect-ratio: 16/6;
    border-radius: 8px;
    background:
        radial-gradient(120% 80% at 50% 110%, rgba(255,87,4,0.10), transparent 55%),
        linear-gradient(180deg, var(--surface-lowest) 0%, var(--bg) 100%);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(92,64,55,0.12);
}
.signal-grid::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(229,190,178,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(229,190,178,0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(80% 80% at 50% 50%, black 40%, transparent 100%);
}
.signal-grid .spec-chip {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--on-variant);
    background: rgba(14,14,14,0.7);
    padding: 6px 10px;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(92,64,55,0.3);
    backdrop-filter: blur(6px);
}
.signal-grid .pulse {
    position: absolute;
    width: 10px; height: 10px;
    background: var(--primary-container);
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(255,87,4,0.7);
    animation: pulse 2.4s infinite var(--ease-smooth);
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,87,4,0.6); }
    70%  { box-shadow: 0 0 0 18px rgba(255,87,4,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,87,4,0); }
}
.signal-path {
    stroke: var(--primary-container);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 6 8;
    animation: trace 3.6s linear infinite;
}
@keyframes trace { to { stroke-dashoffset: -280; } }

/* ------------- AI automation flow diagram ------------- */
.flow-path {
    fill: none;
    stroke: var(--primary-container);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-dasharray: 4 10;
    opacity: 0.55;
    animation: flowTrace 2.8s linear infinite;
}
@keyframes flowTrace { to { stroke-dashoffset: -140; } }

.flow-core {
    transform-origin: 260px 140px;
    animation: corePulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(255,87,4,0.7));
}
@keyframes corePulse {
    0%, 100% { transform: scale(1);   opacity: 1;   }
    50%      { transform: scale(1.15); opacity: 0.85;}
}

.flow-core-ring {
    transform-origin: 260px 140px;
    animation: coreRing 2.4s ease-out infinite;
}
@keyframes coreRing {
    0%   { transform: scale(0.7); opacity: 0.6; }
    100% { transform: scale(2.1); opacity: 0;   }
}

.flow-dot {
    fill: var(--primary);
    animation: dotPulse 2.2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1;   r: 3; }
    50%      { opacity: 0.45; r: 4; }
}

.flow-node rect {
    transition: stroke 260ms var(--ease-snap);
}
.flow-panel:hover .flow-node rect { stroke: rgba(255,181,156,0.55); }

@media (prefers-reduced-motion: reduce) {
    .flow-path, .flow-core, .flow-core-ring, .flow-dot { animation: none; }
}

/* ------------- Process timeline ------------- */
.timeline-rail {
    position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
    background: rgba(92,64,55,0.28);
    transform: translateX(-50%);
}
.timeline-fill {
    position: absolute; top: 0; left: 50%; width: 1px; height: 0%;
    background: linear-gradient(180deg, var(--primary-container), var(--primary));
    transform: translateX(-50%);
    transition: height 200ms linear;
    box-shadow: 0 0 12px rgba(255,87,4,0.4);
}
.timeline-node {
    position: absolute; left: 50%; width: 14px; height: 14px;
    transform: translate(-50%, -50%);
    background: var(--surface-lowest);
    border-radius: 999px;
    box-shadow: inset 0 0 0 2px var(--outline-variant);
    transition: box-shadow 260ms var(--ease-snap), background 260ms var(--ease-snap);
}
.timeline-node.is-active {
    background: var(--primary-container);
    box-shadow: inset 0 0 0 2px var(--primary-container), 0 0 0 5px rgba(255,87,4,0.18);
}

/* ------------- Card hover: tonal lift ------------- */
.tonal-card {
    background: var(--surface);
    border-radius: 8px;
    transition: background-color 260ms var(--ease-snap), transform 260ms var(--ease-snap);
}
.tonal-card:hover { background: var(--surface-high); transform: translateY(-2px); }

/* ------------- Section meta (blueprint tags) ------------- */
.section-tag {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--primary);
}
.section-tag::before {
    content: ""; width: 28px; height: 1px; background: var(--primary-container);
}

/* ------------- Ticker ------------- */
.ticker {
    display: flex; gap: 48px; white-space: nowrap;
    animation: ticker 40s linear infinite;
}
.ticker-track { overflow: hidden; mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent); }
@keyframes ticker { to { transform: translateX(-50%); } }
.ticker-item {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--on-variant);
}
.ticker-item::before {
    content: ""; width: 6px; height: 6px; background: var(--primary-container);
    display: inline-block; border-radius: 1px; transform: rotate(45deg);
}

/* ------------- Toast / form success ------------- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--surface-highest);
    color: var(--on-surface);
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,181,156,0.25), 0 0 40px rgba(0,0,0,0.6);
    opacity: 0; transform: translateY(12px);
    transition: opacity 260ms var(--ease-snap), transform 260ms var(--ease-snap);
    z-index: 100;
    font-size: 14px;
}
.toast.is-visible { opacity: 1; transform: none; }

/* ------------- Asymmetric service grid ------------- */
.editorial-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}
@media (max-width: 768px) {
    .editorial-grid { grid-template-columns: repeat(1, 1fr); }
}

/* ------------- Utilities ------------- */
.hairline-top    { box-shadow: inset 0 1px 0 0 rgba(92,64,55,0.18); }
.hairline-bottom { box-shadow: inset 0 -1px 0 0 rgba(92,64,55,0.18); }
