{{--
    Вьюха: детальная страница услуги
    Маршрут: GET /services/{slug}
    Контроллер: ServiceController::show()
    Переменные: $service — модель Service
    Теги — ID из dict_values (countries + service_tags).
--}}
@extends('layouts.app')

@section('title', $service->title . ' — Ishiyama')

@section('content')

{{-- Заголовок --}}
<section class="page-hdr">
    <div class="container">
        <div class="sh-label reveal-up">Наши услуги</div>
        <h1 class="reveal">
            @if($service->icon) {{ $service->icon }} @endif
            {{ mb_strtoupper($service->title) }}
        </h1>
        <nav class="breadcrumb">
            <a href="{{ route('home') }}">Главная</a>
            <span>/</span>
            <a href="{{ route('services') }}">Услуги</a>
            <span>/</span>
            <span>{{ $service->title }}</span>
        </nav>
    </div>
</section>

{{-- Основной контент --}}
<section class="section sec-white">
    <div class="container">

        @if($service->excerpt)
            <p class="svc-detail-lead reveal">{{ $service->excerpt }}</p>
        @endif

        @php
            $tagIds = array_map('intval', $service->tags ?? []);
            $tags   = !empty($tagIds)
                ? \App\Models\DictValue::whereIn('id', $tagIds)->get(['id','value','flag'])->keyBy('id')
                : collect();
        @endphp
        @if($tags->isNotEmpty())
            <div class="svc-tags reveal" style="margin-bottom:clamp(24px,4vw,40px)">
                @foreach($tagIds as $tid)
                    @if($tags->has($tid))
                        <span class="svc-tag">{{ $tags[$tid]->flag }} {{ $tags[$tid]->value }}</span>
                    @endif
                @endforeach
            </div>
        @endif

        @if($service->description)
            <div class="svc-detail-body reveal">
                {!! $service->description !!}
            </div>
        @endif

    </div>
</section>

@endsection
