/*
Theme Name: Tanger Tétouan Invest
Theme URI: https://tanger-tetouaninvest.ma
Author: Tanger Tétouan Invest
Description: Portail institutionnel de l'investissement dans la région Tanger-Tétouan-Al Hoceïma. Design gouvernemental moderne — bleus du détroit, filets laiton, typographie Archivo.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tti
*/

/* ============ Tokens ============ */
:root {
  --ink: #0e2a3c;          /* deep strait blue — text */
  --marine: #123d5c;       /* primary institutional blue */
  --marine-deep: #0b2e47;  /* dark bands */
  --teal: #0f6e66;         /* zellige teal — secondary */
  --brass: #c8972b;        /* brass accent — rules, highlights */
  --brass-soft: #e5c884;
  --paper: #f7f9fa;        /* cool white page */
  --azure: #e8f1f6;        /* pale band tint */
  --line: #d4dee5;         /* hairlines */
  --muted: #51677a;        /* secondary text */
  --white: #ffffff;
  --focus: #1d7fd1;
  --maxw: 1200px;
  --content-w: 72ch;
  --pad: clamp(1rem, 4vw, 2rem);
  --radius: 2px;
  --shadow: 0 1px 2px rgba(14, 42, 60, .08), 0 8px 24px -12px rgba(14, 42, 60, .18);
  --font: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: lining-nums;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--marine); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brass); color: var(--ink); padding: .6rem 1rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

h1, h2, h3, h4 {
  font-family: var(--font);
  font-stretch: 112%;
  font-weight: 700;
  line-height: 1.15;
  color: var(--marine-deep);
  margin: 0 0 .6em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1.1em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

/* Brass-ruled heading device (official stationery) */
.rule-head { position: relative; padding-top: .9rem; }
.rule-head::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 56px; height: 3px; background: var(--brass);
}

/* ============ Top bar ============ */
.topbar {
  background: var(--marine-deep); color: #cfe0ec;
  font-size: .8125rem; line-height: 1.4;
}
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .45rem; }
.topbar a { color: var(--brass-soft); text-decoration: none; }
.topbar a:hover { text-decoration: underline; color: var(--white); }
.topbar-right { display: flex; gap: 1.25rem; white-space: nowrap; align-items: center; }
@media (max-width: 720px) { .topbar-right { display: none; } }
.lang-switch { display: flex; gap: .15rem; }
.lang-switch a {
  color: #cfe0ec; padding: .1rem .45rem; border-radius: 2px; font-weight: 600;
}
.lang-switch a.current { background: var(--brass); color: var(--marine-deep); text-decoration: none; }

/* ============ Header ============ */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.header-main { display: flex; align-items: center; gap: 1rem; padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand svg { width: 44px; height: 44px; flex: none; }
.brand-name {
  font-stretch: 118%; font-weight: 800; font-size: 1.05rem; letter-spacing: .08em;
  text-transform: uppercase; line-height: 1.1; color: var(--marine-deep);
}
.brand-name small {
  display: block; font-stretch: 100%; font-weight: 500; font-size: .66rem;
  letter-spacing: .04em; text-transform: none; color: var(--muted); margin-top: .15rem;
}

.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .5rem .7rem; font: inherit; color: var(--marine); cursor: pointer;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.site-nav a {
  display: block; padding: .55rem .8rem; text-decoration: none; color: var(--ink);
  font-weight: 600; font-size: .9375rem; border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--teal); border-bottom-color: var(--brass); }
.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a,
.site-nav .current_page_item > a,
.site-nav .current_page_ancestor > a { border-bottom-color: var(--brass); color: var(--marine); }

@media (max-width: 980px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; border-top: 1px solid var(--line); padding-block: .5rem; }
  .site-nav a { border-left: 3px solid transparent; border-bottom: none; }
  .site-nav a:hover { border-left-color: var(--brass); }
  .header-main { flex-wrap: wrap; }
}

/* ============ Hero (front page) ============ */
.hero {
  position: relative; color: var(--white);
  background: var(--marine-deep);
  overflow: hidden;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(11, 36, 56, .93) 18%, rgba(11, 36, 56, .62) 55%, rgba(11, 36, 56, .25) 100%);
}
.hero-inner { position: relative; z-index: 1; padding-block: clamp(3.5rem, 9vw, 7rem); max-width: 640px; }
.hero h1 { color: var(--white); font-stretch: 120%; font-weight: 800; font-size: clamp(2.1rem, 5vw, 3.4rem); }
.hero p { font-size: 1.125rem; color: #dbe7f0; max-width: 54ch; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }

.btn {
  display: inline-block; padding: .75rem 1.4rem; border-radius: var(--radius);
  font-weight: 700; font-size: .9375rem; text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--brass); color: var(--marine-deep); }
.btn-primary:hover { background: var(--brass-soft); color: var(--marine-deep); }
.btn-ghost { border-color: rgba(255,255,255,.55); color: var(--white); }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: var(--white); }
.btn-marine { background: var(--marine); color: var(--white); }
.btn-marine:hover { background: var(--marine-deep); color: var(--white); }

/* Stat strip */
.stats {
  background: var(--white); border-block: 1px solid var(--line);
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.stat {
  padding: 1.4rem 1.2rem; border-left: 1px solid var(--line);
}
.stat:first-child { border-left: none; }
.stat b {
  display: block; font-stretch: 118%; font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem); color: var(--marine);
  border-top: 3px solid var(--brass); padding-top: .55rem;
}
.stat span { color: var(--muted); font-size: .875rem; line-height: 1.4; display: block; margin-top: .25rem; }
@media (max-width: 860px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: none; }
  .stat { border-top: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: none; }
}
@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat { border-left: none; border-top: 1px solid var(--line); }
  .stat:first-child { border-top: none; }
}

/* ============ Sections ============ */
.section { padding-block: clamp(2.6rem, 6vw, 4.5rem); }
.section-azure { background: var(--azure); }
.section-dark { background: var(--marine-deep); color: #d6e4ee; }
.section-dark h2, .section-dark h3 { color: var(--white); }
.section-intro { max-width: 68ch; color: var(--muted); font-size: 1.0625rem; }
.section-dark .section-intro { color: #b9cdda; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.section-head .more { font-weight: 600; white-space: nowrap; }

/* Two-column feature */
.feature { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.feature-media img { border-radius: var(--radius); box-shadow: var(--shadow); }
.feature ul { padding-left: 1.2rem; margin: 0 0 1.2rem; }
.feature li { margin-bottom: .45rem; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } }

/* Card grids */
.grid { display: grid; gap: 1.4rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 580px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
}
.card img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin-bottom: .4rem; font-size: 1.1rem; }
.card h3 a { text-decoration: none; color: var(--marine-deep); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { color: var(--muted); font-size: .9375rem; margin: 0; }
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brass); transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
  z-index: 1;
}
.card:hover::before { transform: scaleX(1); }
.card:hover { box-shadow: var(--shadow); }

/* City mosaic */
.mosaic { display: grid; gap: 1rem; grid-template-columns: repeat(6, 1fr); }
.mosaic a {
  position: relative; display: block; border-radius: var(--radius); overflow: hidden;
  grid-column: span 2; aspect-ratio: 4 / 3; color: var(--white); text-decoration: none;
}
.mosaic a:nth-child(1), .mosaic a:nth-child(2) { grid-column: span 3; aspect-ratio: 16 / 9; }
.mosaic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.mosaic a:hover img { transform: scale(1.04); }
.mosaic b {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.2rem 1.1rem .9rem;
  font-stretch: 112%; font-weight: 700; font-size: 1.15rem;
  background: linear-gradient(transparent, rgba(11, 36, 56, .88));
}
@media (max-width: 760px) {
  .mosaic { grid-template-columns: 1fr 1fr; }
  .mosaic a, .mosaic a:nth-child(1), .mosaic a:nth-child(2) { grid-column: span 1; aspect-ratio: 4 / 3; }
}

/* Steps (real sequence) */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; counter-reset: step; }
.step {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.3rem 1.4rem; counter-increment: step; position: relative;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  font-stretch: 120%; font-weight: 800; font-size: 1.9rem; color: var(--brass);
  display: block; margin-bottom: .5rem;
}
.step h3 { font-size: 1.05rem; }
.step p { color: var(--muted); font-size: .9375rem; margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* Dark feature band (Tanger Med) */
.band { position: relative; overflow: hidden; }
.band-media { position: absolute; inset: 0; }
.band-media img { width: 100%; height: 100%; object-fit: cover; }
.band-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11, 36, 56, .95) 30%, rgba(11, 36, 56, .55) 70%, rgba(11, 36, 56, .3));
}
.band-inner { position: relative; z-index: 1; max-width: 560px; padding-block: clamp(3rem, 7vw, 5.5rem); color: #d6e4ee; }
.band-inner h2 { color: var(--white); }
.band-figures { display: flex; gap: 2.2rem; flex-wrap: wrap; margin: 1.4rem 0 1.8rem; }
.band-figures b { display: block; font-stretch: 118%; font-weight: 800; font-size: 1.7rem; color: var(--brass-soft); }
.band-figures span { font-size: .875rem; color: #b9cdda; }

/* ============ Breadcrumb + page title band ============ */
.crumbs { background: var(--azure); border-bottom: 1px solid var(--line); font-size: .875rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: .6rem 0; }
.crumbs li { display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; color: var(--line); }
.crumbs a { color: var(--teal); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.page-band { position: relative; background: var(--marine-deep); color: var(--white); overflow: hidden; }
.page-band-media { position: absolute; inset: 0; }
.page-band-media img { width: 100%; height: 100%; object-fit: cover; }
.page-band-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(95deg, rgba(11,36,56,.94) 25%, rgba(11,36,56,.55)); }
.page-band-inner { position: relative; z-index: 1; padding-block: clamp(2.2rem, 5vw, 3.6rem); max-width: 760px; }
.page-band h1 { color: var(--white); margin: 0; }
.page-band .lede { color: #cfe0ec; font-size: 1.1rem; margin: .7rem 0 0; max-width: 60ch; }

/* ============ Interior layout ============ */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(1.6rem, 4vw, 3.2rem); padding-block: clamp(2rem, 5vw, 3.4rem); }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.side-nav { font-size: .9375rem; }
.side-nav-title { font-weight: 700; font-stretch: 112%; color: var(--marine-deep); padding-bottom: .5rem; border-bottom: 3px solid var(--brass); margin-bottom: .4rem; }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav li a {
  display: block; padding: .5rem .2rem; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.side-nav li a:hover { color: var(--teal); }
.side-nav .current_page_item > a { color: var(--marine); font-weight: 700; }
.side-nav .children { padding-left: .9rem; }
@media (max-width: 900px) { .side-nav { order: 2; } }

.content { max-width: var(--content-w); }
.content h2 { margin-top: 1.8em; position: relative; padding-top: .8rem; }
.content h2::before { content: ""; position: absolute; top: 0; left: 0; width: 44px; height: 3px; background: var(--brass); }
.content h2:first-child { margin-top: 0; }
.content h3 { margin-top: 1.4em; color: var(--marine); }
.content ul, .content ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.content li { margin-bottom: .4rem; }
.content figure { margin: 1.6rem 0; }
.content figure img { border-radius: var(--radius); box-shadow: var(--shadow); }
.content figcaption { font-size: .8125rem; color: var(--muted); margin-top: .5rem; }
.content img.alignwide { max-width: 100%; }

/* Official-publication tables */
.content table {
  width: 100%; border-collapse: collapse; margin: 1.4rem 0; font-size: .9375rem;
  background: var(--white);
}
.content th, .content td { padding: .6rem .8rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.content thead th, .content th[scope="col"] { background: var(--marine); color: var(--white); font-weight: 600; border-color: var(--marine); }
.content tbody tr:nth-child(even) { background: var(--azure); }
.content th[scope="row"] { font-weight: 600; color: var(--marine-deep); background: transparent; }
.table-scroll { overflow-x: auto; }

/* Callouts */
.note, .content blockquote {
  margin: 1.4rem 0; padding: 1rem 1.2rem; background: var(--white);
  border-left: 4px solid var(--teal); border-radius: var(--radius); box-shadow: var(--shadow);
}
.note b:first-child { color: var(--teal); }
.content blockquote p:last-child { margin: 0; }
.note-brass { border-left-color: var(--brass); }

/* Downloads / link lists */
.doc-list { list-style: none; padding: 0; margin: 1.2rem 0; }
.doc-list li { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); margin-bottom: .6rem; }
.doc-list a { display: block; padding: .8rem 1rem; text-decoration: none; font-weight: 600; color: var(--marine); }
.doc-list a:hover { background: var(--azure); }
.doc-list small { display: block; font-weight: 400; color: var(--muted); margin-top: .15rem; }

/* In-page figure grids */
.img-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.6rem 0; }
.img-grid figure { margin: 0; }
.img-grid img { aspect-ratio: 16/10; object-fit: cover; width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 580px) { .img-grid { grid-template-columns: 1fr; } }

/* ============ News ============ */
.post-meta { color: var(--muted); font-size: .875rem; margin-bottom: 1rem; }
.article-list { display: grid; gap: 1.4rem; }
.article-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; }
.article-item h2 { font-size: 1.25rem; margin: 0 0 .3rem; padding: 0; }
.article-item h2::before { display: none; }
.article-item h2 a { text-decoration: none; color: var(--marine-deep); }
.article-item h2 a:hover { color: var(--teal); }

/* ============ CTA band ============ */
.cta {
  background: var(--marine); color: var(--white); border-top: 4px solid var(--brass);
}
.cta .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding-block: 2.2rem; }
.cta h2 { color: var(--white); margin: 0 0 .3rem; }
.cta p { margin: 0; color: #c7d9e6; }

/* ============ Footer ============ */
.site-footer { background: var(--marine-deep); color: #b9cdda; font-size: .9375rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.1fr; gap: 2rem; padding-block: 2.8rem 2rem; }
.site-footer h3 { color: var(--white); font-size: .9375rem; letter-spacing: .02em; border-bottom: 2px solid var(--brass); display: inline-block; padding-bottom: .35rem; margin-bottom: .9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer a { color: #cfe0ec; text-decoration: none; }
.site-footer a:hover { color: var(--brass-soft); text-decoration: underline; }
.footer-brand { display: flex; align-items: center; gap: .7rem; color: var(--white); font-stretch: 118%; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; margin-bottom: .9rem; }
.footer-brand svg { width: 38px; height: 38px; }
.footer-note { font-size: .8125rem; line-height: 1.6; color: #8fa9bc; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding-block: 1rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .8125rem; color: #8fa9bc; }
.footer-bottom a { color: #b9cdda; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* ============ Misc ============ */
.search-form { display: flex; gap: .5rem; max-width: 460px; }
.search-form input[type="search"] {
  flex: 1; padding: .65rem .9rem; border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; background: var(--white);
}
.error-hero { text-align: left; padding-block: clamp(3rem, 8vw, 6rem); max-width: 620px; }
.error-hero .code { font-stretch: 125%; font-weight: 800; font-size: clamp(3.5rem, 10vw, 6rem); color: var(--line); line-height: 1; }
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 2rem; }
.pagination .page-numbers {
  padding: .45rem .8rem; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; background: var(--white);
}
.pagination .current { background: var(--marine); color: var(--white); border-color: var(--marine); }
.aligncenter { margin-inline: auto; }
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
